1672 )) |
1672 )) |
1673 self.helpviewerAct.triggered[()].connect(self.__helpViewer) |
1673 self.helpviewerAct.triggered[()].connect(self.__helpViewer) |
1674 self.actions.append(self.helpviewerAct) |
1674 self.actions.append(self.helpviewerAct) |
1675 |
1675 |
1676 self.__initQtDocActions() |
1676 self.__initQtDocActions() |
1677 self.__initPythonDocAction() |
1677 self.__initPythonDocActions() |
1678 self.__initEricDocAction() |
1678 self.__initEricDocAction() |
1679 self.__initPySideDocActions() |
1679 self.__initPySideDocAction() |
1680 |
1680 |
1681 self.versionAct = E5Action(self.trUtf8('Show Versions'), |
1681 self.versionAct = E5Action(self.trUtf8('Show Versions'), |
1682 self.trUtf8('Show &Versions'), 0, 0, self, 'show_versions') |
1682 self.trUtf8('Show &Versions'), 0, 0, self, 'show_versions') |
1683 self.versionAct.setStatusTip(self.trUtf8('Display version information')) |
1683 self.versionAct.setStatusTip(self.trUtf8('Display version information')) |
1684 self.versionAct.setWhatsThis(self.trUtf8( |
1684 self.versionAct.setWhatsThis(self.trUtf8( |
2125 # initialize multi project actions |
2125 # initialize multi project actions |
2126 self.multiProject.initActions() |
2126 self.multiProject.initActions() |
2127 |
2127 |
2128 def __initQtDocActions(self): |
2128 def __initQtDocActions(self): |
2129 """ |
2129 """ |
2130 Private slot to initilize the action to show the Qt documentation. |
2130 Private slot to initialize the action to show the Qt documentation. |
2131 """ |
2131 """ |
2132 self.qt4DocAct = E5Action(self.trUtf8('Qt4 Documentation'), |
2132 self.qt4DocAct = E5Action(self.trUtf8('Qt4 Documentation'), |
2133 self.trUtf8('Qt&4 Documentation'), 0, 0, self, 'qt4_documentation') |
2133 self.trUtf8('Qt&4 Documentation'), 0, 0, self, 'qt4_documentation') |
2134 self.qt4DocAct.setStatusTip(self.trUtf8('Open Qt4 Documentation')) |
2134 self.qt4DocAct.setStatusTip(self.trUtf8('Open Qt4 Documentation')) |
2135 self.qt4DocAct.setWhatsThis(self.trUtf8( |
2135 self.qt4DocAct.setWhatsThis(self.trUtf8( |
2151 """ a web browser or Qt Assistant. </p>""" |
2151 """ a web browser or Qt Assistant. </p>""" |
2152 )) |
2152 )) |
2153 self.pyqt4DocAct.triggered[()].connect(self.__showPyQt4Doc) |
2153 self.pyqt4DocAct.triggered[()].connect(self.__showPyQt4Doc) |
2154 self.actions.append(self.pyqt4DocAct) |
2154 self.actions.append(self.pyqt4DocAct) |
2155 |
2155 |
2156 def __initPythonDocAction(self): |
2156 def __initPythonDocActions(self): |
2157 """ |
2157 """ |
2158 Private slot to initilize the action to show the Python documentation. |
2158 Private slot to initialize the actions to show the Python documentation. |
2159 """ |
2159 """ |
2160 self.pythonDocAct = E5Action(self.trUtf8('Python Documentation'), |
2160 self.pythonDocAct = E5Action(self.trUtf8('Python 3 Documentation'), |
2161 self.trUtf8('&Python Documentation'), 0, 0, self, 'python_documentation') |
2161 self.trUtf8('Python &3 Documentation'), 0, 0, self, 'python3_documentation') |
2162 self.pythonDocAct.setStatusTip(self.trUtf8('Open Python Documentation')) |
2162 self.pythonDocAct.setStatusTip(self.trUtf8('Open Python 3 Documentation')) |
2163 self.pythonDocAct.setWhatsThis(self.trUtf8( |
2163 self.pythonDocAct.setWhatsThis(self.trUtf8( |
2164 """<b>Python Documentation</b>""" |
2164 """<b>Python 3 Documentation</b>""" |
2165 """<p>Display the python documentation.""" |
2165 """<p>Display the Python 3 documentation.""" |
2166 """ If no documentation directory is configured,""" |
2166 """ If no documentation directory is configured,""" |
2167 """ the location of the python documentation is assumed to be the doc""" |
2167 """ the location of the Python 3 documentation is assumed to be the doc""" |
2168 """ directory underneath the location of the python executable on""" |
2168 """ directory underneath the location of the Python 3 executable on""" |
2169 """ Windows and <i>/usr/share/doc/packages/python/html</i> on Unix.""" |
2169 """ Windows and <i>/usr/share/doc/packages/python/html</i> on Unix.""" |
2170 """ Set PYTHONDOCDIR in your environment to override this. </p>""" |
2170 """ Set PYTHON3DOCDIR in your environment to override this. </p>""" |
2171 )) |
2171 )) |
2172 self.pythonDocAct.triggered[()].connect(self.__showPythonDoc) |
2172 self.pythonDocAct.triggered[()].connect(self.__showPythonDoc) |
2173 self.actions.append(self.pythonDocAct) |
2173 self.actions.append(self.pythonDocAct) |
|
2174 |
|
2175 self.python2DocAct = E5Action(self.trUtf8('Python 2 Documentation'), |
|
2176 self.trUtf8('Python &2 Documentation'), 0, 0, self, 'python2_documentation') |
|
2177 self.python2DocAct.setStatusTip(self.trUtf8('Open Python 2 Documentation')) |
|
2178 self.python2DocAct.setWhatsThis(self.trUtf8( |
|
2179 """<b>Python 2 Documentation</b>""" |
|
2180 """<p>Display the Python 2 documentation.""" |
|
2181 """ If no documentation directory is configured,""" |
|
2182 """ the location of the Python 2 documentation is assumed to be the doc""" |
|
2183 """ directory underneath the location of the configured Python 2""" |
|
2184 """ executable on Windows and""" |
|
2185 """ <i>/usr/share/doc/packages/python/html/python-docs-html</i>""" |
|
2186 """ on Unix. Set PYTHON2DOCDIR in your environment to override""" |
|
2187 """ this. </p>""" |
|
2188 )) |
|
2189 self.python2DocAct.triggered[()].connect(self.__showPython2Doc) |
|
2190 self.actions.append(self.python2DocAct) |
2174 |
2191 |
2175 def __initEricDocAction(self): |
2192 def __initEricDocAction(self): |
2176 """ |
2193 """ |
2177 Private slot to initialize the action to show the eric5 documentation. |
2194 Private slot to initialize the action to show the eric5 documentation. |
2178 """ |
2195 """ |
2186 """ subdirectory of the eric5 installation directory.</p>""" |
2203 """ subdirectory of the eric5 installation directory.</p>""" |
2187 )) |
2204 )) |
2188 self.ericDocAct.triggered[()].connect(self.__showEricDoc) |
2205 self.ericDocAct.triggered[()].connect(self.__showEricDoc) |
2189 self.actions.append(self.ericDocAct) |
2206 self.actions.append(self.ericDocAct) |
2190 |
2207 |
2191 def __initPySideDocActions(self): |
2208 def __initPySideDocAction(self): |
2192 """ |
2209 """ |
2193 Private slot to initilize the action to show the PySide documentation. |
2210 Private slot to initialize the action to show the PySide documentation. |
2194 """ |
2211 """ |
2195 try: |
2212 try: |
2196 import PySide |
2213 import PySide |
2197 self.pysideDocAct = E5Action(self.trUtf8('PySide Documentation'), |
2214 self.pysideDocAct = E5Action(self.trUtf8('PySide Documentation'), |
2198 self.trUtf8('Py&Side Documentation'), 0, 0, self, 'pyside_documentation') |
2215 self.trUtf8('Py&Side Documentation'), 0, 0, self, 'pyside_documentation') |
2322 self.__menus["help"].setTearOffEnabled(True) |
2339 self.__menus["help"].setTearOffEnabled(True) |
2323 self.__menus["help"].addAction(self.helpviewerAct) |
2340 self.__menus["help"].addAction(self.helpviewerAct) |
2324 self.__menus["help"].addSeparator() |
2341 self.__menus["help"].addSeparator() |
2325 self.__menus["help"].addAction(self.ericDocAct) |
2342 self.__menus["help"].addAction(self.ericDocAct) |
2326 self.__menus["help"].addAction(self.pythonDocAct) |
2343 self.__menus["help"].addAction(self.pythonDocAct) |
|
2344 self.__menus["help"].addAction(self.python2DocAct) |
2327 self.__menus["help"].addAction(self.qt4DocAct) |
2345 self.__menus["help"].addAction(self.qt4DocAct) |
2328 self.__menus["help"].addAction(self.pyqt4DocAct) |
2346 self.__menus["help"].addAction(self.pyqt4DocAct) |
2329 if self.pysideDocAct is not None: |
2347 if self.pysideDocAct is not None: |
2330 self.__menus["help"].addAction(self.pysideDocAct) |
2348 self.__menus["help"].addAction(self.pysideDocAct) |
2331 self.__menus["help"].addSeparator() |
2349 self.__menus["help"].addSeparator() |
4479 t = self.trUtf8("Process '{0}' has exited.\n").format(proc[0]) |
4497 t = self.trUtf8("Process '{0}' has exited.\n").format(proc[0]) |
4480 self.appendToStdout(t) |
4498 self.appendToStdout(t) |
4481 |
4499 |
4482 def __showPythonDoc(self): |
4500 def __showPythonDoc(self): |
4483 """ |
4501 """ |
4484 Private slot to show the Python documentation. |
4502 Private slot to show the Python 3 documentation. |
4485 """ |
4503 """ |
4486 pythonDocDir = Preferences.getHelp("PythonDocDir") |
4504 pythonDocDir = Preferences.getHelp("PythonDocDir") |
4487 if not pythonDocDir: |
4505 if not pythonDocDir: |
4488 if Utilities.isWindowsPlatform(): |
4506 if Utilities.isWindowsPlatform(): |
4489 pythonDocDir = Utilities.getEnvironmentEntry("PYTHONDOCDIR", |
4507 pythonDocDir = Utilities.getEnvironmentEntry("PYTHON3DOCDIR", |
4490 os.path.join(os.path.dirname(sys.executable), "doc")) |
4508 os.path.join(os.path.dirname(sys.executable), "doc")) |
4491 else: |
4509 else: |
4492 pythonDocDir = Utilities.getEnvironmentEntry("PYTHONDOCDIR", |
4510 pythonDocDir = Utilities.getEnvironmentEntry("PYTHON3DOCDIR", |
4493 '/usr/share/doc/packages/python/html') |
4511 '/usr/share/doc/packages/python/html') |
4494 if not pythonDocDir.startswith("http://") and \ |
4512 if not pythonDocDir.startswith("http://") and \ |
4495 not pythonDocDir.startswith("https://"): |
4513 not pythonDocDir.startswith("https://"): |
4496 if pythonDocDir.startswith("file://"): |
4514 if pythonDocDir.startswith("file://"): |
4497 pythonDocDir = pythonDocDir[7:] |
4515 pythonDocDir = pythonDocDir[7:] |
4500 |
4518 |
4501 if Utilities.isWindowsPlatform() and not os.path.exists(home): |
4519 if Utilities.isWindowsPlatform() and not os.path.exists(home): |
4502 pyversion = sys.hexversion >> 16 |
4520 pyversion = sys.hexversion >> 16 |
4503 vers = "{0:d}{1:d}".format((pyversion >> 8) & 0xff, pyversion & 0xff) |
4521 vers = "{0:d}{1:d}".format((pyversion >> 8) & 0xff, pyversion & 0xff) |
4504 home = os.path.join(pythonDocDir, "python{0}.chm".format(vers)) |
4522 home = os.path.join(pythonDocDir, "python{0}.chm".format(vers)) |
|
4523 else: |
|
4524 home = pythonDocDir |
|
4525 |
|
4526 if not os.path.exists(home): |
|
4527 E5MessageBox.warning(self, |
|
4528 self.trUtf8("Documentation Missing"), |
|
4529 self.trUtf8("""<p>The documentation starting point""" |
|
4530 """ "<b>{0}</b>" could not be found.</p>""")\ |
|
4531 .format(home)) |
|
4532 return |
|
4533 |
|
4534 if not home.endswith(".chm"): |
|
4535 if Utilities.isWindowsPlatform(): |
|
4536 home = "file:///" + Utilities.fromNativeSeparators(home) |
|
4537 else: |
|
4538 home = "file://" + home |
|
4539 else: |
|
4540 home = pythonDocDir |
|
4541 |
|
4542 if home.endswith(".chm"): |
|
4543 self.__chmViewer(home) |
|
4544 else: |
|
4545 hvType = Preferences.getHelp("HelpViewerType") |
|
4546 if hvType == 1: |
|
4547 self.launchHelpViewer(home) |
|
4548 elif hvType == 2: |
|
4549 self.__assistant(home, version = 4) |
|
4550 elif hvType == 3: |
|
4551 self.__webBrowser(home) |
|
4552 else: |
|
4553 self.__customViewer(home) |
|
4554 |
|
4555 def __showPython2Doc(self): |
|
4556 """ |
|
4557 Private slot to show the Python 2 documentation. |
|
4558 """ |
|
4559 pythonDocDir = Preferences.getHelp("Python2DocDir") |
|
4560 executable = Preferences.getDebugger("PythonInterpreter") |
|
4561 if not pythonDocDir: |
|
4562 if Utilities.isWindowsPlatform(): |
|
4563 if executable: |
|
4564 default = os.path.join(os.path.dirname(executable), "doc") |
|
4565 else: |
|
4566 default = "" |
|
4567 pythonDocDir = Utilities.getEnvironmentEntry("PYTHON2DOCDIR", default) |
|
4568 else: |
|
4569 pythonDocDir = Utilities.getEnvironmentEntry("PYTHON3DOCDIR", |
|
4570 '/usr/share/doc/packages/python/html/python-docs-html') |
|
4571 if not pythonDocDir.startswith("http://") and \ |
|
4572 not pythonDocDir.startswith("https://"): |
|
4573 if pythonDocDir.startswith("file://"): |
|
4574 pythonDocDir = pythonDocDir[7:] |
|
4575 if not os.path.splitext(pythonDocDir)[1]: |
|
4576 home = Utilities.normjoinpath(pythonDocDir, 'index.html') |
4505 else: |
4577 else: |
4506 home = pythonDocDir |
4578 home = pythonDocDir |
4507 |
4579 |
4508 if not os.path.exists(home): |
4580 if not os.path.exists(home): |
4509 E5MessageBox.warning(self, |
4581 E5MessageBox.warning(self, |