diff --git a/src/debs/build.sh b/src/debs/build.sh new file mode 100644 index 0000000..bb0b522 --- /dev/null +++ b/src/debs/build.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# Fixes ownershp +function main() { + sudo find . -type f -exec chmod 644 {} + + sudo find . -type d -exec chmod 755 {} + + + # Set postrm permissions + for i in `find . -name postrm`; do + sudo chmod 755 "${i}" + done + + # Set gwinwrap permissions + for i in `find . -name gwinwrap`; do + sudo chmod 755 "${i}" + done + + # Set xwinwrap permissions + for i in `find . -name xwinwrap`; do + sudo chmod 755 "${i}" + done + + sudo chown -R root:root ./*/ + + builder; + bash ./chownAll.sh +} + +#builds debs +function builder() { + for i in `ls`; do + if [[ -d "${i}" ]]; then + dpkg --build "${i}" + else + echo "Not a dir." + fi + done +} +main; diff --git a/src/debs/chownAll.sh b/src/debs/chownAll.sh new file mode 100644 index 0000000..44bef62 --- /dev/null +++ b/src/debs/chownAll.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +function main() { + sudo chown -R abaddon:abaddon . +} +main; diff --git a/src/debs/gwinwrap-0-0-1-x64/DEBIAN/control b/src/debs/gwinwrap-0-0-1-x64/DEBIAN/control new file mode 100644 index 0000000..a23c389 --- /dev/null +++ b/src/debs/gwinwrap-0-0-1-x64/DEBIAN/control @@ -0,0 +1,8 @@ +Package: gwinwrap64 +Version: 0.0-1 +Section: python +Priority: optional +Architecture: amd64 +Depends: ffmpegthumbnailer (>= 2.0.10-0.1), mplayer (>=2.0-728-g2c378c7-4), gifsicle (>=1.86-1), nitrogen (>=1.5.2-2), xscreensaver (>=5.36-1ubuntu1), xscreensaver-gl (>=5.36-1ubuntu1), xscreensaver-gl-extra (>=5.36-1ubuntu1), xscreensaver-screensaver-dizzy (>=0.3-3), xscreensaver-screensaver-bsod (>=5.36-1ubuntu1), xscreensaver-data (>=5.36-1ubuntu1), xscreensaver-data-extra (>=5.36-1ubuntu1), xscreensaver-screensaver-webcollage (>=5.36-1ubuntu1) +Maintainer: Maxim Stewart <1itdominator@gmail.com> +Description: GWinWrap is a GUI to handle setting XWinWrap options. diff --git a/src/debs/gwinwrap-0-0-1-x64/DEBIAN/postrm b/src/debs/gwinwrap-0-0-1-x64/DEBIAN/postrm new file mode 100755 index 0000000..0f30ccd --- /dev/null +++ b/src/debs/gwinwrap-0-0-1-x64/DEBIAN/postrm @@ -0,0 +1,11 @@ +#!/bin/bash +#postrm (script executed after uninstalling the package) +#set -e + +if [ -f /bin/xwinwrap ]; then + rm /bin/xwinwrap +fi + +if [ -d /opt/GWinWrap ]; then + rm -rf /opt/GWinWrap +fi diff --git a/src/debs/gwinwrap-0-0-1-x64/bin/gwinwrap b/src/debs/gwinwrap-0-0-1-x64/bin/gwinwrap new file mode 100755 index 0000000..2166a10 Binary files /dev/null and b/src/debs/gwinwrap-0-0-1-x64/bin/gwinwrap differ diff --git a/src/debs/gwinwrap-0-0-1-x64/bin/xwinwrap b/src/debs/gwinwrap-0-0-1-x64/bin/xwinwrap new file mode 100755 index 0000000..26eafd7 Binary files /dev/null and b/src/debs/gwinwrap-0-0-1-x64/bin/xwinwrap differ diff --git a/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/GWinWrap.desktop b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/GWinWrap.desktop new file mode 100644 index 0000000..543fdb6 --- /dev/null +++ b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/GWinWrap.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=GWinWrap +Comment=Glade gui with python controls for XWinWrap +Exec=gwinwrap +Icon=/opt/GWinWrap/resources/icons/GWinWrap.png +Terminal=false +Type=Application +Categories=Accessories;System;Settings; diff --git a/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/__init__.py b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/__init__.py new file mode 100644 index 0000000..0beb3ee --- /dev/null +++ b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/__init__.py @@ -0,0 +1,41 @@ +#!/usr/bin/python3 + +# Gtk imports +import gi, faulthandler, signal +gi.require_version('Gtk', '3.0') + +from gi.repository import Gtk as gtk +from gi.repository import Gdk as gdk +from gi.repository import GLib + +# Python imports +import inspect + +from setproctitle import setproctitle + +# Application imports +from utils import Settings +from signal_classes import CrossClassSignals + + +class Main: + def __init__(self): + setproctitle('GWinWrap') + GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, gtk.main_quit) + faulthandler.enable() # For better debug info + + settings = Settings() + builder = settings.returnBuilder() + + # Gets the methods from the classes and sets to handler. + # Then, builder connects to any signals it needs. + classes = [CrossClassSignals(settings)] + + handlers = {} + for c in classes: + methods = inspect.getmembers(c, predicate=inspect.ismethod) + handlers.update(methods) + + builder.connect_signals(handlers) + window = settings.createWindow() + window.show() diff --git a/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/__main__.py b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/__main__.py new file mode 100644 index 0000000..60c7ea2 --- /dev/null +++ b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/__main__.py @@ -0,0 +1,9 @@ +from __init__ import Main, gtk + + +if __name__ == "__main__": + try: + main = Main() + gtk.main() + except Exception as e: + print(e) diff --git a/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/gwinwrap b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/gwinwrap new file mode 100755 index 0000000..2166a10 Binary files /dev/null and b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/gwinwrap differ diff --git a/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/Main_Window.glade b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/Main_Window.glade new file mode 100644 index 0000000..495ebfe --- /dev/null +++ b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/Main_Window.glade @@ -0,0 +1,844 @@ + + + + + + + inode/directory + + + + + + + + + + True + False + gtk-clear + 3 + + + True + False + gtk-quit + 3 + + + True + False + gtk-cancel + 3 + + + True + False + gtk-jump-to + 3 + + + True + False + gtk-save + 3 + + + True + False + gtk-save + 3 + + + True + False + Settings.... + gtk-properties + 3 + + + True + False + gtk-media-play + 3 + + + True + False + gtk-media-stop + 3 + + + 950 + 600 + False + GWinWrap + center + 950 + 600 + icons/GWinWrap.png + center + + + + + + True + False + + + True + False + 15 + 15 + 15 + vertical + + + True + False + 5 + + + True + False + 15 + Note: Double click an image to view the video or image. + + + True + True + 0 + + + + + True + False + Chose Dream Scene / Image Directory + select-folder + False + Folders + Dream Scene / Image Dir + + + + False + True + 1 + + + + + True + True + True + settingsImage + True + + + + False + True + 2 + + + + + False + True + 0 + + + + + True + False + True + + + False + True + 1 + + + + + True + True + in + + + True + False + + + True + False + vertical + 10 + 10 + True + True + + + 640 + 525 + True + False + Choose Image/Video Directory... + + + + + + 0 + 0 + + + + + + + + + True + True + 2 + + + + + Clear + True + True + True + clearImage + True + + + + False + True + 3 + + + + + True + True + 0 + + + + + 300 + True + False + 10 + 15 + 15 + 15 + False + vertical + + + True + False + vertical + + + Use XScreenSaver + True + True + False + center + 5 + True + + + + False + True + 0 + + + + + True + True + in + + + True + False + True + XScreensaver List + False + + + + + + + + XScreensaves + + + + 0 + + + + + + + + + True + True + 1 + + + + + True + True + 0 + + + + + True + False + False + vertical + + + True + False + vertical + + + True + False + + + True + False + 10 + 10 + Playback Resolutions + + + True + True + 0 + + + + + True + False + 10 + 10 + Position Offset + + + True + True + 1 + + + + + False + True + 0 + + + + + True + False + + + True + False + 3 + + 7680x4320 + 3840x2160 + 2048x1080 + 1920x1080 + 1440x720 + 1600x900 + 1280x720 + 800x600 + + + + True + True + 0 + + + + + True + False + + + True + True + 1 + + + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + vertical + + + True + False + 10 + 5 + Save Path + + + True + True + 0 + + + + + True + False + 0 + + .animatedBGstarter.sh + .animatedBGstarter2.sh + .animatedBGstarter3.sh + + + + True + True + 1 + + + + + False + True + 1 + + + + + True + False + + + Save + True + True + True + True + True + saveImage + True + + + + 1 + 0 + + + + + (Re)Start + True + True + True + True + True + startImage + True + + + + 0 + 0 + + + + + Stop + True + True + True + True + True + stopImage + True + + + + 0 + 1 + + + + + Close + True + True + True + True + True + closeImage + True + + + + 1 + 1 + + + + + False + True + 2 + + + + + False + False + end + 1 + + + + + False + True + 1 + 1 + + + + + + + 640 + 525 + False + 350 + True + True + helpLabel + bottom + False + + + True + False + vertical + + + True + False + + + True + True + True + Close Demo Window + closePopupImage + True + + + + False + True + end + 0 + + + + + False + True + 0 + + + + + True + False + 0 + none + + + True + False + + + + + True + True + 1 + + + + + + + 640 + 525 + False + True + True + helpLabel + bottom + + + True + False + vertical + + + True + False + bottom + + + Main Image Viewer + True + True + True + openProgImage + True + + + + False + True + 0 + + + + + True + True + True + True + + + + False + True + 1 + + + + + False + True + 0 + + + + + True + True + in + False + + + True + False + + + True + False + gtk-missing-image + 6 + + + + + + + True + True + 1 + + + + + + + 250 + False + button1 + + + True + False + vertical + + + True + False + + + True + False + icons/folder.png + + + False + True + 0 + + + + + 330 + 26 + True + True + Set Custom Default Path + Set Custom Default Path + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + + + True + False + icons/player.png + + + False + True + 0 + + + + + 330 + 26 + True + True + Set Custom Video Player + Set Custom Video Player + + + False + True + 1 + + + + + False + True + 1 + + + + + True + False + + + True + False + icons/picture.png + + + False + True + 0 + + + + + 330 + 26 + True + True + Set Custom Image Viewer + Set Custom Image Viewer + + + False + True + 1 + + + + + False + True + 2 + + + + + Save + True + True + True + saveImag + True + + + + False + True + 3 + + + + + + diff --git a/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/icons/GWinWrap.png b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/icons/GWinWrap.png new file mode 100644 index 0000000..cdd708d Binary files /dev/null and b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/icons/GWinWrap.png differ diff --git a/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/icons/folder.png b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/icons/folder.png new file mode 100644 index 0000000..909f052 Binary files /dev/null and b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/icons/folder.png differ diff --git a/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/icons/picture.png b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/icons/picture.png new file mode 100644 index 0000000..46f1ae6 Binary files /dev/null and b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/icons/picture.png differ diff --git a/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/icons/player.png b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/icons/player.png new file mode 100644 index 0000000..4f5ebda Binary files /dev/null and b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/icons/player.png differ diff --git a/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/stylesheet.css b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/stylesheet.css new file mode 100644 index 0000000..722921b --- /dev/null +++ b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/stylesheet.css @@ -0,0 +1,3 @@ +window { + +} diff --git a/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/signal_classes/CrossClassSignals.py b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/signal_classes/CrossClassSignals.py new file mode 100644 index 0000000..751f33d --- /dev/null +++ b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/signal_classes/CrossClassSignals.py @@ -0,0 +1,397 @@ +# Gtk imports +import gi + +gi.require_version('Gtk', '3.0') +gi.require_version('Gdk', '3.0') + +from gi.repository import Gtk as gtk +from gi.repository import Gdk as gdk +from gi.repository import GLib as glib +from gi.repository import GdkPixbuf + +# Python imports +import threading, subprocess, signal, os, sys, re, hashlib, time + +from os import listdir +from os.path import isfile, join + +# Application imports +from utils import SaveStateToXWinWarp, SaveGWinWrapSettings + + + +def threaded(fn): + def wrapper(*args, **kwargs): + threading.Thread(target=fn, args=args, kwargs=kwargs).start() + + return wrapper + + +class CrossClassSignals: + def __init__(self, settings): + self.settings = settings + self.builder = self.settings.returnBuilder() + + self.WINDOW = self.builder.get_object("Main_Window").get_window() + self.stateSaver = SaveStateToXWinWarp() + self.sttngsSver = SaveGWinWrapSettings() + + # Add filter to allow only folders to be selected + dialog = self.builder.get_object("selectedDirDialog") + filefilter = self.builder.get_object("Folders") + dialog.add_filter(filefilter) + + # Get reference to remove and add it back... + self.gridLabel = self.builder.get_object("gridLabel") + + self.focusedImg = gtk.Image() + self.usrHome = os.path.expanduser('~') + self.xScreenVal = None + self.toSavePath = None # Global file path and type for saving to file + self.applyType = 1 # 1 is XWinWrap and 2 is Nitrogen + + self.loadProgress = self.builder.get_object("loadProgress") + self.helpLabel = self.builder.get_object("helpLabel") + self.defaultLabel = "Note: Double click an image to view the video or image." + self.savedLabel = "Saved settings..." + self.appliedLabel = "Running xwinwrap..." + self.stoppedLabel = "Stopped xwinwrap..." + # foreground=\"#ffa800\" + # foreground=\"#88cc27\" + # foreground=\"#ff0000\" + + # Fill list xscreensaver + self.xscrPth = "/usr/lib/xscreensaver/" + xscreenList = self.builder.get_object("XScreensaver List") + list = [f for f in listdir(self.xscrPth) if isfile(join(self.xscrPth, f))] + list.sort() + + for file in list: + xscreenList.append((file,)) + + self.selectedImg = None # EventBox holder + self.defPath = None + self.player = None + self.imgVwr = None + self.demoAreaPid = None + + self.setPosData() + self.retrieveSettings() + + + + def setNewDir(self, widget, data=None): + dir = widget.get_filename() + threading.Thread(target=self.newDir, args=(dir,)).start() + + @threaded + def newDir(self, dir): + imageGrid = self.builder.get_object("imageGrid") + dirPath = dir + list = [f for f in listdir(dirPath) if isfile(join(dirPath, f))] + files = [] + row = 0 + col = 0 + + for file in list: + if file.lower().endswith(('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv', '.mpeg', '.mp4', '.webm', '.png', '.jpg', '.jpeg', '.gif')): + files.append(file) + + fractionTick = 1.0 / 1.0 if len(files) == 0 else len(files) + tickCount = 0.0 + self.clear() + imageGrid.remove_column(0) + self.loadProgress.set_text("Loading...") + self.loadProgress.set_fraction(0.0) + self.helpLabel.set_markup("" + dirPath.strip(self.usrHome) + "") + for file in files: + fullPathFile = dirPath + "/" + file + eveBox = gtk.EventBox() + thumbnl = gtk.Image() + + if file.lower().endswith(('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv', '.mpeg', '.mp4', '.webm')): + fileHash = hashlib.sha256(str.encode(fullPathFile)).hexdigest() + hashImgpth = self.usrHome + "/.thumbnails/normal/" + fileHash + ".png" + if isfile(hashImgpth) == False: + self.generateThumbnail(fullPathFile, hashImgpth) + + thumbnl = self.createGtkImage(hashImgpth, [310, 310]) + eveBox.connect("button_press_event", self.runMplayerProcess, (fullPathFile, file, eveBox,)) + eveBox.connect("enter_notify_event", self.mouseOver, ()) + eveBox.connect("leave_notify_event", self.mouseOut, ()) + elif file.lower().endswith(('.png', '.jpg', '.jpeg', '.gif')): + thumbnl = self.createGtkImage(fullPathFile, [310, 310]) + eveBox.connect("button_press_event", self.runImageViewerProcess, (fullPathFile, file, eveBox,)) + eveBox.connect("enter_notify_event", self.mouseOver, ()) + eveBox.connect("leave_notify_event", self.mouseOut, ()) + else: + print("Not a video or image file.") + continue + + glib.idle_add(self.preGridSetup, (eveBox, thumbnl, )) + glib.idle_add(self.addToGrid, (imageGrid, eveBox, col, row,)) + tickCount = tickCount + fractionTick + self.loadProgress.set_fraction(tickCount) + + col += 1 + if col == 2: + col = 0 + row += 1 + + self.loadProgress.set_text("Finished...") + + def preGridSetup(self, args): + args[0].show() + args[1].show() + args[0].add(args[1]) + + def addToGrid(self, args): + args[0].attach(args[1], args[2], args[3], 1, 1) + + def generateThumbnail(self, fullPathFile, hashImgpth): + # Stream duration + command = ["ffprobe", "-v", "error", "-select_streams", "v:0", "-show_entries", "stream=duration", "-of", "default=noprint_wrappers=1:nokey=1", fullPathFile] + data = subprocess.run(command, stdout=subprocess.PIPE) + duration = data.stdout.decode('utf-8') + + # Format (container) duration + if "N/A" in duration: + command = ["ffprobe", "-v", "error", "-show_entries", "format=duration", "-of", "default=noprint_wrappers=1:nokey=1", fullPathFile] + data = subprocess.run(command , stdout=subprocess.PIPE) + duration = data.stdout.decode('utf-8') + + # Stream duration type: image2 + if "N/A" in duration: + command = ["ffprobe", "-v", "error", "-select_streams", "v:0", "-f", "image2", "-show_entries", "stream=duration", "-of", "default=noprint_wrappers=1:nokey=1", fullPathFile] + data = subprocess.run(command, stdout=subprocess.PIPE) + duration = data.stdout.decode('utf-8') + + # Format (container) duration type: image2 + if "N/A" in duration: + command = ["ffprobe", "-v", "error", "-f", "image2", "-show_entries", "format=duration", "-of", "default=noprint_wrappers=1:nokey=1", fullPathFile] + data = subprocess.run(command , stdout=subprocess.PIPE) + duration = data.stdout.decode('utf-8') + + # Get frame roughly 35% through video + grabTime = str( int( float( duration.split(".")[0] ) * 0.35) ) + command = ["ffmpeg", "-ss", grabTime, "-i", fullPathFile, "-an", "-vframes", "1", "-s", "320x180", "-q:v", "2", hashImgpth] + subprocess.call(command) + + def createGtkImage(self, path, wxh): + try: + pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale( + filename = path, + width = wxh[0], + height = wxh[1], + preserve_aspect_ratio = True) + return gtk.Image.new_from_pixbuf(pixbuf) + except Exception as e: + print(e) + + return gtk.Image() + + + def openMainImageViewer(self, widget): + subprocess.call([self.imgVwr, self.toSavePath]) + + def runImageViewerProcess(self, widget, eve, params): + self.setSelected(params[2]) + + if eve.type == gdk.EventType.DOUBLE_BUTTON_PRESS: + previewWindow = self.builder.get_object("previewWindow") + previewImg = self.builder.get_object("previewImg") + previewImg.set_from_file(params[0]) + previewWindow.show_all() + previewWindow.popup() + + self.toSavePath = params[0] + self.applyType = 2 + self.helpLabel.set_markup("" + params[1] + "") + + def setSelected(self, eveBox): + if self.selectedImg: + col = gdk.RGBA(0.0, 0.0, 0.0, 0.0) + self.selectedImg.override_background_color(gtk.StateType.NORMAL, col) + + col = gdk.RGBA(0.9, 0.7, 0.4, 0.74) + eveBox.override_background_color(gtk.StateType.NORMAL, col) + self.selectedImg = eveBox + + def closePopup(self, widget): + self.builder.get_object("previewWindow").popdown() + + def mouseOver(self, widget, eve, args): + hand_cursor = gdk.Cursor(gdk.CursorType.HAND2) + self.builder.get_object("Main_Window").get_window().set_cursor(hand_cursor) + + def mouseOut(self, widget, eve, args): + watch_cursor = gdk.Cursor(gdk.CursorType.LEFT_PTR) + self.builder.get_object("Main_Window").get_window().set_cursor(watch_cursor) + + def toggleXscreenUsageField(self, widget, data=None): + useXscreenSaver = self.builder.get_object("useXScrnList") + if useXscreenSaver.get_active(): + self.builder.get_object("xScreenSvrList").set_sensitive(True) + else: + self.builder.get_object("xScreenSvrList").set_sensitive(False) + + def popSttingsWindow(self, widget): + self.builder.get_object("settingsWindow").popup() + + def saveToSettingsFile(self, widget): + self.defPath = self.builder.get_object("customDefaultPath").get_text().strip() + self.player = self.builder.get_object("customVideoPlyr").get_text().strip() + self.imgVwr = self.builder.get_object("customImgVwr").get_text().strip() + + self.sttngsSver.saveSettings(self.defPath, self.player, self.imgVwr) + + def retrieveSettings(self): + data = self.sttngsSver.retrieveSettings() + self.defPath = data[0] + self.player = data[1] + self.imgVwr = data[2] + + self.builder.get_object("customDefaultPath").set_text(self.defPath) + self.builder.get_object("customVideoPlyr").set_text(self.player) + self.builder.get_object("customImgVwr").set_text(self.imgVwr) + self.builder.get_object("selectedDirDialog").set_filename(self.defPath) + + if self.defPath: + self.newDir(self.defPath) + + + def saveToFile(self, widget, data=None): + saveLoc = self.builder.get_object("saveLoc").get_active_text() + useXscreenSaver = self.builder.get_object("useXScrnList").get_active() + plyBckRes = self.builder.get_object("playbackResolution") + offset4Res = self.builder.get_object("posOffset") + resolution = plyBckRes.get_active_text() + offset4Res.get_active_text() + self.applyType = self.stateSaver.saveToFile(self.toSavePath, resolution, + saveLoc, useXscreenSaver, self.xScreenVal, self.player) + if self.applyType == -1: + self.helpLabel.set_markup("Nothing saved...") + return + + self.helpLabel.set_markup(self.savedLabel) + + def applySttngs(self, widget, data=None): + os.system("killall xwinwrap &") + if self.applyType == 1: + files = os.listdir(self.usrHome) + for file in files: + fPath = self.usrHome + "/" + file + if os.path.isfile(fPath) and "animatedBGstarter" in file: + os.system("bash -c '~/" + file + "' &") + elif self.applyType == 2: + os.system("nitrogen --restore &") + else: + os.system("nitrogen --restore &") + self.helpLabel.set_markup(self.appliedLabel) + + def killXWinWrp(self, widget, data=None): + os.system("killall xwinwrap &") + self.helpLabel.set_markup(self.stoppedLabel) + + def passXScreenVal(self, widget): + xSvrListStore = self.builder.get_object("XScreensaver List") + row = widget.get_cursor() + path = gtk.TreePath(row.path) + treeiter = xSvrListStore.get_iter(path[0]) + self.xScreenVal = xSvrListStore.get_value(treeiter, 0) + + + def runMplayerProcess(self, widget, eve, params): + self.setSelected(params[2]) + video = params[0] + + if eve.type == gdk.EventType.DOUBLE_BUTTON_PRESS: + if self.player == "mplayer": + xid = self.getXID() + command = [self.player, video, "-slave", "-wid", str(xid), "-really-quiet", "-ao", "null", "-loop", "0"] + self.runDemoToDrawArea(command) + else: + subprocess.call([self.player, video, "-really-quiet", "-ao", "null", "-loop", "0"]) + + self.toSavePath = params[0] + self.applyType = 1 + self.helpLabel.set_markup("" + params[1] + "") + + def previewXscreen(self, widget, eve): + if eve.type == gdk.EventType.DOUBLE_BUTTON_PRESS: + demoXscrnSaver = self.xscrPth + self.xScreenVal + xid = self.getXID() + command = [demoXscrnSaver, "-window-id", str(xid)] + self.runDemoToDrawArea(command) + + def getXID(self): + # Must be actualized before getting window + demoWindowPopup = self.builder.get_object("demoPreviewPopWindow") + + if demoWindowPopup.get_visible() == False: + demoWindowPopup.show_all() + demoWindowPopup.popup() + + demoPreview = self.builder.get_object("demoPreview") + drwWindow = demoPreview.get_window() + return drwWindow.get_xid() + + def runDemoToDrawArea(self, command): + self.helpLabel.set_markup("") + + if self.demoAreaPid: + os.kill(self.demoAreaPid, signal.SIGTERM) #or signal.SIGKILL + self.demoAreaPid = None + time.sleep(.800) # 800 mili-seconds to ensure first process dead + + process = subprocess.Popen(command) + self.demoAreaPid = process.pid + + def closeDemoWindow(self, widget, data=None): + os.kill(self.demoAreaPid, signal.SIGTERM) #or signal.SIGKILL + self.demoAreaPid = None + time.sleep(.200) + self.builder.get_object("demoPreviewPopWindow").popdown() + + def clearSelection(self, widget, data=None): + self.clear() + + def clear(self): + imageGrid = self.builder.get_object("imageGrid") + + while True: + if imageGrid.get_child_at(0,0)!= None: + imageGrid.remove_row(0) + else: + break + + imageGrid.attach(self.gridLabel, 0, 0, 1, 1) + self.builder.get_object("xScreenSvrList").set_sensitive(False) + self.builder.get_object("useXScrnList").set_active(False) + self.helpLabel.set_markup(self.defaultLabel) + self.loadProgress.set_text("") + self.loadProgress.set_fraction(0.0) + self.toSavePath = None + self.xScreenVal = None + self.applyType = 1 # Default to XWinWrap + + + + def setPosData(self): + monitors = self.settings.getMonitorData() + posOff = self.builder.get_object("posOffset") + + for monitor in monitors: + if monitor.x >= 0 and monitor.y >= 0: + posOff.append_text("+" + str(monitor.x) + "+" + str(monitor.y)) + elif monitor.x <= 0 and monitor.y <= 0: + posOff.append_text(str(monitor.x) + str(monitor.y)) + elif monitor.x >= 0 and monitor.y <= 0: + posOff.append_text("+" + str(monitor.x) + str(monitor.y)) + elif monitor.x <= 0 and monitor.y >= 0: + posOff.append_text(str(monitor.x) + "+" + str(monitor.y)) + + posOff.set_active(0) + + + def closeProgram(self, widget, data=None): + sys.exit(0) diff --git a/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/signal_classes/__init__.py b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/signal_classes/__init__.py new file mode 100644 index 0000000..d2d4cdf --- /dev/null +++ b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/signal_classes/__init__.py @@ -0,0 +1 @@ +from signal_classes.CrossClassSignals import CrossClassSignals diff --git a/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/SaveGWinWrapSettings.py b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/SaveGWinWrapSettings.py new file mode 100644 index 0000000..a26fbb5 --- /dev/null +++ b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/SaveGWinWrapSettings.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python + +import os, json + +class SaveGWinWrapSettings: + def __init__(self): + configFolder = os.path.expanduser('~') + "/.config/gwinwrap/" + self.configFile = configFolder + "settings.ini" + + if os.path.isdir(configFolder) == False: + os.mkdir(configFolder) + + if os.path.isfile(self.configFile) == False: + open(self.configFile, 'a').close() + + + def saveSettings(self, defPath, player, imgVwr): + data = {} + data['gwinwrap_settings'] = [] + + data['gwinwrap_settings'].append({ + 'defPath' : defPath, + 'player' : player, + 'imgvwr' : imgVwr + }) + + with open(self.configFile, 'w') as outfile: + json.dump(data, outfile) + + + def retrieveSettings(self): + returnData = [] + + with open(self.configFile) as infile: + try: + data = json.load(infile) + for obj in data['gwinwrap_settings']: + returnData = [obj['defPath'], obj['player'], obj['imgvwr']] + except Exception as e: + returnData = ['', 'mplayer', 'xdg-open'] + + + if returnData[0] == '': + returnData[0] = '' + + if returnData[1] == '': + returnData[1] = 'mplayer' + + if returnData[2] == '': + returnData[2] = 'xdg-open' + + return returnData diff --git a/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/SaveStateToXWinWarp.py b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/SaveStateToXWinWarp.py new file mode 100644 index 0000000..1e086be --- /dev/null +++ b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/SaveStateToXWinWarp.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python + +import os + +class SaveStateToXWinWarp: + def __init__(self): + self.fileWriter = None + self.toSavePath = None + self.useXSvrn = None + self.xScreenVal = None + self.sveFileLoc = None + self.resolution = None + self.player = None + + + def saveToFile(self, toSavePath, resolution, + saveLoc, useXSvrn, xScreenVal, player): + + self.toSavePath = toSavePath + self.useXSvrn = useXSvrn + self.xScreenVal = xScreenVal + self.resolution = resolution + self.player = player + userPth = os.path.expanduser('~') + + # Saves to file with selected and needed settings + if toSavePath: + if toSavePath.lower().endswith(('.png', '.jpg', '.jpeg')): + self.sveFileLoc = userPth + "/" + ".config/nitrogen/bg-saved.cfg" + else: + self.sveFileLoc = userPth + "/" + saveLoc + elif useXSvrn and xScreenVal: + self.sveFileLoc = userPth + "/" + saveLoc + else: + return -1 + + if self.sveFileLoc: + self.fileWriter = open(self.sveFileLoc, "w") + + return self.startSave() + + def startSave(self): + applyType = 1 + output = None + + # XSCREENSAVER + if self.useXSvrn: + output = "xwinwrap -ov -g " + self.resolution + " -st -sp -b -nf -s -ni -- /usr/lib/xscreensaver/" + self.xScreenVal + " -window-id WID -root"; + # GIF + elif self.toSavePath.lower().endswith(('.gif')): + output = "xwinwrap -ov -g " + self.resolution + " -st -sp -b -nf -s -ni -- gifview -a -w WID " + self.toSavePath; + # Standard images using nitrogen + elif self.toSavePath.lower().endswith(('.png', 'jpg', '.jpeg')): + output = "[xin_0] \nfile=" + self.toSavePath + "\nmode=0 \nbgcolor=#000000\n\n[xin_1] \nfile=" + self.toSavePath + "\nmode=0 \nbgcolor=#000000"; + applyType = 2; + # VIDEO + else: + output = "xwinwrap -ov -g " + self.resolution + " -st -sp -b -nf -s -ni -- " + self.player + " -wid WID -really-quiet -ao null -loop 0 '" + self.toSavePath + "'"; + pass + + try: + if self.fileWriter: + self.fileWriter.write(output) + self.fileWriter.close() + except Exception as e: + print(":: Write failed! ::") + print(e) + + return applyType; diff --git a/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/Settings.py b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/Settings.py new file mode 100644 index 0000000..1f5479f --- /dev/null +++ b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/Settings.py @@ -0,0 +1,74 @@ +# Gtk imports +import gi, cairo +gi.require_version('Gtk', '3.0') +gi.require_version('Gdk', '3.0') + +from gi.repository import Gtk as gtk +from gi.repository import Gdk as gdk + +# Python imports +import os + +# Application imports + + +class Settings: + def __init__(self): + self.builder = gtk.Builder() + self.builder.add_from_file("resources/Main_Window.glade") + + # 'Filters' + self.office = ('.doc', '.docx', '.xls', '.xlsx', '.xlt', '.xltx', '.xlm', + '.ppt', 'pptx', '.pps', '.ppsx', '.odt', '.rtf') + self.vids = ('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv', + '.mpeg', '.mp4', '.webm') + self.txt = ('.txt', '.text', '.sh', '.cfg', '.conf') + self.music = ('.psf', '.mp3', '.ogg' , '.flac') + self.images = ('.png', '.jpg', '.jpeg', '.gif') + self.pdf = ('.pdf') + + + def createWindow(self): + # Get window and connect signals + window = self.builder.get_object("Main_Window") + window.connect("delete-event", gtk.main_quit) + self.setWindowData(window) + return window + + def setWindowData(self, window): + screen = window.get_screen() + visual = screen.get_rgba_visual() + + if visual != None and screen.is_composited(): + window.set_visual(visual) + + # bind css file + cssProvider = gtk.CssProvider() + cssProvider.load_from_path('resources/stylesheet.css') + screen = gdk.Screen.get_default() + styleContext = gtk.StyleContext() + styleContext.add_provider_for_screen(screen, cssProvider, gtk.STYLE_PROVIDER_PRIORITY_USER) + + # window.set_app_paintable(True) + + def getMonitorData(self): + screen = self.builder.get_object("Main_Window").get_screen() + monitors = [] + for m in range(screen.get_n_monitors()): + monitors.append(screen.get_monitor_geometry(m)) + + for monitor in monitors: + print(str(monitor.width) + "x" + str(monitor.height) + "+" + str(monitor.x) + "+" + str(monitor.y)) + + return monitors + + + def returnBuilder(self): return self.builder + + # Filter returns + def returnOfficeFilter(self): return self.office + def returnVidsFilter(self): return self.vids + def returnTextFilter(self): return self.txt + def returnMusicFilter(self): return self.music + def returnImagesFilter(self): return self.images + def returnPdfFilter(self): return self.pdf diff --git a/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/__init__.py b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/__init__.py new file mode 100644 index 0000000..ca4b01b --- /dev/null +++ b/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/__init__.py @@ -0,0 +1,3 @@ +from utils.Settings import Settings +from utils.SaveStateToXWinWarp import SaveStateToXWinWarp +from utils.SaveGWinWrapSettings import SaveGWinWrapSettings diff --git a/src/debs/gwinwrap-0-0-1-x64/usr/share/doc/gwinwrap/copyright b/src/debs/gwinwrap-0-0-1-x64/usr/share/doc/gwinwrap/copyright new file mode 100644 index 0000000..53b78e8 --- /dev/null +++ b/src/debs/gwinwrap-0-0-1-x64/usr/share/doc/gwinwrap/copyright @@ -0,0 +1,22 @@ +GWinWrap is copyright 2016, 2017 Maxim Stewart. +GWinWrap is currently developed by ITDominator <1itdominator@gmail.com>. + +License: GPLv2+ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +See /usr/share/common-licenses/GPL-2, or + for the terms of the latest version +of the GNU General Public License.