UI/UserInterface.py

changeset 2298
fa4f79c34e0c
parent 2297
e8a46f81517c
child 2302
f29e9405c851
equal deleted inserted replaced
2297:e8a46f81517c 2298:fa4f79c34e0c
2014 """ a web browser or Qt Assistant. </p>""" 2014 """ a web browser or Qt Assistant. </p>"""
2015 )) 2015 ))
2016 self.qt4DocAct.triggered[()].connect(self.__showQt4Doc) 2016 self.qt4DocAct.triggered[()].connect(self.__showQt4Doc)
2017 self.actions.append(self.qt4DocAct) 2017 self.actions.append(self.qt4DocAct)
2018 2018
2019 self.qt5DocAct = E5Action(self.trUtf8('Qt5 Documentation'),
2020 self.trUtf8('Qt&5 Documentation'), 0, 0, self, 'qt5_documentation')
2021 self.qt5DocAct.setStatusTip(self.trUtf8('Open Qt5 Documentation'))
2022 self.qt5DocAct.setWhatsThis(self.trUtf8(
2023 """<b>Qt5 Documentation</b>"""
2024 """<p>Display the Qt5 Documentation. Dependant upon your settings, this"""
2025 """ will either show the help in Eric's internal help viewer, or execute"""
2026 """ a web browser or Qt Assistant. </p>"""
2027 ))
2028 self.qt5DocAct.triggered[()].connect(self.__showQt5Doc)
2029 self.actions.append(self.qt5DocAct)
2030
2019 self.pyqt4DocAct = E5Action(self.trUtf8('PyQt4 Documentation'), 2031 self.pyqt4DocAct = E5Action(self.trUtf8('PyQt4 Documentation'),
2020 self.trUtf8('P&yQt4 Documentation'), 0, 0, self, 'pyqt4_documentation') 2032 self.trUtf8('P&yQt4 Documentation'), 0, 0, self, 'pyqt4_documentation')
2021 self.pyqt4DocAct.setStatusTip(self.trUtf8('Open PyQt4 Documentation')) 2033 self.pyqt4DocAct.setStatusTip(self.trUtf8('Open PyQt4 Documentation'))
2022 self.pyqt4DocAct.setWhatsThis(self.trUtf8( 2034 self.pyqt4DocAct.setWhatsThis(self.trUtf8(
2023 """<b>PyQt4 Documentation</b>""" 2035 """<b>PyQt4 Documentation</b>"""
2238 self.__menus["help"].addSeparator() 2250 self.__menus["help"].addSeparator()
2239 self.__menus["help"].addAction(self.ericDocAct) 2251 self.__menus["help"].addAction(self.ericDocAct)
2240 self.__menus["help"].addAction(self.pythonDocAct) 2252 self.__menus["help"].addAction(self.pythonDocAct)
2241 self.__menus["help"].addAction(self.python2DocAct) 2253 self.__menus["help"].addAction(self.python2DocAct)
2242 self.__menus["help"].addAction(self.qt4DocAct) 2254 self.__menus["help"].addAction(self.qt4DocAct)
2255 self.__menus["help"].addAction(self.qt5DocAct)
2243 self.__menus["help"].addAction(self.pyqt4DocAct) 2256 self.__menus["help"].addAction(self.pyqt4DocAct)
2244 if self.pysideDocAct is not None: 2257 if self.pysideDocAct is not None:
2245 self.__menus["help"].addAction(self.pysideDocAct) 2258 self.__menus["help"].addAction(self.pysideDocAct)
2246 self.__menus["help"].addSeparator() 2259 self.__menus["help"].addSeparator()
2247 self.__menus["help"].addAction(self.versionAct) 2260 self.__menus["help"].addAction(self.versionAct)
4356 4369
4357 def __showQt4Doc(self): 4370 def __showQt4Doc(self):
4358 """ 4371 """
4359 Private slot to show the Qt4 documentation. 4372 Private slot to show the Qt4 documentation.
4360 """ 4373 """
4361 qt4DocDir = Preferences.getHelp("Qt4DocDir") 4374 self.__showQtDoc(4)
4362 if not qt4DocDir: 4375
4363 qt4DocDir = Utilities.getEnvironmentEntry("QT4DOCDIR", "") 4376 def __showQt5Doc(self):
4364 if not qt4DocDir: 4377 """
4365 qt4DocDir = os.path.join(Preferences.getQt4DocDir(), "html") 4378 Private slot to show the Qt5 documentation.
4366 4379 """
4367 if qt4DocDir.startswith("qthelp://"): 4380 self.__showQtDoc(5)
4368 if not os.path.splitext(qt4DocDir)[1]: 4381
4369 home = qt4DocDir + "/index.html" 4382 def __showQtDoc(self, version):
4383 """
4384 Private method to show the Qt documentation.
4385
4386 @param version Qt version to show documentation for (integer)
4387 """
4388 assert version in [4, 5]
4389 ## qt4DocDir = Preferences.getHelp("Qt4DocDir")
4390 ## if not qt4DocDir:
4391 ## qt4DocDir = Utilities.getEnvironmentEntry("QT4DOCDIR", "")
4392 ## if not qt4DocDir:
4393 ## qt4DocDir = os.path.join(Preferences.getQt4DocDir(), "html")
4394 if version == 4:
4395 qtDocDir = Preferences.getQt4DocDir()
4396 elif version == 5:
4397 qtDocDir = Preferences.getQt5DocDir()
4398
4399 if qtDocDir.startswith("qthelp://"):
4400 if not os.path.splitext(qtDocDir)[1]:
4401 home = qtDocDir + "/index.html"
4370 else: 4402 else:
4371 home = qt4DocDir 4403 home = qtDocDir
4372 elif qt4DocDir.startswith("http://") or qt4DocDir.startswith("https://"): 4404 elif qtDocDir.startswith("http://") or qtDocDir.startswith("https://"):
4373 home = qt4DocDir 4405 home = qtDocDir
4374 else: 4406 else:
4375 if qt4DocDir.startswith("file://"): 4407 if qtDocDir.startswith("file://"):
4376 qt4DocDir = qt4DocDir[7:] 4408 qtDocDir = qtDocDir[7:]
4377 if not os.path.splitext(qt4DocDir)[1]: 4409 if not os.path.splitext(qtDocDir)[1]:
4378 home = Utilities.normjoinpath(qt4DocDir, 'index.html') 4410 home = Utilities.normjoinpath(qtDocDir, 'index.html')
4379 else: 4411 else:
4380 home = qt4DocDir 4412 home = qtDocDir
4381 4413
4382 if not os.path.exists(home): 4414 if not os.path.exists(home):
4383 E5MessageBox.warning(self, 4415 E5MessageBox.warning(self,
4384 self.trUtf8("Documentation Missing"), 4416 self.trUtf8("Documentation Missing"),
4385 self.trUtf8("""<p>The documentation starting point""" 4417 self.trUtf8("""<p>The documentation starting point"""

eric ide

mercurial