src/eric7/UI/UserInterface.py

branch
eric7
changeset 10710
0e06a55c9f2d
parent 10702
b0d4e74b8f55
child 10711
2ef631169541
child 10716
11cdcc824469
--- a/src/eric7/UI/UserInterface.py	Thu May 16 11:45:40 2024 +0200
+++ b/src/eric7/UI/UserInterface.py	Thu May 16 11:51:49 2024 +0200
@@ -37,7 +37,13 @@
     pyqtSlot,
     qVersion,
 )
-from PyQt6.QtGui import QAction, QDesktopServices, QKeySequence, QSessionManager
+from PyQt6.QtGui import (
+    QAction,
+    QDesktopServices,
+    QGuiApplication,
+    QKeySequence,
+    QSessionManager,
+)
 from PyQt6.QtNetwork import QNetworkAccessManager, QNetworkProxyFactory
 from PyQt6.QtWidgets import (
     QApplication,
@@ -2732,6 +2738,26 @@
         self.versionAct.triggered.connect(self.__showVersions)
         self.actions.append(self.versionAct)
 
+        self.copyVersionAct = EricAction(
+            self.tr("Copy Versions"),
+            self.tr("&Copy Versions"),
+            0,
+            0,
+            self,
+            "copy_versions",
+        )
+        self.copyVersionAct.setStatusTip(
+            self.tr("Copy version information to the clipboard")
+        )
+        self.copyVersionAct.setWhatsThis(
+            self.tr(
+                "<b>Copy Versions</b><p>This generates version information and copies"
+                " it to the clipboard.</p>"
+            )
+        )
+        self.copyVersionAct.triggered.connect(self.__copyVersions)
+        self.actions.append(self.copyVersionAct)
+
         self.showErrorLogAct = EricAction(
             self.tr("Show Error Log"),
             self.tr("Show Error &Log..."),
@@ -4068,6 +4094,7 @@
             self.__menus["help"].addAction(self.pyside6DocAct)
         self.__menus["help"].addSeparator()
         self.__menus["help"].addAction(self.versionAct)
+        self.__menus["help"].addAction(self.copyVersionAct)
         self.__menus["help"].addSeparator()
         self.__menus["help"].addAction(self.showInstallInfoAct)
         self.__menus["help"].addSeparator()
@@ -4595,6 +4622,18 @@
 
         VersionsDialog(self, Program, versionText)
 
+    def __copyVersions(self):
+        """
+        Private method to generated version information and copy that to the clipboard.
+        """
+        QGuiApplication.clipboard().setText(
+            "\n----\n\n{0}\n\n----\n\n{1}\n\n----\n\n{2}".format(
+                Utilities.generateVersionInfo("\n"),
+                Utilities.generatePluginsVersionInfo("\n"),
+                Utilities.generateDistroInfo("\n"),
+            )
+        )
+
     def __reportBug(self):
         """
         Private slot to handle the Report Bug dialog.

eric ide

mercurial