--- a/Preferences/__init__.py Wed Dec 23 19:08:09 2015 +0100 +++ b/Preferences/__init__.py Fri Dec 25 14:03:57 2015 +0100 @@ -33,7 +33,10 @@ from PyQt5.QtGui import QColor, QFont, QPalette from PyQt5.QtWidgets import QInputDialog, QApplication from PyQt5.QtNetwork import QNetworkRequest -from PyQt5.QtWebKit import QWebSettings +try: + from PyQt5.QtWebKit import QWebSettings +except ImportError: + QWebSettings = None from PyQt5.Qsci import QsciScintilla, QsciLexerPython from E5Gui import E5FileDialog @@ -805,7 +808,6 @@ # defaults for the help settings helpDefaults = { - "HelpViewerType": 1, # this corresponds with the radio button id "CustomViewer": "", "PythonDocDir": "", "Python2DocDir": "", @@ -907,12 +909,19 @@ "FlashCookiesBlacklist": [], "FlashCookiesDataPath": flashDataPathForOS(), } + if QWebSettings: + helpDefaults["HelpViewerType"] = 1, # eric browser + else: + helpDefaults["HelpViewerType"] = 2, # Qt Assistant @classmethod def initWebSettingsDefaults(cls): """ Class method to initialize the web settings related defaults. """ + if QWebSettings is None: + return + websettings = QWebSettings.globalSettings() fontFamily = websettings.fontFamily(QWebSettings.StandardFont) fontSize = websettings.fontSize(QWebSettings.DefaultFontSize) @@ -2402,7 +2411,14 @@ from Utilities.crypto import pwConvert return pwConvert(prefClass.settings.value( "Help/" + key, prefClass.helpDefaults[key]), encode=False) - elif key in ["HelpViewerType", "DiskCacheSize", "AcceptCookies", + elif key == "HelpViewerType": + # special treatment to adjust for missing QtWebKit + value = int(prefClass.settings.value( + "Help/" + key, prefClass.helpDefaults[key])) + if QWebSettings is None: + value = prefClass.helpDefaults[key] + return value + elif key in ["DiskCacheSize", "AcceptCookies", "KeepCookiesUntil", "StartupBehavior", "HistoryLimit", "OfflineStorageDatabaseQuota", "OfflineWebApplicationCacheQuota", "CachePolicy", @@ -3096,3 +3112,6 @@ initPreferences() initRecentSettings() + +# +# eflag: noqa = M613