Added fix for deb file making

This commit is contained in:
Maxim Stewart 2019-05-05 22:25:06 -05:00
parent f14a5643a4
commit e99168e589
10 changed files with 144 additions and 36 deletions

Binary file not shown.

View File

@ -10,7 +10,7 @@ function main() {
sudo chmod 755 "${i}" sudo chmod 755 "${i}"
done done
# Set fxwinwrap permissions # Set gwinwrap permissions
for i in `find . -name gwinwrap`; do for i in `find . -name gwinwrap`; do
sudo chmod 755 "${i}" sudo chmod 755 "${i}"
done done
@ -20,8 +20,6 @@ function main() {
sudo chmod 755 "${i}" sudo chmod 755 "${i}"
done done
sudo chmod 755 gwinwrap*/opt/GWinWrap/resources/bin/*
sudo chown -R root:root ./*/ sudo chown -R root:root ./*/
builder; builder;
} }

View File

@ -46,10 +46,23 @@ class GWinWrap:
self.gridLabel = self.builder.get_object("gridLabel") self.gridLabel = self.builder.get_object("gridLabel")
self.stateSaver = SaveState() self.stateSaver = SaveState()
self.focusedImg = gtk.Image()
self.usrHome = os.path.expanduser('~')
self.xScreenVal = None self.xScreenVal = None
self.toSavePath = None # Global file path and type for saving to file self.toSavePath = None # Global file path and type for saving to file
self.applyType = 1 # 1 is XWinWrap and 2 is Nitrogen 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 = "<span>Note: Double click an image to view the video or image.</span>"
self.savedLabel = "<span foreground=\"#88cc27\">Saved settings...</span>"
self.appliedLabel = "<span foreground=\"#88cc27\">Running xwinwrap...</span>"
self.stoppedLabel = "<span foreground=\"#88cc27\">Stopped xwinwrap...</span>"
# foreground=\"#ffa800\"
# foreground=\"#88cc27\"
# foreground=\"#ff0000\"
# foreground=\"#ff0000\"
self.window.show() self.window.show()
def area_draw(self, widget, cr): def area_draw(self, widget, cr):
@ -66,11 +79,10 @@ class GWinWrap:
Thread(target=self.newDir, args=(dir,)).start() Thread(target=self.newDir, args=(dir,)).start()
def newDir(self, dir): def newDir(self, dir):
self.clear()
imageGrid = self.builder.get_object("imageGrid") imageGrid = self.builder.get_object("imageGrid")
path = dir dirPath = dir
list = [f for f in listdir(dirPath) if isfile(join(dirPath, f))]
files = [] files = []
list = [f for f in listdir(path) if isfile(join(path, f))]
row = 0 row = 0
col = 0 col = 0
@ -78,60 +90,80 @@ class GWinWrap:
if file.lower().endswith(('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv', '.mpeg', '.mp4', '.webm', '.png', '.jpg', '.jpeg', '.gif')): if file.lower().endswith(('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv', '.mpeg', '.mp4', '.webm', '.png', '.jpg', '.jpeg', '.gif')):
files.append(file) files.append(file)
fractionTick = 1.0 / len(files)
tickCount = 0.0
self.clear()
imageGrid.remove_column(0) imageGrid.remove_column(0)
self.loadProgress.set_text("Loading...")
self.loadProgress.set_fraction(0.0)
self.helpLabel.set_markup("<span foreground=\"#b30ec2\">" + dirPath.strip(self.usrHome) + "</span>")
for file in files: for file in files:
fullPathFile = path + "/" + file fullPathFile = dirPath + "/" + file
eveBox = gtk.EventBox() eveBox = gtk.EventBox()
thumbnl = gtk.Image() thumbnl = gtk.Image()
if file.lower().endswith(('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv', '.mpeg', '.mp4', '.webm')): if file.lower().endswith(('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv', '.mpeg', '.mp4', '.webm')):
subprocess.call(["ffmpegthumbnailer", "-t", "65%", "-s", "300", "-c", "jpg", "-i", fullPathFile, "-o", "/tmp/image.png"]) self.generateThumbnail(fullPathFile)
thumbnl = self.createImage("/tmp/image.png") thumbnl = self.createGtkImage("/tmp/image.png", [310, 310])
eveBox.connect("button_press_event", self.runMplayerProcess, fullPathFile) eveBox.connect("button_press_event", self.runMplayerProcess, (fullPathFile, file,))
elif file.lower().endswith(('.png', '.jpg', '.jpeg', '.gif')): elif file.lower().endswith(('.png', '.jpg', '.jpeg', '.gif')):
thumbnl = self.createImage(fullPathFile) thumbnl = self.createGtkImage(fullPathFile, [310, 310])
eveBox.connect("button_press_event", self.runImageViewerProcess, fullPathFile) eveBox.connect("button_press_event", self.runImageViewerProcess, (fullPathFile, file))
else: else:
print("Not a video or image file.") print("Not a video or image file.")
return return
gobject.idle_add(self.preGridSetup, (eveBox, thumbnl, )) gobject.idle_add(self.preGridSetup, (eveBox, thumbnl, ))
gobject.idle_add(self.addToGrid, (imageGrid, eveBox, col, row,)) gobject.idle_add(self.addToGrid, (imageGrid, eveBox, col, row,))
tickCount = tickCount + fractionTick
self.loadProgress.set_fraction(tickCount)
col += 1 col += 1
if col == 2: if col == 2:
col = 0 col = 0
row += 1 row += 1
self.loadProgress.set_text("Finished...")
def preGridSetup(self, args): def preGridSetup(self, args):
args[0].show() args[0].show()
args[1].show() args[1].show()
args[0].add(args[1]) args[0].add(args[1])
def createImage(self, arg):
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
filename = arg,
width = 310,
height = 310,
preserve_aspect_ratio = True)
return gtk.Image.new_from_pixbuf(pixbuf)
def addToGrid(self, args): def addToGrid(self, args):
args[0].attach(args[1], args[2], args[3], 1, 1) args[0].attach(args[1], args[2], args[3], 1, 1)
def runMplayerProcess(self, widget, eve, fullPathFile): def generateThumbnail(self, fullPathFile):
subprocess.call(["ffmpegthumbnailer", "-t", "65%", "-s", "300", "-c", "jpg", "-i", fullPathFile, "-o", "/tmp/image.png"])
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 runMplayerProcess(self, widget, eve, params):
if eve.type == gdk.EventType.DOUBLE_BUTTON_PRESS: if eve.type == gdk.EventType.DOUBLE_BUTTON_PRESS:
subprocess.call(["mplayer", "-really-quiet", "-ao", "null", "-loop", "0", fullPathFile]) subprocess.call(["mplayer", "-really-quiet", "-ao", "null", "-loop", "0", params[0]])
self.toSavePath = fullPathFile self.toSavePath = params[0]
self.applyType = 1 # Set to XWinWrap self.applyType = 1
self.helpLabel.set_markup("<span foreground=\"#e0cc64\">" + params[1] + "</span>")
def runImageViewerProcess(self, widget, eve, fullPathFile): def runImageViewerProcess(self, widget, eve, params):
if eve.type == gdk.EventType.DOUBLE_BUTTON_PRESS: if eve.type == gdk.EventType.DOUBLE_BUTTON_PRESS:
subprocess.call(["xdg-open", fullPathFile]) subprocess.call(["xdg-open", params[0]])
self.toSavePath = fullPathFile self.toSavePath = params[0]
self.applyType = 2 # Set to Nitrogen self.applyType = 2
self.helpLabel.set_markup("<span foreground=\"#e0cc64\">" + params[1] + "</span>")
def toggleXscreenUsageField(self, widget, data=None): def toggleXscreenUsageField(self, widget, data=None):
useXscreenSaver = self.builder.get_object("useXScrnList") useXscreenSaver = self.builder.get_object("useXScrnList")
@ -148,6 +180,7 @@ class GWinWrap:
resolution = plyBckRes.get_active_text() + offset4Res.get_active_text() resolution = plyBckRes.get_active_text() + offset4Res.get_active_text()
self.applyType = self.stateSaver.saveToFile(self.toSavePath, resolution, self.applyType = self.stateSaver.saveToFile(self.toSavePath, resolution,
saveLoc, useXscreenSaver, self.xScreenVal) saveLoc, useXscreenSaver, self.xScreenVal)
self.helpLabel.set_markup(self.savedLabel)
def applySttngs(self, widget, data=None): def applySttngs(self, widget, data=None):
os.system("killall xwinwrap &") os.system("killall xwinwrap &")
@ -158,10 +191,11 @@ class GWinWrap:
os.system("nitrogen --restore &") os.system("nitrogen --restore &")
else: else:
os.system("nitrogen --restore &") os.system("nitrogen --restore &")
self.helpLabel.set_markup(self.appliedLabel)
def killXWinWrp(self, widget, data=None): def killXWinWrp(self, widget, data=None):
os.system("killall xwinwrap &") os.system("killall xwinwrap &")
self.helpLabel.set_markup(self.stoppedLabel)
def passXScreenVal(self, widget): def passXScreenVal(self, widget):
xSvrListStore = self.builder.get_object("XScreensaver List") xSvrListStore = self.builder.get_object("XScreensaver List")
@ -183,6 +217,9 @@ class GWinWrap:
break break
imageGrid.attach(self.gridLabel, 0, 0, 1, 1) imageGrid.attach(self.gridLabel, 0, 0, 1, 1)
self.helpLabel.set_markup(self.defaultLabel)
self.loadProgress.set_text("")
self.loadProgress.set_fraction(0.0)
self.toSavePath = None self.toSavePath = None
self.applyType = 1 # Default to XWinWrap self.applyType = 1 # Default to XWinWrap

View File

@ -244,9 +244,10 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="margin_bottom">5</property> <property name="margin_bottom">5</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="helpLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="margin_right">15</property>
<property name="label" translatable="yes">Note: Double click an image to view the video or image.</property> <property name="label" translatable="yes">Note: Double click an image to view the video or image.</property>
</object> </object>
<packing> <packing>
@ -340,6 +341,18 @@
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkProgressBar" id="loadProgress">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="show_text">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>

View File

@ -0,0 +1,59 @@
#!/usr/bin/env python
import os
class SaveState:
def __init__(self):
self.fileWriter = None
self.filePath = None
self.useXSvrn = None
self.xScreenVal = None
self.sveFileLoc = None
self.resolution = None
def saveToFile(self, filePath, resolution,
saveLoc, useXSvrn, xScreenVal):
self.filePath = filePath
self.useXSvrn = useXSvrn
self.xScreenVal = xScreenVal
self.resolution = resolution
userPth = os.path.expanduser('~')
# Saves to file with selected and needed settings
if filePath:
if filePath.lower().endswith(('.png', '.jpg', '.jpeg', '.gif')):
self.sveFileLoc = userPth + "/" + ".config/nitrogen/bg-saved.cfg"
else:
self.sveFileLoc = userPth + "/" + saveLoc
else:
self.filePath = ''
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.filePath.lower().endswith(('.gif')):
output = "xwinwrap -ov -g " + self.resolution + " -st -sp -b -nf -s -ni -- gifview -a -w WID " + self.filePath;
# Standard images using nitrogen
elif self.filePath.lower().endswith(('.png', 'jpg', '.jpeg')):
output = "[xin_0] \n file=" + self.filePath + "\nmode=0 \nbgcolor=#000000\n[xin_1] \nfile=" + self.filePath + "\nmode=0 \nbgcolor=#000000";
applyType = 2;
# VIDEO
else:
output = "xwinwrap -ov -g " + self.resolution + " -st -sp -b -nf -s -ni -- mplayer -wid WID -really-quiet -ao null -loop 0 " + self.filePath;
pass
if self.fileWriter:
self.fileWriter.write(output)
self.fileWriter.close()
return applyType;

View File

@ -0,0 +1 @@
from utils.SaveState import SaveState

View File

@ -5,6 +5,6 @@ using namespace std;
int main() { int main() {
chdir("/opt/GWinWrap/"); chdir("/opt/GWinWrap/");
system("python GWinWrap.py"); system("python3 GWinWrap.py");
return 0; return 0;
} }