2891 """<p>Display the PyQt5 Documentation. Dependent upon your""" |
2891 """<p>Display the PyQt5 Documentation. Dependent upon your""" |
2892 """ settings, this will either show the help in Eric's""" |
2892 """ settings, this will either show the help in Eric's""" |
2893 """ internal help viewer/web browser, or execute a web""" |
2893 """ internal help viewer/web browser, or execute a web""" |
2894 """ browser or Qt Assistant. </p>""" |
2894 """ browser or Qt Assistant. </p>""" |
2895 )) |
2895 )) |
2896 self.pyqt5DocAct.triggered.connect(self.__showPyQt5Doc) |
2896 self.pyqt5DocAct.triggered.connect( |
|
2897 lambda: self.__showPyQtDoc(variant=5)) |
2897 self.actions.append(self.pyqt5DocAct) |
2898 self.actions.append(self.pyqt5DocAct) |
2898 |
2899 |
|
2900 self.pyqt6DocAct = E5Action( |
|
2901 self.tr('PyQt6 Documentation'), |
|
2902 self.tr('PyQt6 Documentation'), |
|
2903 0, 0, self, 'pyqt6_documentation') |
|
2904 self.pyqt6DocAct.setStatusTip(self.tr( |
|
2905 'Open PyQt6 Documentation')) |
|
2906 self.pyqt6DocAct.setWhatsThis(self.tr( |
|
2907 """<b>PyQt6 Documentation</b>""" |
|
2908 """<p>Display the PyQt6 Documentation. Dependent upon your""" |
|
2909 """ settings, this will either show the help in Eric's""" |
|
2910 """ internal help viewer/web browser, or execute a web""" |
|
2911 """ browser or Qt Assistant. </p>""" |
|
2912 )) |
|
2913 self.pyqt6DocAct.triggered.connect( |
|
2914 lambda: self.__showPyQtDoc(variant=6)) |
|
2915 self.actions.append(self.pyqt6DocAct) |
|
2916 |
2899 def __initPythonDocActions(self): |
2917 def __initPythonDocActions(self): |
2900 """ |
2918 """ |
2901 Private slot to initialize the actions to show the Python |
2919 Private slot to initialize the actions to show the Python |
2902 documentation. |
2920 documentation. |
2903 """ |
2921 """ |
2904 self.pythonDocAct = E5Action( |
2922 self.pythonDocAct = E5Action( |
2905 self.tr('Python 3 Documentation'), |
2923 self.tr('Python 3 Documentation'), |
2906 self.tr('Python &3 Documentation'), |
2924 self.tr('Python 3 Documentation'), |
2907 0, 0, self, 'python3_documentation') |
2925 0, 0, self, 'python3_documentation') |
2908 self.pythonDocAct.setStatusTip(self.tr( |
2926 self.pythonDocAct.setStatusTip(self.tr( |
2909 'Open Python 3 Documentation')) |
2927 'Open Python 3 Documentation')) |
2910 self.pythonDocAct.setWhatsThis(self.tr( |
2928 self.pythonDocAct.setWhatsThis(self.tr( |
2911 """<b>Python 3 Documentation</b>""" |
2929 """<b>Python 3 Documentation</b>""" |
2923 """ |
2941 """ |
2924 Private slot to initialize the action to show the eric6 documentation. |
2942 Private slot to initialize the action to show the eric6 documentation. |
2925 """ |
2943 """ |
2926 self.ericDocAct = E5Action( |
2944 self.ericDocAct = E5Action( |
2927 self.tr("Eric API Documentation"), |
2945 self.tr("Eric API Documentation"), |
2928 self.tr('&Eric API Documentation'), |
2946 self.tr('Eric API Documentation'), |
2929 0, 0, self, 'eric_documentation') |
2947 0, 0, self, 'eric_documentation') |
2930 self.ericDocAct.setStatusTip(self.tr( |
2948 self.ericDocAct.setStatusTip(self.tr( |
2931 "Open Eric API Documentation")) |
2949 "Open Eric API Documentation")) |
2932 self.ericDocAct.setWhatsThis(self.tr( |
2950 self.ericDocAct.setWhatsThis(self.tr( |
2933 """<b>Eric API Documentation</b>""" |
2951 """<b>Eric API Documentation</b>""" |
2944 documentation. |
2962 documentation. |
2945 """ |
2963 """ |
2946 if Utilities.checkPyside(variant=2): |
2964 if Utilities.checkPyside(variant=2): |
2947 self.pyside2DocAct = E5Action( |
2965 self.pyside2DocAct = E5Action( |
2948 self.tr('PySide2 Documentation'), |
2966 self.tr('PySide2 Documentation'), |
2949 self.tr('PySide&2 Documentation'), |
2967 self.tr('PySide2 Documentation'), |
2950 0, 0, self, 'pyside2_documentation') |
2968 0, 0, self, 'pyside2_documentation') |
2951 self.pyside2DocAct.setStatusTip(self.tr( |
2969 self.pyside2DocAct.setStatusTip(self.tr( |
2952 'Open PySide2 Documentation')) |
2970 'Open PySide2 Documentation')) |
2953 self.pyside2DocAct.setWhatsThis(self.tr( |
2971 self.pyside2DocAct.setWhatsThis(self.tr( |
2954 """<b>PySide2 Documentation</b>""" |
2972 """<b>PySide2 Documentation</b>""" |
2956 """ settings, this will either show the help in Eric's""" |
2974 """ settings, this will either show the help in Eric's""" |
2957 """ internal help viewer/web browser, or execute a web""" |
2975 """ internal help viewer/web browser, or execute a web""" |
2958 """ browser or Qt Assistant. </p>""" |
2976 """ browser or Qt Assistant. </p>""" |
2959 )) |
2977 )) |
2960 self.pyside2DocAct.triggered.connect( |
2978 self.pyside2DocAct.triggered.connect( |
2961 lambda: self.__showPySideDoc("2")) |
2979 lambda: self.__showPySideDoc(variant=2)) |
2962 self.actions.append(self.pyside2DocAct) |
2980 self.actions.append(self.pyside2DocAct) |
2963 else: |
2981 else: |
2964 self.pyside2DocAct = None |
2982 self.pyside2DocAct = None |
|
2983 |
|
2984 if Utilities.checkPyside(variant=6): |
|
2985 self.pyside6DocAct = E5Action( |
|
2986 self.tr('PySide6 Documentation'), |
|
2987 self.tr('PySide6 Documentation'), |
|
2988 0, 0, self, 'pyside6_documentation') |
|
2989 self.pyside6DocAct.setStatusTip(self.tr( |
|
2990 'Open PySide6 Documentation')) |
|
2991 self.pyside6DocAct.setWhatsThis(self.tr( |
|
2992 """<b>PySide6 Documentation</b>""" |
|
2993 """<p>Display the PySide6 Documentation. Dependent upon your""" |
|
2994 """ settings, this will either show the help in Eric's""" |
|
2995 """ internal help viewer/web browser, or execute a web""" |
|
2996 """ browser or Qt Assistant. </p>""" |
|
2997 )) |
|
2998 self.pyside6DocAct.triggered.connect( |
|
2999 lambda: self.__showPySideDoc(variant=6)) |
|
3000 self.actions.append(self.pyside6DocAct) |
|
3001 else: |
|
3002 self.pyside6DocAct = None |
2965 |
3003 |
2966 def __initMenus(self): |
3004 def __initMenus(self): |
2967 """ |
3005 """ |
2968 Private slot to create the menus. |
3006 Private slot to create the menus. |
2969 """ |
3007 """ |
3250 self.__menus["help"].addAction(self.ericDocAct) |
3288 self.__menus["help"].addAction(self.ericDocAct) |
3251 self.__menus["help"].addAction(self.pythonDocAct) |
3289 self.__menus["help"].addAction(self.pythonDocAct) |
3252 self.__menus["help"].addAction(self.qt5DocAct) |
3290 self.__menus["help"].addAction(self.qt5DocAct) |
3253 self.__menus["help"].addAction(self.qt6DocAct) |
3291 self.__menus["help"].addAction(self.qt6DocAct) |
3254 self.__menus["help"].addAction(self.pyqt5DocAct) |
3292 self.__menus["help"].addAction(self.pyqt5DocAct) |
|
3293 self.__menus["help"].addAction(self.pyqt6DocAct) |
3255 if self.pyside2DocAct is not None: |
3294 if self.pyside2DocAct is not None: |
3256 self.__menus["help"].addAction(self.pyside2DocAct) |
3295 self.__menus["help"].addAction(self.pyside2DocAct) |
|
3296 if self.pyside6DocAct is not None: |
|
3297 self.__menus["help"].addAction(self.pyside6DocAct) |
3257 self.__menus["help"].addSeparator() |
3298 self.__menus["help"].addSeparator() |
3258 self.__menus["help"].addAction(self.versionAct) |
3299 self.__menus["help"].addAction(self.versionAct) |
3259 self.__menus["help"].addSeparator() |
3300 self.__menus["help"].addSeparator() |
3260 self.__menus["help"].addAction(self.checkUpdateAct) |
3301 self.__menus["help"].addAction(self.checkUpdateAct) |
3261 self.__menus["help"].addAction(self.showVersionsAct) |
3302 self.__menus["help"].addAction(self.showVersionsAct) |
5707 elif hvType == 3: |
5748 elif hvType == 3: |
5708 self.__webBrowser(home) |
5749 self.__webBrowser(home) |
5709 else: |
5750 else: |
5710 self.__customViewer(home) |
5751 self.__customViewer(home) |
5711 |
5752 |
5712 def __showPyQt5Doc(self): |
5753 def __showPyQtDoc(self, variant=5): |
5713 """ |
5754 """ |
5714 Private slot to show the PyQt5 documentation. |
5755 Private slot to show the PyQt5/6 documentation. |
5715 """ |
5756 |
5716 pyqt5DocDir = Preferences.getHelp("PyQt5DocDir") |
5757 @param variant PyQt variant to show documentation for (5 or 6) |
5717 if not pyqt5DocDir: |
5758 @type int or str |
5718 pyqt5DocDir = Utilities.getEnvironmentEntry("PYQT5DOCDIR", None) |
5759 """ |
5719 |
5760 pyqtDocDir = Preferences.getHelp("PyQt{0}DocDir".format(variant)) |
5720 if not pyqt5DocDir: |
5761 if not pyqtDocDir: |
|
5762 pyqtDocDir = Utilities.getEnvironmentEntry( |
|
5763 "PYQT{0}DOCDIR".format(variant), None) |
|
5764 |
|
5765 if not pyqtDocDir: |
5721 E5MessageBox.warning( |
5766 E5MessageBox.warning( |
5722 self, |
5767 self, |
5723 self.tr("Documentation"), |
5768 self.tr("Documentation"), |
5724 self.tr("""<p>The PyQt5 documentation starting point""" |
5769 self.tr("""<p>The PyQt{0} documentation starting point""" |
5725 """ has not been configured.</p>""")) |
5770 """ has not been configured.</p>""").format(variant)) |
5726 return |
5771 return |
5727 |
5772 |
5728 if not pyqt5DocDir.startswith(("http://", "https://", "qthelp://")): |
5773 if not pyqtDocDir.startswith(("http://", "https://", "qthelp://")): |
5729 home = "" |
5774 home = "" |
5730 if pyqt5DocDir: |
5775 if pyqtDocDir: |
5731 if pyqt5DocDir.startswith("file://"): |
5776 if pyqtDocDir.startswith("file://"): |
5732 pyqt5DocDir = pyqt5DocDir[7:] |
5777 pyqtDocDir = pyqtDocDir[7:] |
5733 if not os.path.splitext(pyqt5DocDir)[1]: |
5778 if not os.path.splitext(pyqtDocDir)[1]: |
5734 possibleHomes = [ |
5779 possibleHomes = [ |
5735 Utilities.normjoinpath( |
5780 Utilities.normjoinpath( |
5736 pyqt5DocDir, 'index.html'), |
5781 pyqtDocDir, 'index.html'), |
5737 Utilities.normjoinpath( |
5782 Utilities.normjoinpath( |
5738 pyqt5DocDir, 'class_reference.html'), |
5783 pyqtDocDir, 'class_reference.html'), |
5739 ] |
5784 ] |
5740 for possibleHome in possibleHomes: |
5785 for possibleHome in possibleHomes: |
5741 if os.path.exists(possibleHome): |
5786 if os.path.exists(possibleHome): |
5742 home = possibleHome |
5787 home = possibleHome |
5743 break |
5788 break |
5744 else: |
5789 else: |
5745 home = pyqt5DocDir |
5790 home = pyqtDocDir |
5746 |
5791 |
5747 if not home or not os.path.exists(home): |
5792 if not home or not os.path.exists(home): |
5748 E5MessageBox.warning( |
5793 E5MessageBox.warning( |
5749 self, |
5794 self, |
5750 self.tr("Documentation Missing"), |
5795 self.tr("Documentation Missing"), |
5808 elif hvType == 3: |
5853 elif hvType == 3: |
5809 self.__webBrowser(home) |
5854 self.__webBrowser(home) |
5810 else: |
5855 else: |
5811 self.__customViewer(home) |
5856 self.__customViewer(home) |
5812 |
5857 |
5813 def __showPySideDoc(self, variant="2"): |
5858 def __showPySideDoc(self, variant=2): |
5814 """ |
5859 """ |
5815 Private slot to show the PySide2 documentation. |
5860 Private slot to show the PySide2/PySide6 documentation. |
5816 |
5861 |
5817 @param variant PySide variant (2) |
5862 @param variant PySide variant (2 or 6) |
5818 @type str |
5863 @type int or str |
5819 """ |
5864 """ |
5820 pysideDocDir = Preferences.getHelp("PySide2DocDir") |
5865 pysideDocDir = Preferences.getHelp("PySide{0}DocDir".format(variant)) |
5821 if not pysideDocDir: |
5866 if not pysideDocDir: |
5822 pysideDocDir = Utilities.getEnvironmentEntry( |
5867 pysideDocDir = Utilities.getEnvironmentEntry( |
5823 "PYSIDE2DOCDIR", None) |
5868 "PYSIDE{0}DOCDIR".format(variant), None) |
5824 |
5869 |
5825 if not pysideDocDir: |
5870 if not pysideDocDir: |
5826 E5MessageBox.warning( |
5871 E5MessageBox.warning( |
5827 self, |
5872 self, |
5828 self.tr("Documentation"), |
5873 self.tr("Documentation"), |