Helpviewer/HelpBrowserWV.py

branch
6_1_x
changeset 5197
468264f9de9a
parent 4740
b5cff5645b36
equal deleted inserted replaced
5188:48af75c98cfe 5197:468264f9de9a
11 from __future__ import unicode_literals 11 from __future__ import unicode_literals
12 try: 12 try:
13 str = unicode 13 str = unicode
14 except NameError: 14 except NameError:
15 pass 15 pass
16
17 import os
16 18
17 from PyQt5.QtCore import pyqtSlot, pyqtSignal, QObject, QT_TRANSLATE_NOOP, \ 19 from PyQt5.QtCore import pyqtSlot, pyqtSignal, QObject, QT_TRANSLATE_NOOP, \
18 QUrl, QBuffer, QIODevice, QFileInfo, Qt, QTimer, QEvent, \ 20 QUrl, QBuffer, QIODevice, QFileInfo, Qt, QTimer, QEvent, \
19 QRect, QFile, QPoint, QByteArray, qVersion 21 QRect, QFile, QPoint, QByteArray, qVersion
20 from PyQt5.QtGui import QDesktopServices, QClipboard, QMouseEvent, QColor, \ 22 from PyQt5.QtGui import QDesktopServices, QClipboard, QMouseEvent, QColor, \
36 import Helpviewer 38 import Helpviewer
37 39
38 import Preferences 40 import Preferences
39 import UI.PixmapCache 41 import UI.PixmapCache
40 import Globals 42 import Globals
43 import Utilities
41 44
42 try: 45 try:
43 from PyQt5.QtNetwork import QSslCertificate 46 from PyQt5.QtNetwork import QSslCertificate
44 SSL_AVAILABLE = True 47 SSL_AVAILABLE = True
45 except ImportError: 48 except ImportError:
898 self.mw.newTab(name) 901 self.mw.newTab(name)
899 self.ctrlPressed = False 902 self.ctrlPressed = False
900 return 903 return
901 904
902 if not name.scheme(): 905 if not name.scheme():
903 name.setUrl(Preferences.getHelp("DefaultScheme") + name.toString()) 906 if not os.path.exists(name.toString()):
907 name.setScheme(Preferences.getWebBrowser("DefaultScheme"))
908 else:
909 if Utilities.isWindowsPlatform():
910 name.setUrl("file:///" + Utilities.fromNativeSeparators(
911 name.toString()))
912 else:
913 name.setUrl("file://" + name.toString())
904 914
905 if len(name.scheme()) == 1 or \ 915 if len(name.scheme()) == 1 or \
906 name.scheme() == "file": 916 name.scheme() == "file":
907 # name is a local file 917 # name is a local file
908 if name.scheme() and len(name.scheme()) == 1: 918 if name.scheme() and len(name.scheme()) == 1:

eric ide

mercurial