2196 )) |
2196 )) |
2197 self.utProjectAct.triggered.connect(self.__unittestProject) |
2197 self.utProjectAct.triggered.connect(self.__unittestProject) |
2198 self.utProjectAct.setEnabled(False) |
2198 self.utProjectAct.setEnabled(False) |
2199 self.actions.append(self.utProjectAct) |
2199 self.actions.append(self.utProjectAct) |
2200 |
2200 |
2201 # check for Qt4/Qt5 designer and linguist |
2201 # check for Qt5 designer and linguist |
2202 if Utilities.isWindowsPlatform(): |
2202 if Utilities.isWindowsPlatform(): |
2203 designerExe = os.path.join( |
2203 designerExe = os.path.join( |
2204 Utilities.getQtBinariesPath(), |
2204 Utilities.getQtBinariesPath(), |
2205 "{0}.exe".format(Utilities.generateQtToolName("designer"))) |
2205 "{0}.exe".format(Utilities.generateQtToolName("designer"))) |
2206 elif Utilities.isMacPlatform(): |
2206 elif Utilities.isMacPlatform(): |
2730 |
2730 |
2731 def __initQtDocActions(self): |
2731 def __initQtDocActions(self): |
2732 """ |
2732 """ |
2733 Private slot to initialize the action to show the Qt documentation. |
2733 Private slot to initialize the action to show the Qt documentation. |
2734 """ |
2734 """ |
2735 self.qt4DocAct = E5Action( |
|
2736 self.tr('Qt4 Documentation'), |
|
2737 self.tr('Qt&4 Documentation'), |
|
2738 0, 0, self, 'qt4_documentation') |
|
2739 self.qt4DocAct.setStatusTip(self.tr('Open Qt4 Documentation')) |
|
2740 self.qt4DocAct.setWhatsThis(self.tr( |
|
2741 """<b>Qt4 Documentation</b>""" |
|
2742 """<p>Display the Qt4 Documentation. Dependent upon your""" |
|
2743 """ settings, this will either show the help in Eric's internal""" |
|
2744 """ help viewer/web browser, or execute a web browser or Qt""" |
|
2745 """ Assistant. </p>""" |
|
2746 )) |
|
2747 self.qt4DocAct.triggered.connect(self.__showQt4Doc) |
|
2748 self.actions.append(self.qt4DocAct) |
|
2749 |
|
2750 self.qt5DocAct = E5Action( |
2735 self.qt5DocAct = E5Action( |
2751 self.tr('Qt5 Documentation'), |
2736 self.tr('Qt5 Documentation'), |
2752 self.tr('Qt&5 Documentation'), |
2737 self.tr('Qt&5 Documentation'), |
2753 0, 0, self, 'qt5_documentation') |
2738 0, 0, self, 'qt5_documentation') |
2754 self.qt5DocAct.setStatusTip(self.tr('Open Qt5 Documentation')) |
2739 self.qt5DocAct.setStatusTip(self.tr('Open Qt5 Documentation')) |
2760 """ Assistant. </p>""" |
2745 """ Assistant. </p>""" |
2761 )) |
2746 )) |
2762 self.qt5DocAct.triggered.connect(self.__showQt5Doc) |
2747 self.qt5DocAct.triggered.connect(self.__showQt5Doc) |
2763 self.actions.append(self.qt5DocAct) |
2748 self.actions.append(self.qt5DocAct) |
2764 |
2749 |
2765 try: |
|
2766 import PyQt4 # __IGNORE_WARNING__ |
|
2767 self.pyqt4DocAct = E5Action( |
|
2768 self.tr('PyQt4 Documentation'), |
|
2769 self.tr('PyQt&4 Documentation'), |
|
2770 0, 0, self, 'pyqt4_documentation') |
|
2771 self.pyqt4DocAct.setStatusTip(self.tr('Open PyQt4 Documentation')) |
|
2772 self.pyqt4DocAct.setWhatsThis(self.tr( |
|
2773 """<b>PyQt4 Documentation</b>""" |
|
2774 """<p>Display the PyQt4 Documentation. Dependent upon your""" |
|
2775 """ settings, this will either show the help in Eric's""" |
|
2776 """ internal help viewer/web browser, or execute a web""" |
|
2777 """ browser or Qt Assistant. </p>""" |
|
2778 )) |
|
2779 self.pyqt4DocAct.triggered.connect(self.__showPyQt4Doc) |
|
2780 self.actions.append(self.pyqt4DocAct) |
|
2781 except ImportError: |
|
2782 self.pyqt4DocAct = None |
|
2783 |
|
2784 self.pyqt5DocAct = E5Action( |
2750 self.pyqt5DocAct = E5Action( |
2785 self.tr('PyQt5 Documentation'), |
2751 self.tr('PyQt5 Documentation'), |
2786 self.tr('PyQt&5 Documentation'), |
2752 self.tr('PyQt&5 Documentation'), |
2787 0, 0, self, 'pyqt5_documentation') |
2753 0, 0, self, 'pyqt5_documentation') |
2788 self.pyqt5DocAct.setStatusTip(self.tr( |
2754 self.pyqt5DocAct.setStatusTip(self.tr( |
2817 """ <i>/usr/share/doc/packages/python/html</i> on Unix. Set""" |
2783 """ <i>/usr/share/doc/packages/python/html</i> on Unix. Set""" |
2818 """ PYTHON3DOCDIR in your environment to override this.</p>""" |
2784 """ PYTHON3DOCDIR in your environment to override this.</p>""" |
2819 )) |
2785 )) |
2820 self.pythonDocAct.triggered.connect(self.__showPythonDoc) |
2786 self.pythonDocAct.triggered.connect(self.__showPythonDoc) |
2821 self.actions.append(self.pythonDocAct) |
2787 self.actions.append(self.pythonDocAct) |
2822 |
2788 |
2823 self.python2DocAct = E5Action( |
|
2824 self.tr('Python 2 Documentation'), |
|
2825 self.tr('Python &2 Documentation'), |
|
2826 0, 0, self, 'python2_documentation') |
|
2827 self.python2DocAct.setStatusTip(self.tr( |
|
2828 'Open Python 2 Documentation')) |
|
2829 self.python2DocAct.setWhatsThis(self.tr( |
|
2830 """<b>Python 2 Documentation</b>""" |
|
2831 """<p>Display the Python 2 documentation. If no documentation""" |
|
2832 """ directory is configured, the location of the Python 2""" |
|
2833 """ documentation is assumed to be the doc directory underneath""" |
|
2834 """ the location of the configured Python 2 executable on""" |
|
2835 """ Windows and""" |
|
2836 """ <i>/usr/share/doc/packages/python/html/python-docs-html</i>""" |
|
2837 """ on Unix. Set PYTHON2DOCDIR in your environment to override""" |
|
2838 """ this. </p>""" |
|
2839 )) |
|
2840 self.python2DocAct.triggered.connect(self.__showPython2Doc) |
|
2841 self.actions.append(self.python2DocAct) |
|
2842 |
|
2843 def __initEricDocAction(self): |
2789 def __initEricDocAction(self): |
2844 """ |
2790 """ |
2845 Private slot to initialize the action to show the eric6 documentation. |
2791 Private slot to initialize the action to show the eric6 documentation. |
2846 """ |
2792 """ |
2847 self.ericDocAct = E5Action( |
2793 self.ericDocAct = E5Action( |
2862 def __initPySideDocActions(self): |
2808 def __initPySideDocActions(self): |
2863 """ |
2809 """ |
2864 Private slot to initialize the actions to show the PySide |
2810 Private slot to initialize the actions to show the PySide |
2865 documentation. |
2811 documentation. |
2866 """ |
2812 """ |
2867 pyside_py2, pyside_py3 = Utilities.checkPyside("1") |
2813 if Utilities.checkPyside(): |
2868 if pyside_py2 or pyside_py3: |
|
2869 self.pysideDocAct = E5Action( |
|
2870 self.tr('PySide Documentation'), |
|
2871 self.tr('Py&Side Documentation'), |
|
2872 0, 0, self, 'pyside_documentation') |
|
2873 self.pysideDocAct.setStatusTip(self.tr( |
|
2874 'Open PySide Documentation')) |
|
2875 self.pysideDocAct.setWhatsThis(self.tr( |
|
2876 """<b>PySide Documentation</b>""" |
|
2877 """<p>Display the PySide Documentation. Dependent upon your""" |
|
2878 """ settings, this will either show the help in Eric's""" |
|
2879 """ internal help viewer/web browser, or execute a web""" |
|
2880 """ browser or Qt Assistant. </p>""" |
|
2881 )) |
|
2882 self.pysideDocAct.triggered.connect( |
|
2883 lambda: self.__showPySideDoc("1")) |
|
2884 self.actions.append(self.pysideDocAct) |
|
2885 else: |
|
2886 self.pysideDocAct = None |
|
2887 |
|
2888 pyside2_py2, pyside2_py3 = Utilities.checkPyside("2") |
|
2889 if pyside2_py2 or pyside2_py3: |
|
2890 self.pyside2DocAct = E5Action( |
2814 self.pyside2DocAct = E5Action( |
2891 self.tr('PySide2 Documentation'), |
2815 self.tr('PySide2 Documentation'), |
2892 self.tr('PySide&2 Documentation'), |
2816 self.tr('PySide&2 Documentation'), |
2893 0, 0, self, 'pyside2_documentation') |
2817 0, 0, self, 'pyside2_documentation') |
2894 self.pyside2DocAct.setStatusTip(self.tr( |
2818 self.pyside2DocAct.setStatusTip(self.tr( |
3190 if self.helpviewerAct: |
3114 if self.helpviewerAct: |
3191 self.__menus["help"].addAction(self.helpviewerAct) |
3115 self.__menus["help"].addAction(self.helpviewerAct) |
3192 self.__menus["help"].addSeparator() |
3116 self.__menus["help"].addSeparator() |
3193 self.__menus["help"].addAction(self.ericDocAct) |
3117 self.__menus["help"].addAction(self.ericDocAct) |
3194 self.__menus["help"].addAction(self.pythonDocAct) |
3118 self.__menus["help"].addAction(self.pythonDocAct) |
3195 self.__menus["help"].addAction(self.python2DocAct) |
|
3196 self.__menus["help"].addAction(self.qt4DocAct) |
|
3197 self.__menus["help"].addAction(self.qt5DocAct) |
3119 self.__menus["help"].addAction(self.qt5DocAct) |
3198 if self.pyqt4DocAct is not None: |
|
3199 self.__menus["help"].addAction(self.pyqt4DocAct) |
|
3200 if self.pyqt5DocAct is not None: |
3120 if self.pyqt5DocAct is not None: |
3201 self.__menus["help"].addAction(self.pyqt5DocAct) |
3121 self.__menus["help"].addAction(self.pyqt5DocAct) |
3202 if self.pysideDocAct is not None: |
|
3203 self.__menus["help"].addAction(self.pysideDocAct) |
|
3204 if self.pyside2DocAct is not None: |
3122 if self.pyside2DocAct is not None: |
3205 self.__menus["help"].addAction(self.pyside2DocAct) |
3123 self.__menus["help"].addAction(self.pyside2DocAct) |
3206 self.__menus["help"].addSeparator() |
3124 self.__menus["help"].addSeparator() |
3207 self.__menus["help"].addAction(self.versionAct) |
3125 self.__menus["help"].addAction(self.versionAct) |
3208 self.__menus["help"].addSeparator() |
3126 self.__menus["help"].addSeparator() |
5550 elif hvType == 3: |
5468 elif hvType == 3: |
5551 self.__webBrowser(home) |
5469 self.__webBrowser(home) |
5552 else: |
5470 else: |
5553 self.__customViewer(home) |
5471 self.__customViewer(home) |
5554 |
5472 |
5555 def __showPython2Doc(self): |
|
5556 """ |
|
5557 Private slot to show the Python 2 documentation. |
|
5558 """ |
|
5559 pythonDocDir = Preferences.getHelp("Python2DocDir") |
|
5560 if not pythonDocDir: |
|
5561 if Utilities.isWindowsPlatform(): |
|
5562 venvName = Preferences.getDebugger("Python2VirtualEnv") |
|
5563 interpreter = ( |
|
5564 e5App().getObject("VirtualEnvManager") |
|
5565 .getVirtualenvInterpreter(venvName) |
|
5566 ) |
|
5567 if interpreter: |
|
5568 default = os.path.join(os.path.dirname(interpreter), "doc") |
|
5569 else: |
|
5570 default = "" |
|
5571 pythonDocDir = Utilities.getEnvironmentEntry( |
|
5572 "PYTHON2DOCDIR", default) |
|
5573 else: |
|
5574 pythonDocDir = Utilities.getEnvironmentEntry( |
|
5575 "PYTHON2DOCDIR", |
|
5576 '/usr/share/doc/packages/python/html') |
|
5577 if not pythonDocDir.startswith(("http://", "https://", "qthelp://")): |
|
5578 if pythonDocDir.startswith("file://"): |
|
5579 pythonDocDir = pythonDocDir[7:] |
|
5580 if not os.path.splitext(pythonDocDir)[1]: |
|
5581 home = Utilities.normjoinpath(pythonDocDir, 'index.html') |
|
5582 else: |
|
5583 home = pythonDocDir |
|
5584 |
|
5585 if not os.path.exists(home): |
|
5586 E5MessageBox.warning( |
|
5587 self, |
|
5588 self.tr("Documentation Missing"), |
|
5589 self.tr("""<p>The documentation starting point""" |
|
5590 """ "<b>{0}</b>" could not be found.</p>""") |
|
5591 .format(home)) |
|
5592 return |
|
5593 |
|
5594 if not home.endswith(".chm"): |
|
5595 if Utilities.isWindowsPlatform(): |
|
5596 home = "file:///" + Utilities.fromNativeSeparators(home) |
|
5597 else: |
|
5598 home = "file://" + home |
|
5599 else: |
|
5600 home = pythonDocDir |
|
5601 |
|
5602 if home.endswith(".chm"): |
|
5603 self.__chmViewer(home) |
|
5604 else: |
|
5605 hvType = Preferences.getWebBrowser("HelpViewerType") |
|
5606 if hvType == 1: |
|
5607 self.launchHelpViewer(home) |
|
5608 elif hvType == 2: |
|
5609 if home.startswith("qthelp://"): |
|
5610 self.__assistant(home) |
|
5611 else: |
|
5612 self.__webBrowser(home) |
|
5613 elif hvType == 3: |
|
5614 self.__webBrowser(home) |
|
5615 else: |
|
5616 self.__customViewer(home) |
|
5617 |
|
5618 def __showQt4Doc(self): |
|
5619 """ |
|
5620 Private slot to show the Qt4 documentation. |
|
5621 """ |
|
5622 self.__showQtDoc(4) |
|
5623 |
|
5624 def __showQt5Doc(self): |
5473 def __showQt5Doc(self): |
5625 """ |
5474 """ |
5626 Private slot to show the Qt5 documentation. |
5475 Private slot to show the Qt5 documentation. |
5627 """ |
5476 """ |
5628 self.__showQtDoc(5) |
5477 self.__showQtDoc(5) |
5631 """ |
5480 """ |
5632 Private method to show the Qt documentation. |
5481 Private method to show the Qt documentation. |
5633 |
5482 |
5634 @param version Qt version to show documentation for (integer) |
5483 @param version Qt version to show documentation for (integer) |
5635 """ |
5484 """ |
5636 if version == 4: |
5485 if version == 5: |
5637 qtDocDir = Preferences.getQt4DocDir() |
|
5638 elif version == 5: |
|
5639 qtDocDir = Preferences.getQt5DocDir() |
5486 qtDocDir = Preferences.getQt5DocDir() |
5640 |
5487 |
5641 if qtDocDir.startswith("qthelp://"): |
5488 if qtDocDir.startswith("qthelp://"): |
5642 if not os.path.splitext(qtDocDir)[1]: |
5489 if not os.path.splitext(qtDocDir)[1]: |
5643 home = qtDocDir + "/index.html" |
5490 home = qtDocDir + "/index.html" |
5664 |
5511 |
5665 if Utilities.isWindowsPlatform(): |
5512 if Utilities.isWindowsPlatform(): |
5666 home = "file:///" + Utilities.fromNativeSeparators(home) |
5513 home = "file:///" + Utilities.fromNativeSeparators(home) |
5667 else: |
5514 else: |
5668 home = "file://" + home |
5515 home = "file://" + home |
5669 |
|
5670 hvType = Preferences.getWebBrowser("HelpViewerType") |
|
5671 if hvType == 1: |
|
5672 self.launchHelpViewer(home) |
|
5673 elif hvType == 2: |
|
5674 if home.startswith("qthelp://"): |
|
5675 self.__assistant(home) |
|
5676 else: |
|
5677 self.__webBrowser(home) |
|
5678 elif hvType == 3: |
|
5679 self.__webBrowser(home) |
|
5680 else: |
|
5681 self.__customViewer(home) |
|
5682 |
|
5683 def __showPyQt4Doc(self): |
|
5684 """ |
|
5685 Private slot to show the PyQt4 documentation. |
|
5686 """ |
|
5687 pyqt4DocDir = Preferences.getHelp("PyQt4DocDir") |
|
5688 if not pyqt4DocDir: |
|
5689 pyqt4DocDir = Utilities.getEnvironmentEntry("PYQT4DOCDIR", None) |
|
5690 |
|
5691 if not pyqt4DocDir: |
|
5692 E5MessageBox.warning( |
|
5693 self, |
|
5694 self.tr("Documentation"), |
|
5695 self.tr("""<p>The PyQt4 documentation starting point""" |
|
5696 """ has not been configured.</p>""")) |
|
5697 return |
|
5698 |
|
5699 if not pyqt4DocDir.startswith(("http://", "https://", "qthelp://")): |
|
5700 home = "" |
|
5701 if pyqt4DocDir: |
|
5702 if pyqt4DocDir.startswith("file://"): |
|
5703 pyqt4DocDir = pyqt4DocDir[7:] |
|
5704 if not os.path.splitext(pyqt4DocDir)[1]: |
|
5705 possibleHomes = [ |
|
5706 Utilities.normjoinpath(pyqt4DocDir, 'index.html'), |
|
5707 Utilities.normjoinpath(pyqt4DocDir, 'classes.html'), |
|
5708 ] |
|
5709 for possibleHome in possibleHomes: |
|
5710 if os.path.exists(possibleHome): |
|
5711 home = possibleHome |
|
5712 break |
|
5713 else: |
|
5714 home = pyqt4DocDir |
|
5715 |
|
5716 if not home or not os.path.exists(home): |
|
5717 E5MessageBox.warning( |
|
5718 self, |
|
5719 self.tr("Documentation Missing"), |
|
5720 self.tr("""<p>The documentation starting point""" |
|
5721 """ "<b>{0}</b>" could not be found.</p>""") |
|
5722 .format(home)) |
|
5723 return |
|
5724 |
|
5725 if Utilities.isWindowsPlatform(): |
|
5726 home = "file:///" + Utilities.fromNativeSeparators(home) |
|
5727 else: |
|
5728 home = "file://" + home |
|
5729 else: |
|
5730 home = pyqt4DocDir |
|
5731 |
5516 |
5732 hvType = Preferences.getWebBrowser("HelpViewerType") |
5517 hvType = Preferences.getWebBrowser("HelpViewerType") |
5733 if hvType == 1: |
5518 if hvType == 1: |
5734 self.launchHelpViewer(home) |
5519 self.launchHelpViewer(home) |
5735 elif hvType == 2: |
5520 elif hvType == 2: |
5840 self.__webBrowser(home) |
5625 self.__webBrowser(home) |
5841 elif hvType == 3: |
5626 elif hvType == 3: |
5842 self.__webBrowser(home) |
5627 self.__webBrowser(home) |
5843 else: |
5628 else: |
5844 self.__customViewer(home) |
5629 self.__customViewer(home) |
5845 |
5630 |
5846 def __showPySideDoc(self, variant): |
5631 def __showPySideDoc(self, variant="2"): |
5847 """ |
5632 """ |
5848 Private slot to show the PySide/PySide2 documentation. |
5633 Private slot to show the PySide2 documentation. |
5849 |
5634 |
5850 @param variant PySide variant (1 or 2) |
5635 @param variant PySide variant (2) |
5851 @type str |
5636 @type str |
5852 """ |
5637 """ |
5853 if variant == "1": |
5638 pysideDocDir = Preferences.getHelp("PySide2DocDir") |
5854 pysideDocDir = Preferences.getHelp("PySideDocDir") |
5639 if not pysideDocDir: |
5855 if not pysideDocDir: |
5640 pysideDocDir = Utilities.getEnvironmentEntry( |
5856 pysideDocDir = Utilities.getEnvironmentEntry( |
5641 "PYSIDE2DOCDIR", None) |
5857 "PYSIDEDOCDIR", None) |
|
5858 else: |
|
5859 pysideDocDir = Preferences.getHelp("PySide2DocDir") |
|
5860 if not pysideDocDir: |
|
5861 pysideDocDir = Utilities.getEnvironmentEntry( |
|
5862 "PYSIDE2DOCDIR", None) |
|
5863 |
5642 |
5864 if not pysideDocDir: |
5643 if not pysideDocDir: |
5865 E5MessageBox.warning( |
5644 E5MessageBox.warning( |
5866 self, |
5645 self, |
5867 self.tr("Documentation"), |
5646 self.tr("Documentation"), |
5868 self.tr("""<p>The PySide{0} documentation starting point""" |
5647 self.tr("""<p>The PySide{0} documentation starting point""" |
5869 """ has not been configured.</p>""").format( |
5648 """ has not been configured.</p>""").format( |
5870 "" if variant == "1" else variant) |
5649 variant) |
5871 ) |
5650 ) |
5872 return |
5651 return |
5873 |
5652 |
5874 if not pysideDocDir.startswith(("http://", "https://", "qthelp://")): |
5653 if not pysideDocDir.startswith(("http://", "https://", "qthelp://")): |
5875 if pysideDocDir.startswith("file://"): |
5654 if pysideDocDir.startswith("file://"): |