Addedd builtin image viewer
This commit is contained in:
parent
c391d067e1
commit
6ab22b1a3e
Binary file not shown.
|
@ -107,9 +107,13 @@ class GWinWrap:
|
|||
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))
|
||||
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))
|
||||
else:
|
||||
print("Not a video or image file.")
|
||||
return
|
||||
|
@ -159,12 +163,33 @@ class GWinWrap:
|
|||
|
||||
def runImageViewerProcess(self, widget, eve, params):
|
||||
if eve.type == gdk.EventType.DOUBLE_BUTTON_PRESS:
|
||||
subprocess.call(["xdg-open", params[0]])
|
||||
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("<span foreground=\"#e0cc64\">" + params[1] + "</span>")
|
||||
|
||||
def openMainImageViewer(self, widget):
|
||||
subprocess.call(["xdg-open", self.toSavePath])
|
||||
|
||||
def closePopup(self, widget):
|
||||
previewWindow = self.builder.get_object("previewWindow")
|
||||
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)
|
||||
|
||||
def mouseOut(self, widget, eve, args):
|
||||
pass
|
||||
# watch_cursor = gdk.Cursor(gdk.CursorType.GDK_LEFT_PTR)
|
||||
# self.window.get_window().set_cursor(watch_cursor)
|
||||
|
||||
def toggleXscreenUsageField(self, widget, data=None):
|
||||
useXscreenSaver = self.builder.get_object("useXScrnList")
|
||||
if useXscreenSaver.get_active():
|
||||
|
|
|
@ -213,6 +213,48 @@
|
|||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkImage" id="clearImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-clear</property>
|
||||
<property name="icon_size">3</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="closeImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-quit</property>
|
||||
<property name="icon_size">3</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="closePopupImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-cancel</property>
|
||||
<property name="icon_size">3</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="openProgImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-jump-to</property>
|
||||
<property name="icon_size">3</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="saveImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-save</property>
|
||||
<property name="icon_size">3</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="startImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-media-play</property>
|
||||
<property name="icon_size">3</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="stopImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-media-stop</property>
|
||||
<property name="icon_size">3</property>
|
||||
</object>
|
||||
<object class="GtkWindow" id="Main">
|
||||
<property name="width_request">950</property>
|
||||
<property name="height_request">600</property>
|
||||
|
@ -227,7 +269,7 @@
|
|||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<object class="GtkBox" id="box1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
|
@ -262,6 +304,8 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="image">clearImage</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<signal name="clicked" handler="clearSelection" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -631,6 +675,8 @@
|
|||
<property name="receives_default">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="image">saveImage</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<signal name="clicked" handler="saveToFile" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -646,6 +692,8 @@
|
|||
<property name="receives_default">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="image">startImage</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<signal name="clicked" handler="applySttngs" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -661,6 +709,8 @@
|
|||
<property name="receives_default">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="image">stopImage</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<signal name="clicked" handler="killXWinWrp" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -676,6 +726,8 @@
|
|||
<property name="receives_default">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="image">closeImage</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<signal name="clicked" handler="closeProgram" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -709,4 +761,89 @@
|
|||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkPopover" id="previewWindow">
|
||||
<property name="width_request">640</property>
|
||||
<property name="height_request">525</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="relative_to">helpLabel</property>
|
||||
<property name="position">bottom</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkButtonBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="baseline_position">bottom</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Main Image Viewer</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="image">openProgImage</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<signal name="clicked" handler="openMainImageViewer" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="image">closePopupImage</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<signal name="clicked" handler="closePopup" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<property name="overlay_scrolling">False</property>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="previewImg">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
|
@ -107,9 +107,13 @@ class GWinWrap:
|
|||
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))
|
||||
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))
|
||||
else:
|
||||
print("Not a video or image file.")
|
||||
return
|
||||
|
@ -159,12 +163,33 @@ class GWinWrap:
|
|||
|
||||
def runImageViewerProcess(self, widget, eve, params):
|
||||
if eve.type == gdk.EventType.DOUBLE_BUTTON_PRESS:
|
||||
subprocess.call(["xdg-open", params[0]])
|
||||
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("<span foreground=\"#e0cc64\">" + params[1] + "</span>")
|
||||
|
||||
def openMainImageViewer(self, widget):
|
||||
subprocess.call(["xdg-open", self.toSavePath])
|
||||
|
||||
def closePopup(self, widget):
|
||||
previewWindow = self.builder.get_object("previewWindow")
|
||||
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)
|
||||
|
||||
def mouseOut(self, widget, eve, args):
|
||||
pass
|
||||
# watch_cursor = gdk.Cursor(gdk.CursorType.GDK_LEFT_PTR)
|
||||
# self.window.get_window().set_cursor(watch_cursor)
|
||||
|
||||
def toggleXscreenUsageField(self, widget, data=None):
|
||||
useXscreenSaver = self.builder.get_object("useXScrnList")
|
||||
if useXscreenSaver.get_active():
|
||||
|
|
|
@ -213,6 +213,48 @@
|
|||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkImage" id="clearImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-clear</property>
|
||||
<property name="icon_size">3</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="closeImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-quit</property>
|
||||
<property name="icon_size">3</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="closePopupImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-cancel</property>
|
||||
<property name="icon_size">3</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="openProgImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-jump-to</property>
|
||||
<property name="icon_size">3</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="saveImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-save</property>
|
||||
<property name="icon_size">3</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="startImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-media-play</property>
|
||||
<property name="icon_size">3</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="stopImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-media-stop</property>
|
||||
<property name="icon_size">3</property>
|
||||
</object>
|
||||
<object class="GtkWindow" id="Main">
|
||||
<property name="width_request">950</property>
|
||||
<property name="height_request">600</property>
|
||||
|
@ -227,7 +269,7 @@
|
|||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<object class="GtkBox" id="box1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
|
@ -262,6 +304,8 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="image">clearImage</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<signal name="clicked" handler="clearSelection" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -631,6 +675,8 @@
|
|||
<property name="receives_default">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="image">saveImage</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<signal name="clicked" handler="saveToFile" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -646,6 +692,8 @@
|
|||
<property name="receives_default">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="image">startImage</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<signal name="clicked" handler="applySttngs" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -661,6 +709,8 @@
|
|||
<property name="receives_default">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="image">stopImage</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<signal name="clicked" handler="killXWinWrp" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -676,6 +726,8 @@
|
|||
<property name="receives_default">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="image">closeImage</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<signal name="clicked" handler="closeProgram" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -709,4 +761,89 @@
|
|||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkPopover" id="previewWindow">
|
||||
<property name="width_request">640</property>
|
||||
<property name="height_request">525</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="relative_to">helpLabel</property>
|
||||
<property name="position">bottom</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkButtonBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="baseline_position">bottom</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Main Image Viewer</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="image">openProgImage</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<signal name="clicked" handler="openMainImageViewer" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="image">closePopupImage</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<signal name="clicked" handler="closePopup" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<property name="overlay_scrolling">False</property>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="previewImg">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
Loading…
Reference in New Issue