--- a/eric6/UI/UserInterface.py Sun May 31 17:26:46 2020 +0200 +++ b/eric6/UI/UserInterface.py Sat Jul 04 11:45:34 2020 +0200 @@ -1226,23 +1226,22 @@ @param label label text to be shown @type str """ - assert side in [UserInterface.LeftSide, UserInterface.BottomSide, - UserInterface.RightSide] - - if self.__layoutType == "Toolboxes": - if side == UserInterface.LeftSide: - self.lToolbox.addItem(widget, icon, label) - elif side == UserInterface.BottomSide: - self.hToolbox.addItem(widget, icon, label) - elif side == UserInterface.RightSide: - self.rToolbox.addItem(widget, icon, label) - elif self.__layoutType == "Sidebars": - if side == UserInterface.LeftSide: - self.leftSidebar.addTab(widget, icon, label) - elif side == UserInterface.BottomSide: - self.bottomSidebar.addTab(widget, icon, label) - elif side == UserInterface.RightSide: - self.rightSidebar.addTab(widget, icon, label) + if side in [UserInterface.LeftSide, UserInterface.BottomSide, + UserInterface.RightSide]: + if self.__layoutType == "Toolboxes": + if side == UserInterface.LeftSide: + self.lToolbox.addItem(widget, icon, label) + elif side == UserInterface.BottomSide: + self.hToolbox.addItem(widget, icon, label) + elif side == UserInterface.RightSide: + self.rToolbox.addItem(widget, icon, label) + elif self.__layoutType == "Sidebars": + if side == UserInterface.LeftSide: + self.leftSidebar.addTab(widget, icon, label) + elif side == UserInterface.BottomSide: + self.bottomSidebar.addTab(widget, icon, label) + elif side == UserInterface.RightSide: + self.rightSidebar.addTab(widget, icon, label) def removeSideWidget(self, widget): """ @@ -2198,7 +2197,7 @@ self.utProjectAct.setEnabled(False) self.actions.append(self.utProjectAct) - # check for Qt4/Qt5 designer and linguist + # check for Qt5 designer and linguist if Utilities.isWindowsPlatform(): designerExe = os.path.join( Utilities.getQtBinariesPath(), @@ -2732,21 +2731,6 @@ """ Private slot to initialize the action to show the Qt documentation. """ - self.qt4DocAct = E5Action( - self.tr('Qt4 Documentation'), - self.tr('Qt&4 Documentation'), - 0, 0, self, 'qt4_documentation') - self.qt4DocAct.setStatusTip(self.tr('Open Qt4 Documentation')) - self.qt4DocAct.setWhatsThis(self.tr( - """<b>Qt4 Documentation</b>""" - """<p>Display the Qt4 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.qt4DocAct.triggered.connect(self.__showQt4Doc) - self.actions.append(self.qt4DocAct) - self.qt5DocAct = E5Action( self.tr('Qt5 Documentation'), self.tr('Qt&5 Documentation'), @@ -2762,25 +2746,6 @@ self.qt5DocAct.triggered.connect(self.__showQt5Doc) self.actions.append(self.qt5DocAct) - try: - import PyQt4 # __IGNORE_WARNING__ - self.pyqt4DocAct = E5Action( - self.tr('PyQt4 Documentation'), - self.tr('PyQt&4 Documentation'), - 0, 0, self, 'pyqt4_documentation') - self.pyqt4DocAct.setStatusTip(self.tr('Open PyQt4 Documentation')) - self.pyqt4DocAct.setWhatsThis(self.tr( - """<b>PyQt4 Documentation</b>""" - """<p>Display the PyQt4 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.pyqt4DocAct.triggered.connect(self.__showPyQt4Doc) - self.actions.append(self.pyqt4DocAct) - except ImportError: - self.pyqt4DocAct = None - self.pyqt5DocAct = E5Action( self.tr('PyQt5 Documentation'), self.tr('PyQt&5 Documentation'), @@ -2819,27 +2784,7 @@ )) self.pythonDocAct.triggered.connect(self.__showPythonDoc) self.actions.append(self.pythonDocAct) - - self.python2DocAct = E5Action( - self.tr('Python 2 Documentation'), - self.tr('Python &2 Documentation'), - 0, 0, self, 'python2_documentation') - self.python2DocAct.setStatusTip(self.tr( - 'Open Python 2 Documentation')) - self.python2DocAct.setWhatsThis(self.tr( - """<b>Python 2 Documentation</b>""" - """<p>Display the Python 2 documentation. If no documentation""" - """ directory is configured, the location of the Python 2""" - """ documentation is assumed to be the doc directory underneath""" - """ the location of the configured Python 2 executable on""" - """ Windows and""" - """ <i>/usr/share/doc/packages/python/html/python-docs-html</i>""" - """ on Unix. Set PYTHON2DOCDIR in your environment to override""" - """ this. </p>""" - )) - self.python2DocAct.triggered.connect(self.__showPython2Doc) - self.actions.append(self.python2DocAct) - + def __initEricDocAction(self): """ Private slot to initialize the action to show the eric6 documentation. @@ -2864,29 +2809,7 @@ Private slot to initialize the actions to show the PySide documentation. """ - pyside_py2, pyside_py3 = Utilities.checkPyside("1") - if pyside_py2 or pyside_py3: - self.pysideDocAct = E5Action( - self.tr('PySide Documentation'), - self.tr('Py&Side Documentation'), - 0, 0, self, 'pyside_documentation') - self.pysideDocAct.setStatusTip(self.tr( - 'Open PySide Documentation')) - self.pysideDocAct.setWhatsThis(self.tr( - """<b>PySide Documentation</b>""" - """<p>Display the PySide 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.pysideDocAct.triggered.connect( - lambda: self.__showPySideDoc("1")) - self.actions.append(self.pysideDocAct) - else: - self.pysideDocAct = None - - pyside2_py2, pyside2_py3 = Utilities.checkPyside("2") - if pyside2_py2 or pyside2_py3: + if Utilities.checkPyside(): self.pyside2DocAct = E5Action( self.tr('PySide2 Documentation'), self.tr('PySide&2 Documentation'), @@ -3192,15 +3115,9 @@ self.__menus["help"].addSeparator() self.__menus["help"].addAction(self.ericDocAct) self.__menus["help"].addAction(self.pythonDocAct) - self.__menus["help"].addAction(self.python2DocAct) - self.__menus["help"].addAction(self.qt4DocAct) self.__menus["help"].addAction(self.qt5DocAct) - if self.pyqt4DocAct is not None: - self.__menus["help"].addAction(self.pyqt4DocAct) if self.pyqt5DocAct is not None: self.__menus["help"].addAction(self.pyqt5DocAct) - if self.pysideDocAct is not None: - self.__menus["help"].addAction(self.pysideDocAct) if self.pyside2DocAct is not None: self.__menus["help"].addAction(self.pyside2DocAct) self.__menus["help"].addSeparator() @@ -5552,75 +5469,6 @@ else: self.__customViewer(home) - def __showPython2Doc(self): - """ - Private slot to show the Python 2 documentation. - """ - pythonDocDir = Preferences.getHelp("Python2DocDir") - if not pythonDocDir: - if Utilities.isWindowsPlatform(): - venvName = Preferences.getDebugger("Python2VirtualEnv") - interpreter = ( - e5App().getObject("VirtualEnvManager") - .getVirtualenvInterpreter(venvName) - ) - if interpreter: - default = os.path.join(os.path.dirname(interpreter), "doc") - else: - default = "" - pythonDocDir = Utilities.getEnvironmentEntry( - "PYTHON2DOCDIR", default) - else: - pythonDocDir = Utilities.getEnvironmentEntry( - "PYTHON2DOCDIR", - '/usr/share/doc/packages/python/html') - if not pythonDocDir.startswith(("http://", "https://", "qthelp://")): - if pythonDocDir.startswith("file://"): - pythonDocDir = pythonDocDir[7:] - if not os.path.splitext(pythonDocDir)[1]: - home = Utilities.normjoinpath(pythonDocDir, 'index.html') - else: - home = pythonDocDir - - if not os.path.exists(home): - E5MessageBox.warning( - self, - self.tr("Documentation Missing"), - self.tr("""<p>The documentation starting point""" - """ "<b>{0}</b>" could not be found.</p>""") - .format(home)) - return - - if not home.endswith(".chm"): - if Utilities.isWindowsPlatform(): - home = "file:///" + Utilities.fromNativeSeparators(home) - else: - home = "file://" + home - else: - home = pythonDocDir - - if home.endswith(".chm"): - self.__chmViewer(home) - else: - hvType = Preferences.getWebBrowser("HelpViewerType") - if hvType == 1: - self.launchHelpViewer(home) - elif hvType == 2: - if home.startswith("qthelp://"): - self.__assistant(home) - else: - self.__webBrowser(home) - elif hvType == 3: - self.__webBrowser(home) - else: - self.__customViewer(home) - - def __showQt4Doc(self): - """ - Private slot to show the Qt4 documentation. - """ - self.__showQtDoc(4) - def __showQt5Doc(self): """ Private slot to show the Qt5 documentation. @@ -5633,10 +5481,7 @@ @param version Qt version to show documentation for (integer) """ - assert version in [4, 5] - if version == 4: - qtDocDir = Preferences.getQt4DocDir() - elif version == 5: + if version == 5: qtDocDir = Preferences.getQt5DocDir() if qtDocDir.startswith("qthelp://"): @@ -5681,68 +5526,6 @@ else: self.__customViewer(home) - def __showPyQt4Doc(self): - """ - Private slot to show the PyQt4 documentation. - """ - pyqt4DocDir = Preferences.getHelp("PyQt4DocDir") - if not pyqt4DocDir: - pyqt4DocDir = Utilities.getEnvironmentEntry("PYQT4DOCDIR", None) - - if not pyqt4DocDir: - E5MessageBox.warning( - self, - self.tr("Documentation"), - self.tr("""<p>The PyQt4 documentation starting point""" - """ has not been configured.</p>""")) - return - - if not pyqt4DocDir.startswith(("http://", "https://", "qthelp://")): - home = "" - if pyqt4DocDir: - if pyqt4DocDir.startswith("file://"): - pyqt4DocDir = pyqt4DocDir[7:] - if not os.path.splitext(pyqt4DocDir)[1]: - possibleHomes = [ - Utilities.normjoinpath(pyqt4DocDir, 'index.html'), - Utilities.normjoinpath(pyqt4DocDir, 'classes.html'), - ] - for possibleHome in possibleHomes: - if os.path.exists(possibleHome): - home = possibleHome - break - else: - home = pyqt4DocDir - - if not home or not os.path.exists(home): - E5MessageBox.warning( - self, - self.tr("Documentation Missing"), - self.tr("""<p>The documentation starting point""" - """ "<b>{0}</b>" could not be found.</p>""") - .format(home)) - return - - if Utilities.isWindowsPlatform(): - home = "file:///" + Utilities.fromNativeSeparators(home) - else: - home = "file://" + home - else: - home = pyqt4DocDir - - hvType = Preferences.getWebBrowser("HelpViewerType") - if hvType == 1: - self.launchHelpViewer(home) - elif hvType == 2: - if home.startswith("qthelp://"): - self.__assistant(home) - else: - self.__webBrowser(home) - elif hvType == 3: - self.__webBrowser(home) - else: - self.__customViewer(home) - def __showPyQt5Doc(self): """ Private slot to show the PyQt5 documentation. @@ -5843,26 +5626,18 @@ self.__webBrowser(home) else: self.__customViewer(home) - - def __showPySideDoc(self, variant): - """ - Private slot to show the PySide/PySide2 documentation. - - @param variant PySide variant (1 or 2) + + def __showPySideDoc(self, variant="2"): + """ + Private slot to show the PySide2 documentation. + + @param variant PySide variant (2) @type str """ - assert variant in ("1", "2") - - if variant == "1": - pysideDocDir = Preferences.getHelp("PySideDocDir") - if not pysideDocDir: - pysideDocDir = Utilities.getEnvironmentEntry( - "PYSIDEDOCDIR", None) - else: - pysideDocDir = Preferences.getHelp("PySide2DocDir") - if not pysideDocDir: - pysideDocDir = Utilities.getEnvironmentEntry( - "PYSIDE2DOCDIR", None) + pysideDocDir = Preferences.getHelp("PySide2DocDir") + if not pysideDocDir: + pysideDocDir = Utilities.getEnvironmentEntry( + "PYSIDE2DOCDIR", None) if not pysideDocDir: E5MessageBox.warning( @@ -5870,7 +5645,7 @@ self.tr("Documentation"), self.tr("""<p>The PySide{0} documentation starting point""" """ has not been configured.</p>""").format( - "" if variant == "1" else variant) + variant) ) return