UI/UserInterface.py

changeset 20
74944df40dfb
parent 18
3b1f5d872fd7
child 22
74b42c452d1e
equal deleted inserted replaced
19:3e024a7e465c 20:74944df40dfb
4298 else: 4298 else:
4299 pythonDocDir = Utilities.getEnvironmentEntry("PYTHONDOCDIR", 4299 pythonDocDir = Utilities.getEnvironmentEntry("PYTHONDOCDIR",
4300 '/usr/share/doc/packages/python/html') 4300 '/usr/share/doc/packages/python/html')
4301 if not pythonDocDir.startswith("http://") and \ 4301 if not pythonDocDir.startswith("http://") and \
4302 not pythonDocDir.startswith("https://"): 4302 not pythonDocDir.startswith("https://"):
4303 if pythonDocDir.startswith("file://"):
4304 pythonDocDir = pythonDocDir[7:]
4303 if not os.path.splitext(pythonDocDir)[1]: 4305 if not os.path.splitext(pythonDocDir)[1]:
4304 home = Utilities.normjoinpath(pythonDocDir, 'index.html') 4306 home = Utilities.normjoinpath(pythonDocDir, 'index.html')
4305 4307
4306 if Utilities.isWindowsPlatform() and not os.path.exists(home): 4308 if Utilities.isWindowsPlatform() and not os.path.exists(home):
4307 pyversion = sys.hexversion >> 16 4309 pyversion = sys.hexversion >> 16
4315 self.trUtf8("Documentation Missing"), 4317 self.trUtf8("Documentation Missing"),
4316 self.trUtf8("""<p>The documentation starting point""" 4318 self.trUtf8("""<p>The documentation starting point"""
4317 """ "<b>{0}</b>" could not be found.</p>""")\ 4319 """ "<b>{0}</b>" could not be found.</p>""")\
4318 .format(home)) 4320 .format(home))
4319 return 4321 return
4322
4323 if not home.endswith(".chm"):
4324 home = "file://" + home
4320 else: 4325 else:
4321 home = pythonDocDir 4326 home = pythonDocDir
4322 4327
4323 if home.endswith(".chm"): 4328 if home.endswith(".chm"):
4324 self.__chmViewer(home) 4329 self.__chmViewer(home)
4347 else: 4352 else:
4348 home = qt4DocDir 4353 home = qt4DocDir
4349 elif qt4DocDir.startswith("http://") or qt4DocDir.startswith("https://"): 4354 elif qt4DocDir.startswith("http://") or qt4DocDir.startswith("https://"):
4350 home = qt4DocDir 4355 home = qt4DocDir
4351 else: 4356 else:
4357 if qt4DocDir.startswith("file://"):
4358 qt4DocDir = qt4DocDir[7:]
4352 if not os.path.splitext(qt4DocDir)[1]: 4359 if not os.path.splitext(qt4DocDir)[1]:
4353 home = Utilities.normjoinpath(qt4DocDir, 'index.html') 4360 home = Utilities.normjoinpath(qt4DocDir, 'index.html')
4354 else: 4361 else:
4355 home = qt4DocDir 4362 home = qt4DocDir
4356 4363
4359 self.trUtf8("Documentation Missing"), 4366 self.trUtf8("Documentation Missing"),
4360 self.trUtf8("""<p>The documentation starting point""" 4367 self.trUtf8("""<p>The documentation starting point"""
4361 """ "<b>{0}</b>" could not be found.</p>""")\ 4368 """ "<b>{0}</b>" could not be found.</p>""")\
4362 .format(home)) 4369 .format(home))
4363 return 4370 return
4371
4372 home = "file://" + home
4364 4373
4365 hvType = Preferences.getHelp("HelpViewerType") 4374 hvType = Preferences.getHelp("HelpViewerType")
4366 if hvType == 1: 4375 if hvType == 1:
4367 self.launchHelpViewer(home) 4376 self.launchHelpViewer(home)
4368 elif hvType == 2: 4377 elif hvType == 2:
4389 4398
4390 if not pyqt4DocDir.startswith("http://") and \ 4399 if not pyqt4DocDir.startswith("http://") and \
4391 not pyqt4DocDir.startswith("https://"): 4400 not pyqt4DocDir.startswith("https://"):
4392 home = "" 4401 home = ""
4393 if pyqt4DocDir: 4402 if pyqt4DocDir:
4403 if pyqt4DocDir.startswith("file://"):
4404 pyqt4DocDir = pyqt4DocDir[7:]
4394 if not os.path.splitext(pyqt4DocDir)[1]: 4405 if not os.path.splitext(pyqt4DocDir)[1]:
4395 possibleHomes = [\ 4406 possibleHomes = [\
4396 Utilities.normjoinpath(pyqt4DocDir, 'index.html'), 4407 Utilities.normjoinpath(pyqt4DocDir, 'index.html'),
4397 Utilities.normjoinpath(pyqt4DocDir, 'pyqt4ref.html'), 4408 Utilities.normjoinpath(pyqt4DocDir, 'pyqt4ref.html'),
4398 Utilities.normjoinpath(pyqt4DocDir, 'classes.html'), 4409 Utilities.normjoinpath(pyqt4DocDir, 'classes.html'),
4401 if os.path.exists(possibleHome): 4412 if os.path.exists(possibleHome):
4402 home = possibleHome 4413 home = possibleHome
4403 break 4414 break
4404 else: 4415 else:
4405 home = pyqt4DocDir 4416 home = pyqt4DocDir
4417
4418 if home:
4419 home = "file://" + home
4406 4420
4407 if not home or not os.path.exists(home): 4421 if not home or not os.path.exists(home):
4408 QMessageBox.warning(None, 4422 QMessageBox.warning(None,
4409 self.trUtf8("Documentation Missing"), 4423 self.trUtf8("Documentation Missing"),
4410 self.trUtf8("""<p>The documentation starting point""" 4424 self.trUtf8("""<p>The documentation starting point"""
4439 self.trUtf8("""<p>The documentation starting point""" 4453 self.trUtf8("""<p>The documentation starting point"""
4440 """ "<b>{0}</b>" could not be found.</p>""")\ 4454 """ "<b>{0}</b>" could not be found.</p>""")\
4441 .format(home)) 4455 .format(home))
4442 return 4456 return
4443 4457
4458 ## home = "file://" + home
4459
4444 hvType = Preferences.getHelp("HelpViewerType") 4460 hvType = Preferences.getHelp("HelpViewerType")
4445 if hvType == 1: 4461 if hvType == 1:
4446 self.launchHelpViewer(home) 4462 self.launchHelpViewer(home)
4447 elif hvType == 2: 4463 elif hvType == 2:
4448 self.__assistant(home, version = 4) 4464 self.__assistant(home, version = 4)
4466 """ has not been configured.</p>""")) 4482 """ has not been configured.</p>"""))
4467 return 4483 return
4468 4484
4469 if not pysideDocDir.startswith("http://") and \ 4485 if not pysideDocDir.startswith("http://") and \
4470 not pysideDocDir.startswith("https://"): 4486 not pysideDocDir.startswith("https://"):
4487 if pysideDocDir.startswith("file://"):
4488 pysideDocDir = pysideDocDir[7:]
4471 if not os.path.splitext(pysideDocDir)[1]: 4489 if not os.path.splitext(pysideDocDir)[1]:
4472 home = Utilities.normjoinpath(pysideDocDir, 'index.html') 4490 home = Utilities.normjoinpath(pysideDocDir, 'index.html')
4473 else: 4491 else:
4474 home = pysideDocDir 4492 home = pysideDocDir
4475 if not os.path.exists(home): 4493 if not os.path.exists(home):
4477 self.trUtf8("Documentation Missing"), 4495 self.trUtf8("Documentation Missing"),
4478 self.trUtf8("""<p>The documentation starting point""" 4496 self.trUtf8("""<p>The documentation starting point"""
4479 """ "<b>{0}</b>" could not be found.</p>""")\ 4497 """ "<b>{0}</b>" could not be found.</p>""")\
4480 .format(home)) 4498 .format(home))
4481 return 4499 return
4500
4501 home = "file://" + home
4482 else: 4502 else:
4483 home = pysideDocDir 4503 home = pysideDocDir
4484 4504
4485 hvType = Preferences.getHelp("HelpViewerType") 4505 hvType = Preferences.getHelp("HelpViewerType")
4486 if hvType == 1: 4506 if hvType == 1:

eric ide

mercurial