src/eric7/UI/UserInterface.py

branch
eric7
changeset 10646
37900a37e522
parent 10595
59579e8aff98
child 10647
073db4747887
diff -r 2a28bb2961b8 -r 37900a37e522 src/eric7/UI/UserInterface.py
--- a/src/eric7/UI/UserInterface.py	Sun Mar 24 16:02:24 2024 +0100
+++ b/src/eric7/UI/UserInterface.py	Sun Mar 24 16:18:42 2024 +0100
@@ -3096,25 +3096,28 @@
         self.iconEditorAct.triggered.connect(self.__editPixmap)
         self.actions.append(self.iconEditorAct)
 
-        self.snapshotAct = EricAction(
-            self.tr("Snapshot"),
-            EricPixmapCache.getIcon("ericSnap"),
-            self.tr("&Snapshot..."),
-            0,
-            0,
-            self,
-            "snapshot",
-        )
-        self.snapshotAct.setStatusTip(self.tr("Take snapshots of a screen region"))
-        self.snapshotAct.setWhatsThis(
-            self.tr(
-                """<b>Snapshot</b>"""
-                """<p>This opens a dialog to take snapshots of a screen"""
-                """ region.</p>"""
-            )
-        )
-        self.snapshotAct.triggered.connect(self.__snapshot)
-        self.actions.append(self.snapshotAct)
+        if DesktopUtilities.isWaylandSession():
+            self.snapshotAct = None
+        else:
+            self.snapshotAct = EricAction(
+                self.tr("Snapshot"),
+                EricPixmapCache.getIcon("ericSnap"),
+                self.tr("&Snapshot..."),
+                0,
+                0,
+                self,
+                "snapshot",
+            )
+            self.snapshotAct.setStatusTip(self.tr("Take snapshots of a screen region"))
+            self.snapshotAct.setWhatsThis(
+                self.tr(
+                    """<b>Snapshot</b>"""
+                    """<p>This opens a dialog to take snapshots of a screen"""
+                    """ region.</p>"""
+                )
+            )
+            self.snapshotAct.triggered.connect(self.__snapshot)
+            self.actions.append(self.snapshotAct)
 
         self.pdfViewerAct = EricAction(
             self.tr("eric PDF Viewer"),
@@ -4137,7 +4140,8 @@
         toolstb.addAction(self.miniEditorAct)
         toolstb.addAction(self.hexEditorAct)
         toolstb.addAction(self.iconEditorAct)
-        toolstb.addAction(self.snapshotAct)
+        if self.snapshotAct is not None:
+            toolstb.addAction(self.snapshotAct)
         toolstb.addAction(self.pdfViewerAct)
         if self.webBrowserAct:
             toolstb.addSeparator()
@@ -5104,7 +5108,8 @@
         btMenu.addAction(self.miniEditorAct)
         btMenu.addAction(self.hexEditorAct)
         btMenu.addAction(self.iconEditorAct)
-        btMenu.addAction(self.snapshotAct)
+        if self.snapshotAct is not None:
+            btMenu.addAction(self.snapshotAct)
         btMenu.addAction(self.pdfViewerAct)
         if self.webBrowserAct:
             btMenu.addAction(self.webBrowserAct)
@@ -6476,6 +6481,17 @@
         """
         Private slot to start the snapshot tool.
         """
+        if DesktopUtilities.isWaylandSession():
+            EricMessageBox.critical(
+                self,
+                self.tr("Snapshot"),
+                self.tr(
+                    "<p>The snapshot utility is not available for Wayland desktop"
+                    " sessions.</p>"
+                ).format(snap),
+            )
+            return
+
         proc = QProcess()
 
         snap = os.path.join(getConfig("ericDir"), "eric7_snap.py")

eric ide

mercurial