Snapshot: fixed some issues and implemented support for the two include options (decorations, mouse cursor) on Wayland. screenshot

Wed, 03 Apr 2019 19:13:02 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 03 Apr 2019 19:13:02 +0200
branch
screenshot
changeset 6917
7075ede48c2f
parent 6916
76810bef8425
child 6918
10ffd5b677de

Snapshot: fixed some issues and implemented support for the two include options (decorations, mouse cursor) on Wayland.

Snapshot/SnapWidget.py file | annotate | diff | comparison | revisions
Snapshot/SnapshotDefaultGrabber.py file | annotate | diff | comparison | revisions
Snapshot/SnapshotWaylandGrabber.py file | annotate | diff | comparison | revisions
--- a/Snapshot/SnapWidget.py	Tue Apr 02 19:52:36 2019 +0200
+++ b/Snapshot/SnapWidget.py	Wed Apr 03 19:13:02 2019 +0200
@@ -51,8 +51,8 @@
         self.setWindowIcon(UI.PixmapCache.getIcon("ericSnap.png"))
         
         # TODO: correct this once tested
-#        if Globals.isWaylandSession():
-        if True:
+        if Globals.isWaylandSession():
+#        if True:
             from .SnapshotWaylandGrabber import SnapshotWaylandGrabber
             self.__grabber = SnapshotWaylandGrabber(self)
         else:
@@ -310,10 +310,12 @@
         self.__savedPosition = self.pos()
         self.hide()
         
-        # TODO: add support for decorations and mouse cursor
         self.__grabber.grab(
             self.modeCombo.itemData(self.modeCombo.currentIndex()),
-            self.delaySpin.value())
+            self.delaySpin.value(),
+            self.mouseCursorCheckBox.isChecked(),
+            self.decorationsCheckBox.isChecked(),
+        )
     
     def __redisplay(self):
         """
@@ -412,9 +414,11 @@
         
         Preferences.Prefs.settings.setValue(
             "Snapshot/Delay", self.delaySpin.value())
-        Preferences.Prefs.settings.setValue(
-            "Snapshot/Mode",
-            self.modeCombo.itemData(self.modeCombo.currentIndex()).value)
+        modeData = self.modeCombo.itemData(self.modeCombo.currentIndex())
+        if modeData is not None:
+            Preferences.Prefs.settings.setValue(
+                "Snapshot/Mode",
+                modeData.value)
         Preferences.Prefs.settings.setValue(
             "Snapshot/Filename", self.__filename)
         Preferences.Prefs.settings.sync()
--- a/Snapshot/SnapshotDefaultGrabber.py	Tue Apr 02 19:52:36 2019 +0200
+++ b/Snapshot/SnapshotDefaultGrabber.py	Wed Apr 03 19:13:02 2019 +0200
@@ -59,7 +59,8 @@
             SnapshotModes.Ellipse,
         )
     
-    def grab(self, mode, delay=0):
+    def grab(self, mode, delay=0, captureCursor=False,
+             captureDecorations=False):
         """
         Public method to perform a grab operation potentially after a delay.
         
@@ -67,6 +68,12 @@
         @type ScreenshotModes
         @param delay delay in seconds
         @type int
+        @param captureCursor flag indicating to include the mouse cursor
+            (not used)
+        @type bool
+        @param captureDecorations flag indicating to include the window
+            decorations (not used)
+        @type bool
         """
         self.__mode = mode
         if delay:
--- a/Snapshot/SnapshotWaylandGrabber.py	Tue Apr 02 19:52:36 2019 +0200
+++ b/Snapshot/SnapshotWaylandGrabber.py	Wed Apr 03 19:13:02 2019 +0200
@@ -88,6 +88,7 @@
         @type bool
         @param captureDecorations flag indicating to include the window
             decorations (only used for mode SnapshotModes.SelectedWindow)
+        @type bool
         """
         if not DBusAvailable:
             # just to play it safe

eric ide

mercurial