eric6/Preferences/ConfigurationDialog.py

branch
maintenance
changeset 7286
7eb04391adf7
parent 7214
f434af227a41
parent 7263
c1af2e327675
child 7362
028bf21bb5a2
diff -r babe80d84a3e -r 7eb04391adf7 eric6/Preferences/ConfigurationDialog.py
--- a/eric6/Preferences/ConfigurationDialog.py	Mon Sep 09 18:52:08 2019 +0200
+++ b/eric6/Preferences/ConfigurationDialog.py	Thu Oct 03 11:12:10 2019 +0200
@@ -7,24 +7,24 @@
 Module implementing a dialog for the configuration of eric6.
 """
 
-from __future__ import unicode_literals
 
 import os
 import types
 
-from PyQt5.QtCore import pyqtSignal, pyqtSlot, PYQT_VERSION, Qt, QMetaObject, \
-    QRect
+from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QMetaObject, QRect
 from PyQt5.QtGui import QPixmap
-from PyQt5.QtWidgets import QSizePolicy, QSpacerItem, QWidget, QTreeWidget, \
-    QStackedWidget, QDialog, QSplitter, QScrollArea, QApplication, \
-    QDialogButtonBox, QFrame, QVBoxLayout, QTreeWidgetItem, QLabel
+from PyQt5.QtWidgets import (
+    QSizePolicy, QSpacerItem, QWidget, QTreeWidget, QStackedWidget, QDialog,
+    QSplitter, QScrollArea, QApplication, QDialogButtonBox, QFrame,
+    QVBoxLayout, QTreeWidgetItem, QLabel
+)
 
 from E5Gui.E5Application import e5App
 from E5Gui.E5LineEdit import E5ClearableLineEdit
 from E5Gui import E5MessageBox
 from E5Gui.E5MainWindow import E5MainWindow
 
-from Globals import isMacPlatform, qVersionTuple, getWebBrowserSupport
+from Globals import isMacPlatform, getWebBrowserSupport
 
 import Preferences
 
@@ -358,96 +358,24 @@
                     "webBrowserPage":
                     [self.tr("eric6 Web Browser"), "ericWeb.png",
                      "WebBrowserPage", "0webBrowserPage", None],
-                    "helpFlashCookieManagerPage":
+                    "webBrowserFlashCookieManagerPage":
                     [self.tr("Flash Cookie Manager"),
                      "flashCookie16.png",
-                     "HelpFlashCookieManagerPage", "0webBrowserPage", None],
+                     "WebBrowserFlashCookieManagerPage", "0webBrowserPage",
+                     None],
                     "webBrowserVirusTotalPage":
                     [self.tr("VirusTotal Interface"), "virustotal.png",
                      "WebBrowserVirusTotalPage", "0webBrowserPage", None],
+                    "webBrowserSpellCheckingPage":
+                    [self.tr("Spell checking"),
+                     "preferences-spellchecking.png",
+                     "WebBrowserSpellCheckingPage", "0webBrowserPage",
+                     None],
                 })
-                if qVersionTuple() >= (5, 8, 0) and PYQT_VERSION >= 0x50800:
-                    self.configItems.update({
-                        "webBrowserSpellCheckingPage":
-                        [self.tr("Spell checking"),
-                         "preferences-spellchecking.png",
-                         "WebBrowserSpellCheckingPage", "0webBrowserPage",
-                         None],
-                    })
-            else:
-                try:
-                    from PyQt5 import QtWebKit      # __IGNORE_WARNING__
-                    self.configItems.update({
-                        "0helpBrowserPage":
-                        [self.tr("Web Browser"), "ericWeb.png",
-                         None, None, None],
-                        "helpAppearancePage":
-                        [self.tr("Appearance"), "preferences-styles.png",
-                         "HelpAppearancePage", "0helpBrowserPage", None],
-                        "helpWebBrowserPage":
-                        [self.tr("eric6 Web Browser"), "ericWeb.png",
-                         "HelpWebBrowserPage", "0helpBrowserPage", None],
-                        "helpFlashCookieManagerPage":
-                        [self.tr("Flash Cookie Manager"),
-                         "flashCookie16.png",
-                         "HelpFlashCookieManagerPage", "0helpBrowserPage",
-                         None],
-                        "helpVirusTotalPage":
-                        [self.tr("VirusTotal Interface"), "virustotal.png",
-                         "HelpVirusTotalPage", "0helpBrowserPage", None],
-                    })
-                except ImportError:
-                    pass
             
             self.configItems.update(
                 e5App().getObject("PluginManager").getPluginConfigData())
         
-        elif displayMode == ConfigurationWidget.HelpBrowserMode:
-            self.configItems = {
-                # key : [display string, pixmap name, dialog module name or
-                #        page creation function, parent key,
-                #        reference to configuration page (must always be last)]
-                # The dialog module must have the module function 'create' to
-                # create the configuration page. This must have the method
-                # 'save' to save the settings.
-                "interfacePage":
-                [self.tr("Interface"), "preferences-interface.png",
-                 "HelpInterfacePage", None, None],
-                "networkPage":
-                [self.tr("Network"), "preferences-network.png",
-                 "NetworkPage", None, None],
-                "printerPage":
-                [self.tr("Printer"), "preferences-printer.png",
-                 "PrinterPage", None, None],
-                "securityPage":
-                [self.tr("Security"), "preferences-security.png",
-                 "SecurityPage", None, None],
-                
-                "helpDocumentationPage":
-                [self.tr("Help Documentation"),
-                 "preferences-helpdocumentation.png",
-                 "HelpDocumentationPage", None, None],
-            }
-            try:
-                from PyQt5 import QtWebKit      # __IGNORE_WARNING__
-                self.configItems.update({
-                    "helpAppearancePage":
-                    [self.tr("Appearance"), "preferences-styles.png",
-                     "HelpAppearancePage", None, None],
-                    "helpFlashCookieManagerPage":
-                    [self.tr("Flash Cookie Manager"),
-                     "flashCookie16.png",
-                     "HelpFlashCookieManagerPage", None, None],
-                    "helpVirusTotalPage":
-                    [self.tr("VirusTotal Interface"), "virustotal.png",
-                     "HelpVirusTotalPage", None, None],
-                    "helpWebBrowserPage":
-                    [self.tr("eric6 Web Browser"), "ericWeb.png",
-                     "HelpWebBrowserPage", None, None],
-                })
-            except ImportError:
-                pass
-        
         elif displayMode == ConfigurationWidget.WebBrowserMode:
             self.configItems = {
                 # key : [display string, pixmap name, dialog module name or
@@ -481,22 +409,19 @@
                 [self.tr("eric6 Web Browser"), "ericWeb.png",
                  "WebBrowserPage", None, None],
                 
-                "helpFlashCookieManagerPage":
+                "webBrowserFlashCookieManagerPage":
                 [self.tr("Flash Cookie Manager"),
                  "flashCookie16.png",
-                 "HelpFlashCookieManagerPage", None, None],
+                 "WebBrowserFlashCookieManagerPage", None, None],
                 "webBrowserVirusTotalPage":
                 [self.tr("VirusTotal Interface"), "virustotal.png",
                  "WebBrowserVirusTotalPage", None, None],
+                
+                "webBrowserSpellCheckingPage":
+                [self.tr("Spell checking"),
+                 "preferences-spellchecking.png",
+                 "WebBrowserSpellCheckingPage", None, None],
             }
-            
-            if qVersionTuple() >= (5, 8, 0) and PYQT_VERSION >= 0x50800:
-                self.configItems.update({
-                    "webBrowserSpellCheckingPage":
-                    [self.tr("Spell checking"),
-                     "preferences-spellchecking.png",
-                     "WebBrowserSpellCheckingPage", None, None],
-                })
         
         elif displayMode == ConfigurationWidget.TrayStarterMode:
             self.configItems = {
@@ -652,8 +577,10 @@
             QDialogButtonBox.Apply | QDialogButtonBox.Cancel |
             QDialogButtonBox.Ok | QDialogButtonBox.Reset)
         self.buttonBox.setObjectName("buttonBox")
-        if not self.fromEric and \
-                self.displayMode == ConfigurationWidget.DefaultMode:
+        if (
+            not self.fromEric and
+            self.displayMode == ConfigurationWidget.DefaultMode
+        ):
             self.buttonBox.button(QDialogButtonBox.Apply).hide()
         self.buttonBox.button(QDialogButtonBox.Apply).setEnabled(False)
         self.buttonBox.button(QDialogButtonBox.Reset).setEnabled(False)
@@ -696,8 +623,11 @@
         for index in range(parent.childCount()):
             itm = parent.child(index)
             if itm.childCount() > 0:
-                enable = self.__searchChildItems(itm, text) or \
-                    text == "" or text in itm.text(0).lower()
+                enable = (
+                    self.__searchChildItems(itm, text) or
+                    text == "" or
+                    text in itm.text(0).lower()
+                )
             else:
                 enable = text == "" or text in itm.text(0).lower()
             if enable:
@@ -711,8 +641,9 @@
         Private method to initialize the dictionary of preferences lexers.
         """
         import QScintilla.Lexers
-        from .PreferencesLexer import PreferencesLexer, \
-            PreferencesLexerLanguageError
+        from .PreferencesLexer import (
+            PreferencesLexer, PreferencesLexerLanguageError
+        )
         
         self.lexers = {}
         for language in QScintilla.Lexers.getSupportedLanguages():
@@ -957,8 +888,10 @@
         @return flag indicating the use of QtWebEngine
         @rtype bool
         """
-        return self.__webEngine or \
+        return (
+            self.__webEngine or
             self.displayMode == ConfigurationWidget.WebBrowserMode
+        )
 
 
 class ConfigurationDialog(QDialog):

eric ide

mercurial