2015 )) |
2015 )) |
2016 self.qt5DocAct.triggered[()].connect(self.__showQt5Doc) |
2016 self.qt5DocAct.triggered[()].connect(self.__showQt5Doc) |
2017 self.actions.append(self.qt5DocAct) |
2017 self.actions.append(self.qt5DocAct) |
2018 |
2018 |
2019 self.pyqt4DocAct = E5Action(self.trUtf8('PyQt4 Documentation'), |
2019 self.pyqt4DocAct = E5Action(self.trUtf8('PyQt4 Documentation'), |
2020 self.trUtf8('P&yQt4 Documentation'), 0, 0, self, 'pyqt4_documentation') |
2020 self.trUtf8('PyQt&4 Documentation'), 0, 0, self, 'pyqt4_documentation') |
2021 self.pyqt4DocAct.setStatusTip(self.trUtf8('Open PyQt4 Documentation')) |
2021 self.pyqt4DocAct.setStatusTip(self.trUtf8('Open PyQt4 Documentation')) |
2022 self.pyqt4DocAct.setWhatsThis(self.trUtf8( |
2022 self.pyqt4DocAct.setWhatsThis(self.trUtf8( |
2023 """<b>PyQt4 Documentation</b>""" |
2023 """<b>PyQt4 Documentation</b>""" |
2024 """<p>Display the PyQt4 Documentation. Dependant upon your settings, this""" |
2024 """<p>Display the PyQt4 Documentation. Dependant upon your settings, this""" |
2025 """ will either show the help in Eric's internal help viewer, or execute""" |
2025 """ will either show the help in Eric's internal help viewer, or execute""" |
2026 """ a web browser or Qt Assistant. </p>""" |
2026 """ a web browser or Qt Assistant. </p>""" |
2027 )) |
2027 )) |
2028 self.pyqt4DocAct.triggered[()].connect(self.__showPyQt4Doc) |
2028 self.pyqt4DocAct.triggered[()].connect(self.__showPyQt4Doc) |
2029 self.actions.append(self.pyqt4DocAct) |
2029 self.actions.append(self.pyqt4DocAct) |
2030 |
2030 |
2031 # TODO: add PyQt5 |
2031 try: |
|
2032 import PyQt5 # __IGNORE_WARNING__ |
|
2033 self.pyqt5DocAct = E5Action(self.trUtf8('PyQt5 Documentation'), |
|
2034 self.trUtf8('PyQt&5 Documentation'),0, 0, self, 'pyqt5_documentation') |
|
2035 self.pyqt5DocAct.setStatusTip(self.trUtf8('Open PyQt5 Documentation')) |
|
2036 self.pyqt5DocAct.setWhatsThis(self.trUtf8( |
|
2037 """<b>PyQt5 Documentation</b>""" |
|
2038 """<p>Display the PyQt5 Documentation. Dependant upon your settings,""" |
|
2039 """ this will either show the help in Eric's internal help viewer,""" |
|
2040 """ or execute a web browser or Qt Assistant. </p>""" |
|
2041 )) |
|
2042 self.pyqt5DocAct.triggered[()].connect(self.__showPyQt5Doc) |
|
2043 self.actions.append(self.pyqt5DocAct) |
|
2044 except ImportError: |
|
2045 self.pyqt5DocAct = None |
2032 |
2046 |
2033 def __initPythonDocActions(self): |
2047 def __initPythonDocActions(self): |
2034 """ |
2048 """ |
2035 Private slot to initialize the actions to show the Python documentation. |
2049 Private slot to initialize the actions to show the Python documentation. |
2036 """ |
2050 """ |
2247 self.__menus["help"].addAction(self.pythonDocAct) |
2261 self.__menus["help"].addAction(self.pythonDocAct) |
2248 self.__menus["help"].addAction(self.python2DocAct) |
2262 self.__menus["help"].addAction(self.python2DocAct) |
2249 self.__menus["help"].addAction(self.qt4DocAct) |
2263 self.__menus["help"].addAction(self.qt4DocAct) |
2250 self.__menus["help"].addAction(self.qt5DocAct) |
2264 self.__menus["help"].addAction(self.qt5DocAct) |
2251 self.__menus["help"].addAction(self.pyqt4DocAct) |
2265 self.__menus["help"].addAction(self.pyqt4DocAct) |
|
2266 if self.pyqt5DocAct is not None: |
|
2267 self.__menus["help"].addAction(self.pyqt5DocAct) |
2252 if self.pysideDocAct is not None: |
2268 if self.pysideDocAct is not None: |
2253 self.__menus["help"].addAction(self.pysideDocAct) |
2269 self.__menus["help"].addAction(self.pysideDocAct) |
2254 self.__menus["help"].addSeparator() |
2270 self.__menus["help"].addSeparator() |
2255 self.__menus["help"].addAction(self.versionAct) |
2271 self.__menus["help"].addAction(self.versionAct) |
2256 self.__menus["help"].addSeparator() |
2272 self.__menus["help"].addSeparator() |
4456 if pyqt4DocDir.startswith("file://"): |
4472 if pyqt4DocDir.startswith("file://"): |
4457 pyqt4DocDir = pyqt4DocDir[7:] |
4473 pyqt4DocDir = pyqt4DocDir[7:] |
4458 if not os.path.splitext(pyqt4DocDir)[1]: |
4474 if not os.path.splitext(pyqt4DocDir)[1]: |
4459 possibleHomes = [\ |
4475 possibleHomes = [\ |
4460 Utilities.normjoinpath(pyqt4DocDir, 'index.html'), |
4476 Utilities.normjoinpath(pyqt4DocDir, 'index.html'), |
4461 Utilities.normjoinpath(pyqt4DocDir, 'pyqt4ref.html'), |
|
4462 Utilities.normjoinpath(pyqt4DocDir, 'classes.html'), |
4477 Utilities.normjoinpath(pyqt4DocDir, 'classes.html'), |
4463 ] |
4478 ] |
4464 for possibleHome in possibleHomes: |
4479 for possibleHome in possibleHomes: |
4465 if os.path.exists(possibleHome): |
4480 if os.path.exists(possibleHome): |
4466 home = possibleHome |
4481 home = possibleHome |
4480 home = "file:///" + Utilities.fromNativeSeparators(home) |
4495 home = "file:///" + Utilities.fromNativeSeparators(home) |
4481 else: |
4496 else: |
4482 home = "file://" + home |
4497 home = "file://" + home |
4483 else: |
4498 else: |
4484 home = pyqt4DocDir |
4499 home = pyqt4DocDir |
|
4500 |
|
4501 hvType = Preferences.getHelp("HelpViewerType") |
|
4502 if hvType == 1: |
|
4503 self.launchHelpViewer(home) |
|
4504 elif hvType == 2: |
|
4505 self.__assistant(home, version=4) |
|
4506 elif hvType == 3: |
|
4507 self.__webBrowser(home) |
|
4508 else: |
|
4509 self.__customViewer(home) |
|
4510 |
|
4511 def __showPyQt5Doc(self): |
|
4512 """ |
|
4513 Private slot to show the PyQt5 documentation. |
|
4514 """ |
|
4515 pyqt5DocDir = Preferences.getHelp("PyQt5DocDir") |
|
4516 if not pyqt5DocDir: |
|
4517 pyqt5DocDir = Utilities.getEnvironmentEntry("PYQT5DOCDIR", None) |
|
4518 |
|
4519 if not pyqt5DocDir: |
|
4520 E5MessageBox.warning(self, |
|
4521 self.trUtf8("Documentation"), |
|
4522 self.trUtf8("""<p>The PyQt5 documentation starting point""" |
|
4523 """ has not been configured.</p>""")) |
|
4524 return |
|
4525 |
|
4526 if not pyqt5DocDir.startswith("http://") and \ |
|
4527 not pyqt5DocDir.startswith("https://"): |
|
4528 home = "" |
|
4529 if pyqt5DocDir: |
|
4530 if pyqt5DocDir.startswith("file://"): |
|
4531 pyqt5DocDir = pyqt5DocDir[7:] |
|
4532 if not os.path.splitext(pyqt5DocDir)[1]: |
|
4533 possibleHomes = [\ |
|
4534 Utilities.normjoinpath(pyqt5DocDir, 'index.html'), |
|
4535 Utilities.normjoinpath(pyqt5DocDir, 'class_reference.html'), |
|
4536 ] |
|
4537 for possibleHome in possibleHomes: |
|
4538 if os.path.exists(possibleHome): |
|
4539 home = possibleHome |
|
4540 break |
|
4541 else: |
|
4542 home = pyqt5DocDir |
|
4543 |
|
4544 if not home or not os.path.exists(home): |
|
4545 E5MessageBox.warning(self, |
|
4546 self.trUtf8("Documentation Missing"), |
|
4547 self.trUtf8("""<p>The documentation starting point""" |
|
4548 """ "<b>{0}</b>" could not be found.</p>""")\ |
|
4549 .format(home)) |
|
4550 return |
|
4551 |
|
4552 if Utilities.isWindowsPlatform(): |
|
4553 home = "file:///" + Utilities.fromNativeSeparators(home) |
|
4554 else: |
|
4555 home = "file://" + home |
|
4556 else: |
|
4557 home = pyqt5DocDir |
4485 |
4558 |
4486 hvType = Preferences.getHelp("HelpViewerType") |
4559 hvType = Preferences.getHelp("HelpViewerType") |
4487 if hvType == 1: |
4560 if hvType == 1: |
4488 self.launchHelpViewer(home) |
4561 self.launchHelpViewer(home) |
4489 elif hvType == 2: |
4562 elif hvType == 2: |