src/eric7/UI/UserInterface.py

branch
server
changeset 10651
280a53840aa3
parent 10633
dda7e43934dc
parent 10647
073db4747887
child 10680
306373ccf8fd
--- a/src/eric7/UI/UserInterface.py	Sun Mar 10 16:39:54 2024 +0100
+++ b/src/eric7/UI/UserInterface.py	Tue Mar 26 10:55:04 2024 +0100
@@ -3117,25 +3117,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"),
@@ -4171,7 +4174,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()
@@ -5140,7 +5144,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)
@@ -6512,6 +6517,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>"
+                ),
+            )
+            return
+
         proc = QProcess()
 
         snap = os.path.join(getConfig("ericDir"), "eric7_snap.py")

eric ide

mercurial