eric6/UI/UserInterface.py

changeset 7911
4621c9082a43
parent 7907
7991ea245c20
child 7923
91e843545d9a
--- a/eric6/UI/UserInterface.py	Wed Dec 23 16:28:35 2020 +0100
+++ b/eric6/UI/UserInterface.py	Thu Dec 24 16:17:57 2020 +0100
@@ -2893,9 +2893,27 @@
             """ internal help viewer/web browser, or execute a web"""
             """ browser or Qt Assistant. </p>"""
         ))
-        self.pyqt5DocAct.triggered.connect(self.__showPyQt5Doc)
+        self.pyqt5DocAct.triggered.connect(
+            lambda: self.__showPyQtDoc(variant=5))
         self.actions.append(self.pyqt5DocAct)
-        
+      
+        self.pyqt6DocAct = E5Action(
+            self.tr('PyQt6 Documentation'),
+            self.tr('PyQt6 Documentation'),
+            0, 0, self, 'pyqt6_documentation')
+        self.pyqt6DocAct.setStatusTip(self.tr(
+            'Open PyQt6 Documentation'))
+        self.pyqt6DocAct.setWhatsThis(self.tr(
+            """<b>PyQt6 Documentation</b>"""
+            """<p>Display the PyQt6 Documentation. Dependent upon your"""
+            """ settings, this will either show the help in Eric's"""
+            """ internal help viewer/web browser, or execute a web"""
+            """ browser or Qt Assistant. </p>"""
+        ))
+        self.pyqt6DocAct.triggered.connect(
+            lambda: self.__showPyQtDoc(variant=6))
+        self.actions.append(self.pyqt6DocAct)
+    
     def __initPythonDocActions(self):
         """
         Private slot to initialize the actions to show the Python
@@ -2903,7 +2921,7 @@
         """
         self.pythonDocAct = E5Action(
             self.tr('Python 3 Documentation'),
-            self.tr('Python &3 Documentation'),
+            self.tr('Python 3 Documentation'),
             0, 0, self, 'python3_documentation')
         self.pythonDocAct.setStatusTip(self.tr(
             'Open Python 3 Documentation'))
@@ -2925,7 +2943,7 @@
         """
         self.ericDocAct = E5Action(
             self.tr("Eric API Documentation"),
-            self.tr('&Eric API Documentation'),
+            self.tr('Eric API Documentation'),
             0, 0, self, 'eric_documentation')
         self.ericDocAct.setStatusTip(self.tr(
             "Open Eric API Documentation"))
@@ -2946,7 +2964,7 @@
         if Utilities.checkPyside(variant=2):
             self.pyside2DocAct = E5Action(
                 self.tr('PySide2 Documentation'),
-                self.tr('PySide&2 Documentation'),
+                self.tr('PySide2 Documentation'),
                 0, 0, self, 'pyside2_documentation')
             self.pyside2DocAct.setStatusTip(self.tr(
                 'Open PySide2 Documentation'))
@@ -2958,10 +2976,30 @@
                 """ browser or Qt Assistant. </p>"""
             ))
             self.pyside2DocAct.triggered.connect(
-                lambda: self.__showPySideDoc("2"))
+                lambda: self.__showPySideDoc(variant=2))
             self.actions.append(self.pyside2DocAct)
         else:
             self.pyside2DocAct = None
+        
+        if Utilities.checkPyside(variant=6):
+            self.pyside6DocAct = E5Action(
+                self.tr('PySide6 Documentation'),
+                self.tr('PySide6 Documentation'),
+                0, 0, self, 'pyside6_documentation')
+            self.pyside6DocAct.setStatusTip(self.tr(
+                'Open PySide6 Documentation'))
+            self.pyside6DocAct.setWhatsThis(self.tr(
+                """<b>PySide6 Documentation</b>"""
+                """<p>Display the PySide6 Documentation. Dependent upon your"""
+                """ settings, this will either show the help in Eric's"""
+                """ internal help viewer/web browser, or execute a web"""
+                """ browser or Qt Assistant. </p>"""
+            ))
+            self.pyside6DocAct.triggered.connect(
+                lambda: self.__showPySideDoc(variant=6))
+            self.actions.append(self.pyside6DocAct)
+        else:
+            self.pyside6DocAct = None
     
     def __initMenus(self):
         """
@@ -3252,8 +3290,11 @@
         self.__menus["help"].addAction(self.qt5DocAct)
         self.__menus["help"].addAction(self.qt6DocAct)
         self.__menus["help"].addAction(self.pyqt5DocAct)
+        self.__menus["help"].addAction(self.pyqt6DocAct)
         if self.pyside2DocAct is not None:
             self.__menus["help"].addAction(self.pyside2DocAct)
+        if self.pyside6DocAct is not None:
+            self.__menus["help"].addAction(self.pyside6DocAct)
         self.__menus["help"].addSeparator()
         self.__menus["help"].addAction(self.versionAct)
         self.__menus["help"].addSeparator()
@@ -5709,40 +5750,44 @@
         else:
             self.__customViewer(home)
         
-    def __showPyQt5Doc(self):
-        """
-        Private slot to show the PyQt5 documentation.
-        """
-        pyqt5DocDir = Preferences.getHelp("PyQt5DocDir")
-        if not pyqt5DocDir:
-            pyqt5DocDir = Utilities.getEnvironmentEntry("PYQT5DOCDIR", None)
-        
-        if not pyqt5DocDir:
+    def __showPyQtDoc(self, variant=5):
+        """
+        Private slot to show the PyQt5/6 documentation.
+        
+        @param variant PyQt variant to show documentation for (5 or 6)
+        @type int or str
+        """
+        pyqtDocDir = Preferences.getHelp("PyQt{0}DocDir".format(variant))
+        if not pyqtDocDir:
+            pyqtDocDir = Utilities.getEnvironmentEntry(
+                "PYQT{0}DOCDIR".format(variant), None)
+        
+        if not pyqtDocDir:
             E5MessageBox.warning(
                 self,
                 self.tr("Documentation"),
-                self.tr("""<p>The PyQt5 documentation starting point"""
-                        """ has not been configured.</p>"""))
+                self.tr("""<p>The PyQt{0} documentation starting point"""
+                        """ has not been configured.</p>""").format(variant))
             return
         
-        if not pyqt5DocDir.startswith(("http://", "https://", "qthelp://")):
+        if not pyqtDocDir.startswith(("http://", "https://", "qthelp://")):
             home = ""
-            if pyqt5DocDir:
-                if pyqt5DocDir.startswith("file://"):
-                    pyqt5DocDir = pyqt5DocDir[7:]
-                if not os.path.splitext(pyqt5DocDir)[1]:
+            if pyqtDocDir:
+                if pyqtDocDir.startswith("file://"):
+                    pyqtDocDir = pyqtDocDir[7:]
+                if not os.path.splitext(pyqtDocDir)[1]:
                     possibleHomes = [
                         Utilities.normjoinpath(
-                            pyqt5DocDir, 'index.html'),
+                            pyqtDocDir, 'index.html'),
                         Utilities.normjoinpath(
-                            pyqt5DocDir, 'class_reference.html'),
+                            pyqtDocDir, 'class_reference.html'),
                     ]
                     for possibleHome in possibleHomes:
                         if os.path.exists(possibleHome):
                             home = possibleHome
                             break
                 else:
-                    home = pyqt5DocDir
+                    home = pyqtDocDir
             
             if not home or not os.path.exists(home):
                 E5MessageBox.warning(
@@ -5758,7 +5803,7 @@
             else:
                 home = "file://" + home
         else:
-            home = pyqt5DocDir
+            home = pyqtDocDir
         
         hvType = Preferences.getWebBrowser("HelpViewerType")
         if hvType == 1:
@@ -5810,17 +5855,17 @@
         else:
             self.__customViewer(home)
     
-    def __showPySideDoc(self, variant="2"):
-        """
-        Private slot to show the PySide2 documentation.
-        
-        @param variant PySide variant (2)
-        @type str
-        """
-        pysideDocDir = Preferences.getHelp("PySide2DocDir")
+    def __showPySideDoc(self, variant=2):
+        """
+        Private slot to show the PySide2/PySide6 documentation.
+        
+        @param variant PySide variant (2 or 6)
+        @type int or str
+        """
+        pysideDocDir = Preferences.getHelp("PySide{0}DocDir".format(variant))
         if not pysideDocDir:
             pysideDocDir = Utilities.getEnvironmentEntry(
-                "PYSIDE2DOCDIR", None)
+                "PYSIDE{0}DOCDIR".format(variant), None)
         
         if not pysideDocDir:
             E5MessageBox.warning(

eric ide

mercurial