diff --git a/python/README.md b/python/README.md
index 3f44873..113a87d 100644
--- a/python/README.md
+++ b/python/README.md
@@ -1,15 +1,17 @@
# GWinWrap
-GWinWrap is a Gtk with Python gui to select videos for XWinWrap, images for Nitrogen Wallpaper Manager, and gifs for Gifsicle.
+GWinWrap is a Gtk wpic2ith Python gui to select videos for XWinWrap, images for Nitrogen Wallpaper Manager, and gifs for Gifsicle.
It includes the XWinWrap binary and source code for Shantanu Goel's version of XWinWrap.
# Notes
Need python 2+
# Images
-![Default view starting out](images/pic1.png)
-![Video thumbnails in image grid. Path to directory highlighted purple](images/pic2.png)
-![Image thumbnails in image grid with xscreensaver checked](images/pic3.png)
-![Image in preview popup](images/pic4.png)
+![1 Default view starting out. ](images/pic1.png)
+![2 Video thumbnails in image grid. Path to directory highlighted purple. ](images/pic2.png)
+![3 Image thumbnails in image grid. ](images/pic3.png)
+![4 Image in preview popup. ](images/pic4.png)
+![5 Xscreensaver preview running. ](images/pic5.png)
+![6 Settings window poped open. ](images/pic6.png)
# TODO
Nothing...
diff --git a/python/bin/gwinwrap-0-0-1-x64.deb b/python/bin/gwinwrap-0-0-1-x64.deb
index 1c6ad69..8b4f22d 100644
Binary files a/python/bin/gwinwrap-0-0-1-x64.deb and b/python/bin/gwinwrap-0-0-1-x64.deb differ
diff --git a/python/images/pic1.png b/python/images/pic1.png
index 6696f66..ec03cb2 100644
Binary files a/python/images/pic1.png and b/python/images/pic1.png differ
diff --git a/python/images/pic2.png b/python/images/pic2.png
index 3634780..aa2823d 100644
Binary files a/python/images/pic2.png and b/python/images/pic2.png differ
diff --git a/python/images/pic3.png b/python/images/pic3.png
index 3de52c6..4c94283 100644
Binary files a/python/images/pic3.png and b/python/images/pic3.png differ
diff --git a/python/images/pic4.png b/python/images/pic4.png
index 2d31365..caf0b9e 100644
Binary files a/python/images/pic4.png and b/python/images/pic4.png differ
diff --git a/python/images/pic5.png b/python/images/pic5.png
new file mode 100644
index 0000000..a698a49
Binary files /dev/null and b/python/images/pic5.png differ
diff --git a/python/images/pic6.png b/python/images/pic6.png
new file mode 100644
index 0000000..029a798
Binary files /dev/null and b/python/images/pic6.png differ
diff --git a/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/GWinWrap.py b/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/GWinWrap.py
old mode 100755
new mode 100644
index 0fa48cb..0f3167d
--- a/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/GWinWrap.py
+++ b/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/GWinWrap.py
@@ -1,20 +1,17 @@
#!/usr/bin/env python
-import os, cairo, sys, gi, re, threading, subprocess
+import os, cairo, sys, gi, re, threading, subprocess, hashlib
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 GObject as gobject
-from gi.repository import GdkPixbuf
+from gi.repository import Gtk as gtk, Gdk as gdk, GObject as gobject, GdkPixbuf
from os import listdir
from os.path import isfile, join
from threading import Thread
-from utils import SaveState
+from utils import SaveStateToXWinWarp, SaveGWinWrapSettings
gdk.threads_init()
@@ -36,6 +33,13 @@ class GWinWrap:
self.window.set_app_paintable(True)
self.window.connect("draw", self.area_draw)
+ # 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)
+
# Add filter to allow only folders to be selected
dialog = self.builder.get_object("selectedDirDialog")
filefilter = self.builder.get_object("Folders")
@@ -44,7 +48,9 @@ class GWinWrap:
# Get reference to remove and add it back...
self.gridLabel = self.builder.get_object("gridLabel")
- self.stateSaver = SaveState()
+ self.stateSaver = SaveStateToXWinWarp()
+ self.sttngsSver = SaveGWinWrapSettings()
+
self.focusedImg = gtk.Image()
self.usrHome = os.path.expanduser('~')
self.xScreenVal = None
@@ -70,6 +76,11 @@ class GWinWrap:
for file in list:
xscreenList.append((file,))
+ self.selectedImg = None # EventBox holder
+ self.player = None
+ self.imgVwr = None
+ self.retrieveSettings()
+
self.window.show()
def area_draw(self, widget, cr):
@@ -86,19 +97,18 @@ class GWinWrap:
Thread(target=self.newDir, args=(dir,)).start()
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
+ 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 / len(files)
+ fractionTick = 1.0 / 1.0 if len(files) == 0 else len(files)
tickCount = 0.0
self.clear()
imageGrid.remove_column(0)
@@ -111,16 +121,20 @@ class GWinWrap:
thumbnl = gtk.Image()
if file.lower().endswith(('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv', '.mpeg', '.mp4', '.webm')):
- self.generateThumbnail(fullPathFile)
- thumbnl = self.createGtkImage("/tmp/image.png", [310, 310])
- eveBox.connect("button_press_event", self.runMplayerProcess, (fullPathFile, file,))
- eveBox.connect("enter_notify_event", self.mouseOver, (fullPathFile, file))
- eveBox.connect("leave_notify_event", self.mouseOut, (fullPathFile, file))
+ fileHash = hashlib.sha256(str.encode(fullPathFile)).hexdigest()
+ hashImgpth = self.usrHome + "/.thumbnails/normal/" + fileHash + ".png"
+ if os.path.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.connect("enter_notify_event", self.mouseOver, (fullPathFile, file))
- eveBox.connect("leave_notify_event", self.mouseOut, (fullPathFile, file))
+ 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.")
return
@@ -145,8 +159,8 @@ class GWinWrap:
def addToGrid(self, args):
args[0].attach(args[1], args[2], args[3], 1, 1)
- def generateThumbnail(self, fullPathFile):
- subprocess.call(["ffmpegthumbnailer", "-t", "65%", "-s", "300", "-c", "jpg", "-i", fullPathFile, "-o", "/tmp/image.png"])
+ def generateThumbnail(self, fullPathFile, hashImgpth):
+ subprocess.call(["ffmpegthumbnailer", "-t", "65%", "-s", "300", "-c", "jpg", "-i", fullPathFile, "-o", hashImgpth])
def createGtkImage(self, path, wxh):
try:
@@ -158,17 +172,26 @@ class GWinWrap:
return gtk.Image.new_from_pixbuf(pixbuf)
except Exception as e:
print(e)
+
return gtk.Image()
def runMplayerProcess(self, widget, eve, params):
+ self.setSelected(params[2])
+ video = params[0] #.replace(" ", "\\ ")
+
if eve.type == gdk.EventType.DOUBLE_BUTTON_PRESS:
- subprocess.call(["mplayer", "-really-quiet", "-ao", "null", "-loop", "0", params[0]])
+ 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 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")
@@ -180,22 +203,25 @@ class GWinWrap:
self.applyType = 2
self.helpLabel.set_markup("" + params[1] + "")
- def openMainImageViewer(self, widget):
- subprocess.call(["xdg-open", self.toSavePath])
+ 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):
- previewWindow = self.builder.get_object("previewWindow")
- previewWindow.popdown()
+ self.builder.get_object("previewWindow").popdown()
def mouseOver(self, widget, eve, args):
- pass
- # hand_cursor = gdk.Cursor(gdk.CursorType.GDK_HAND2)
- # self.window.get_window().set_cursor(hand_cursor)
+ hand_cursor = gdk.Cursor(gdk.CursorType.HAND2)
+ self.window.get_window().set_cursor(hand_cursor)
def mouseOut(self, widget, eve, args):
- pass
- # watch_cursor = gdk.Cursor(gdk.CursorType.GDK_LEFT_PTR)
- # self.window.get_window().set_cursor(watch_cursor)
+ watch_cursor = gdk.Cursor(gdk.CursorType.LEFT_PTR)
+ self.window.get_window().set_cursor(watch_cursor)
def toggleXscreenUsageField(self, widget, data=None):
useXscreenSaver = self.builder.get_object("useXScrnList")
@@ -204,6 +230,21 @@ class GWinWrap:
else:
self.builder.get_object("xScreenSvrList").set_sensitive(False)
+ def popSttingsWindow(self, widget):
+ self.builder.get_object("settingsWindow").popup()
+
+ def saveToSettingsFile(self, widget):
+ self.player = self.builder.get_object("customVideoPlyr").get_text().strip()
+ self.imgVwr = self.builder.get_object("customImgVwr").get_text().strip()
+ self.sttngsSver.saveSettings(self.player, self.imgVwr)
+
+ def retrieveSettings(self):
+ data = self.sttngsSver.retrieveSettings()
+ self.player = data[0]
+ self.imgVwr = data[1]
+ self.builder.get_object("customVideoPlyr").set_text(self.player)
+ self.builder.get_object("customImgVwr").set_text(self.imgVwr)
+
def saveToFile(self, widget, data=None):
saveLoc = self.builder.get_object("saveLoc").get_active_text()
useXscreenSaver = self.builder.get_object("useXScrnList").get_active()
diff --git a/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/GWinWrap.glade b/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/GWinWrap.glade
index 8654681..9efcfda 100644
--- a/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/GWinWrap.glade
+++ b/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/GWinWrap.glade
@@ -37,12 +37,25 @@
gtk-jump-to
3
+
+
@@ -487,7 +515,7 @@
- Start
+ (Re)Start
True
True
True
@@ -633,6 +661,7 @@
True
False
gtk-missing-image
+ 6
@@ -647,4 +676,108 @@
+
+ 250
+ False
+ button1
+
+
+ True
+ False
+ vertical
+
+
+ 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
+ 0
+
+
+
+
+ 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
+ 1
+
+
+
+
+ Save
+ True
+ True
+ True
+ saveImag
+ True
+
+
+
+ False
+ True
+ 2
+
+
+
+
+
diff --git a/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/GWinWrap.png b/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/icons/GWinWrap.png
similarity index 100%
rename from python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/GWinWrap.png
rename to python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/icons/GWinWrap.png
diff --git a/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/icons/picture.png b/python/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/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/icons/picture.png differ
diff --git a/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/icons/player.png b/python/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/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/icons/player.png differ
diff --git a/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/stylesheet.css b/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/stylesheet.css
new file mode 100644
index 0000000..b1a267d
--- /dev/null
+++ b/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/resources/stylesheet.css
@@ -0,0 +1,3 @@
+window {
+
+}
\ No newline at end of file
diff --git a/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/SaveGWinWrapSettings.py b/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/SaveGWinWrapSettings.py
new file mode 100644
index 0000000..eecc8b9
--- /dev/null
+++ b/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/SaveGWinWrapSettings.py
@@ -0,0 +1,48 @@
+#!/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, player, imgVwr):
+ data = {}
+ data['gwinwrap_settings'] = []
+
+ data['gwinwrap_settings'].append({
+ '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['player'], obj['imgvwr']]
+ except Exception as e:
+ returnData = ['mplayer', 'xdg-open']
+
+ if returnData[0] == '':
+ returnData[0] = 'mplayer'
+
+ if returnData[1] == '':
+ returnData[1] = 'xdg-open'
+
+ return returnData
diff --git a/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/SaveState.py b/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/SaveStateToXWinWarp.py
similarity index 98%
rename from python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/SaveState.py
rename to python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/SaveStateToXWinWarp.py
index 6187fde..6bebc5f 100644
--- a/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/SaveState.py
+++ b/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/SaveStateToXWinWarp.py
@@ -2,7 +2,7 @@
import os
-class SaveState:
+class SaveStateToXWinWarp:
def __init__(self):
self.fileWriter = None
self.toSavePath = None
diff --git a/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/__init__.py b/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/__init__.py
index e0242e1..579b043 100644
--- a/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/__init__.py
+++ b/python/src/debs/gwinwrap-0-0-1-x64/opt/GWinWrap/utils/__init__.py
@@ -1 +1,2 @@
-from utils.SaveState import SaveState
+from utils.SaveStateToXWinWarp import SaveStateToXWinWarp
+from utils.SaveGWinWrapSettings import SaveGWinWrapSettings\
diff --git a/python/src/versions/0.0.1/GWinWrap/GWinWrap.py b/python/src/versions/0.0.1/GWinWrap/GWinWrap.py
old mode 100755
new mode 100644
index 0fa48cb..0f3167d
--- a/python/src/versions/0.0.1/GWinWrap/GWinWrap.py
+++ b/python/src/versions/0.0.1/GWinWrap/GWinWrap.py
@@ -1,20 +1,17 @@
#!/usr/bin/env python
-import os, cairo, sys, gi, re, threading, subprocess
+import os, cairo, sys, gi, re, threading, subprocess, hashlib
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 GObject as gobject
-from gi.repository import GdkPixbuf
+from gi.repository import Gtk as gtk, Gdk as gdk, GObject as gobject, GdkPixbuf
from os import listdir
from os.path import isfile, join
from threading import Thread
-from utils import SaveState
+from utils import SaveStateToXWinWarp, SaveGWinWrapSettings
gdk.threads_init()
@@ -36,6 +33,13 @@ class GWinWrap:
self.window.set_app_paintable(True)
self.window.connect("draw", self.area_draw)
+ # 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)
+
# Add filter to allow only folders to be selected
dialog = self.builder.get_object("selectedDirDialog")
filefilter = self.builder.get_object("Folders")
@@ -44,7 +48,9 @@ class GWinWrap:
# Get reference to remove and add it back...
self.gridLabel = self.builder.get_object("gridLabel")
- self.stateSaver = SaveState()
+ self.stateSaver = SaveStateToXWinWarp()
+ self.sttngsSver = SaveGWinWrapSettings()
+
self.focusedImg = gtk.Image()
self.usrHome = os.path.expanduser('~')
self.xScreenVal = None
@@ -70,6 +76,11 @@ class GWinWrap:
for file in list:
xscreenList.append((file,))
+ self.selectedImg = None # EventBox holder
+ self.player = None
+ self.imgVwr = None
+ self.retrieveSettings()
+
self.window.show()
def area_draw(self, widget, cr):
@@ -86,19 +97,18 @@ class GWinWrap:
Thread(target=self.newDir, args=(dir,)).start()
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
+ 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 / len(files)
+ fractionTick = 1.0 / 1.0 if len(files) == 0 else len(files)
tickCount = 0.0
self.clear()
imageGrid.remove_column(0)
@@ -111,16 +121,20 @@ class GWinWrap:
thumbnl = gtk.Image()
if file.lower().endswith(('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv', '.mpeg', '.mp4', '.webm')):
- self.generateThumbnail(fullPathFile)
- thumbnl = self.createGtkImage("/tmp/image.png", [310, 310])
- eveBox.connect("button_press_event", self.runMplayerProcess, (fullPathFile, file,))
- eveBox.connect("enter_notify_event", self.mouseOver, (fullPathFile, file))
- eveBox.connect("leave_notify_event", self.mouseOut, (fullPathFile, file))
+ fileHash = hashlib.sha256(str.encode(fullPathFile)).hexdigest()
+ hashImgpth = self.usrHome + "/.thumbnails/normal/" + fileHash + ".png"
+ if os.path.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.connect("enter_notify_event", self.mouseOver, (fullPathFile, file))
- eveBox.connect("leave_notify_event", self.mouseOut, (fullPathFile, file))
+ 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.")
return
@@ -145,8 +159,8 @@ class GWinWrap:
def addToGrid(self, args):
args[0].attach(args[1], args[2], args[3], 1, 1)
- def generateThumbnail(self, fullPathFile):
- subprocess.call(["ffmpegthumbnailer", "-t", "65%", "-s", "300", "-c", "jpg", "-i", fullPathFile, "-o", "/tmp/image.png"])
+ def generateThumbnail(self, fullPathFile, hashImgpth):
+ subprocess.call(["ffmpegthumbnailer", "-t", "65%", "-s", "300", "-c", "jpg", "-i", fullPathFile, "-o", hashImgpth])
def createGtkImage(self, path, wxh):
try:
@@ -158,17 +172,26 @@ class GWinWrap:
return gtk.Image.new_from_pixbuf(pixbuf)
except Exception as e:
print(e)
+
return gtk.Image()
def runMplayerProcess(self, widget, eve, params):
+ self.setSelected(params[2])
+ video = params[0] #.replace(" ", "\\ ")
+
if eve.type == gdk.EventType.DOUBLE_BUTTON_PRESS:
- subprocess.call(["mplayer", "-really-quiet", "-ao", "null", "-loop", "0", params[0]])
+ 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 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")
@@ -180,22 +203,25 @@ class GWinWrap:
self.applyType = 2
self.helpLabel.set_markup("" + params[1] + "")
- def openMainImageViewer(self, widget):
- subprocess.call(["xdg-open", self.toSavePath])
+ 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):
- previewWindow = self.builder.get_object("previewWindow")
- previewWindow.popdown()
+ self.builder.get_object("previewWindow").popdown()
def mouseOver(self, widget, eve, args):
- pass
- # hand_cursor = gdk.Cursor(gdk.CursorType.GDK_HAND2)
- # self.window.get_window().set_cursor(hand_cursor)
+ hand_cursor = gdk.Cursor(gdk.CursorType.HAND2)
+ self.window.get_window().set_cursor(hand_cursor)
def mouseOut(self, widget, eve, args):
- pass
- # watch_cursor = gdk.Cursor(gdk.CursorType.GDK_LEFT_PTR)
- # self.window.get_window().set_cursor(watch_cursor)
+ watch_cursor = gdk.Cursor(gdk.CursorType.LEFT_PTR)
+ self.window.get_window().set_cursor(watch_cursor)
def toggleXscreenUsageField(self, widget, data=None):
useXscreenSaver = self.builder.get_object("useXScrnList")
@@ -204,6 +230,21 @@ class GWinWrap:
else:
self.builder.get_object("xScreenSvrList").set_sensitive(False)
+ def popSttingsWindow(self, widget):
+ self.builder.get_object("settingsWindow").popup()
+
+ def saveToSettingsFile(self, widget):
+ self.player = self.builder.get_object("customVideoPlyr").get_text().strip()
+ self.imgVwr = self.builder.get_object("customImgVwr").get_text().strip()
+ self.sttngsSver.saveSettings(self.player, self.imgVwr)
+
+ def retrieveSettings(self):
+ data = self.sttngsSver.retrieveSettings()
+ self.player = data[0]
+ self.imgVwr = data[1]
+ self.builder.get_object("customVideoPlyr").set_text(self.player)
+ self.builder.get_object("customImgVwr").set_text(self.imgVwr)
+
def saveToFile(self, widget, data=None):
saveLoc = self.builder.get_object("saveLoc").get_active_text()
useXscreenSaver = self.builder.get_object("useXScrnList").get_active()
diff --git a/python/src/versions/0.0.1/GWinWrap/resources/GWinWrap.glade b/python/src/versions/0.0.1/GWinWrap/resources/GWinWrap.glade
index 8654681..9efcfda 100644
--- a/python/src/versions/0.0.1/GWinWrap/resources/GWinWrap.glade
+++ b/python/src/versions/0.0.1/GWinWrap/resources/GWinWrap.glade
@@ -37,12 +37,25 @@
gtk-jump-to
3
+
+ True
+ False
+ gtk-save
+ 3
+
True
False
gtk-save
3
+
+ True
+ False
+ Settings....
+ gtk-properties
+ 3
+
True
False
@@ -63,7 +76,7 @@
center
950
600
- GWinWrap.png
+ icons/GWinWrap.png
center
@@ -98,22 +111,6 @@
0
-
-
- Clear
- True
- True
- True
- clearImage
- True
-
-
-
- False
- True
- 1
-
-
True
@@ -127,6 +124,21 @@
Dream Scene / Image Dir
+
+ False
+ True
+ 1
+
+
+
+
+ True
+ True
+ True
+ settingsImage
+ True
+
+
False
True
@@ -140,6 +152,18 @@
0
+
+
+ True
+ False
+ True
+
+
+ False
+ True
+ 1
+
+
True
@@ -182,19 +206,23 @@
True
True
- 1
+ 2
-
+
+ Clear
True
- False
- True
+ True
+ True
+ clearImage
+ True
+
False
True
- 2
+ 3
@@ -487,7 +515,7 @@
- Start
+ (Re)Start
True
True
True
@@ -633,6 +661,7 @@
True
False
gtk-missing-image
+ 6
@@ -647,4 +676,108 @@
+
+ 250
+ False
+ button1
+
+
+ True
+ False
+ vertical
+
+
+ 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
+ 0
+
+
+
+
+ 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
+ 1
+
+
+
+
+ Save
+ True
+ True
+ True
+ saveImag
+ True
+
+
+
+ False
+ True
+ 2
+
+
+
+
+
diff --git a/python/src/versions/0.0.1/GWinWrap/resources/GWinWrap.png b/python/src/versions/0.0.1/GWinWrap/resources/icons/GWinWrap.png
similarity index 100%
rename from python/src/versions/0.0.1/GWinWrap/resources/GWinWrap.png
rename to python/src/versions/0.0.1/GWinWrap/resources/icons/GWinWrap.png
diff --git a/python/src/versions/0.0.1/GWinWrap/resources/icons/picture.png b/python/src/versions/0.0.1/GWinWrap/resources/icons/picture.png
new file mode 100644
index 0000000..46f1ae6
Binary files /dev/null and b/python/src/versions/0.0.1/GWinWrap/resources/icons/picture.png differ
diff --git a/python/src/versions/0.0.1/GWinWrap/resources/icons/player.png b/python/src/versions/0.0.1/GWinWrap/resources/icons/player.png
new file mode 100644
index 0000000..4f5ebda
Binary files /dev/null and b/python/src/versions/0.0.1/GWinWrap/resources/icons/player.png differ
diff --git a/python/src/versions/0.0.1/GWinWrap/resources/stylesheet.css b/python/src/versions/0.0.1/GWinWrap/resources/stylesheet.css
new file mode 100644
index 0000000..b1a267d
--- /dev/null
+++ b/python/src/versions/0.0.1/GWinWrap/resources/stylesheet.css
@@ -0,0 +1,3 @@
+window {
+
+}
\ No newline at end of file
diff --git a/python/src/versions/0.0.1/GWinWrap/utils/SaveGWinWrapSettings.py b/python/src/versions/0.0.1/GWinWrap/utils/SaveGWinWrapSettings.py
new file mode 100644
index 0000000..eecc8b9
--- /dev/null
+++ b/python/src/versions/0.0.1/GWinWrap/utils/SaveGWinWrapSettings.py
@@ -0,0 +1,48 @@
+#!/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, player, imgVwr):
+ data = {}
+ data['gwinwrap_settings'] = []
+
+ data['gwinwrap_settings'].append({
+ '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['player'], obj['imgvwr']]
+ except Exception as e:
+ returnData = ['mplayer', 'xdg-open']
+
+ if returnData[0] == '':
+ returnData[0] = 'mplayer'
+
+ if returnData[1] == '':
+ returnData[1] = 'xdg-open'
+
+ return returnData
diff --git a/python/src/versions/0.0.1/GWinWrap/utils/SaveState.py b/python/src/versions/0.0.1/GWinWrap/utils/SaveStateToXWinWarp.py
similarity index 98%
rename from python/src/versions/0.0.1/GWinWrap/utils/SaveState.py
rename to python/src/versions/0.0.1/GWinWrap/utils/SaveStateToXWinWarp.py
index 6187fde..6bebc5f 100644
--- a/python/src/versions/0.0.1/GWinWrap/utils/SaveState.py
+++ b/python/src/versions/0.0.1/GWinWrap/utils/SaveStateToXWinWarp.py
@@ -2,7 +2,7 @@
import os
-class SaveState:
+class SaveStateToXWinWarp:
def __init__(self):
self.fileWriter = None
self.toSavePath = None
diff --git a/python/src/versions/0.0.1/GWinWrap/utils/__init__.py b/python/src/versions/0.0.1/GWinWrap/utils/__init__.py
index e0242e1..579b043 100644
--- a/python/src/versions/0.0.1/GWinWrap/utils/__init__.py
+++ b/python/src/versions/0.0.1/GWinWrap/utils/__init__.py
@@ -1 +1,2 @@
-from utils.SaveState import SaveState
+from utils.SaveStateToXWinWarp import SaveStateToXWinWarp
+from utils.SaveGWinWrapSettings import SaveGWinWrapSettings\