eric6/Preferences/__init__.py

branch
maintenance
changeset 8043
0acf98cd089a
parent 7924
8a96736d465e
parent 8038
73ec029d4107
child 8142
43248bafe9b2
--- a/eric6/Preferences/__init__.py	Sun Jan 17 13:53:08 2021 +0100
+++ b/eric6/Preferences/__init__.py	Mon Feb 01 10:38:16 2021 +0100
@@ -78,7 +78,6 @@
         "RecentNumber": 9,
         # max. number of file names to be remembered for the add breakpoint
         # dialog
-        "SuppressClientExit": False,
         "BreakAlways": False,
         "ShowExceptionInShell": True,
         "Python3VirtualEnv": "",
@@ -105,7 +104,9 @@
         "BgColorChanged": QColor("#2870FF66"),
         "AllowedHosts": ["127.0.0.1", "::1%0"],
         # space separated list of Python3 extensions
-        "Python3Extensions": ".py .pyw .py3 .pyw3"
+        "Python3Extensions": ".py .pyw .py3 .pyw3",
+        # Global Multiprocess Debugging Support
+        "MultiProcessEnabled": True,
     }
     
     # defaults for the UI settings
@@ -188,7 +189,6 @@
         # 2 = daily
         # 3 = weekly
         # 4 = monthly
-        "DynamicOnlineCheck": True,
         "UseProxy": False,
         "UseSystemProxy": True,
         "UseHttpProxyForAll": False,
@@ -233,10 +233,13 @@
                                             # 3 = QtFatalMsg
         
         "LogStdErrColour": QColor(Qt.red),
-        "NotificationsEnabled": True,
         "NotificationTimeout": 5,       # time in seconds the notification
                                         # is shown
         "NotificationPosition": QPoint(10, 10),
+        "NotificationWarningForeground": "#606000",
+        "NotificationWarningBackground": "#ffffd0",
+        "NotificationCriticalForeground": "#600000",
+        "NotificationCriticalBackground": "#ffd0d0",
         "TextMimeTypes": [
             "application/bookmarks.xbel",
             "application/x-xbel",
@@ -499,6 +502,9 @@
         "SourceOutlineStepSize": 50,
         "SourceOutlineShowCoding": True,
         
+        "DocstringType": "ericdoc",
+        "DocstringAutoGenerate": True,
+        
         # All (most) lexers
         "AllFoldCompact": True,
         
@@ -820,6 +826,19 @@
             InterfacesBrowserFlag |
             OthersBrowserFlag |
             ProtocolsBrowserFlag),
+        "PyQt6": (
+            SourcesBrowserFlag |
+            FormsBrowserFlag |
+            TranslationsBrowserFlag |
+            InterfacesBrowserFlag |
+            OthersBrowserFlag |
+            ProtocolsBrowserFlag),
+        "PyQt6C": (
+            SourcesBrowserFlag |
+            TranslationsBrowserFlag |
+            InterfacesBrowserFlag |
+            OthersBrowserFlag |
+            ProtocolsBrowserFlag),
         "E6Plugin": (
             SourcesBrowserFlag |
             FormsBrowserFlag |
@@ -853,6 +872,21 @@
             InterfacesBrowserFlag |
             OthersBrowserFlag |
             ProtocolsBrowserFlag),
+        "PySide6": (
+            SourcesBrowserFlag |
+            FormsBrowserFlag |
+            ResourcesBrowserFlag |
+            TranslationsBrowserFlag |
+            InterfacesBrowserFlag |
+            OthersBrowserFlag |
+            ProtocolsBrowserFlag),
+        "PySide6C": (
+            SourcesBrowserFlag |
+            ResourcesBrowserFlag |
+            TranslationsBrowserFlag |
+            InterfacesBrowserFlag |
+            OthersBrowserFlag |
+            ProtocolsBrowserFlag),
     }
     
     # defaults for the project browser colour settings
@@ -872,8 +906,11 @@
         "CustomViewer": "",
         "PythonDocDir": "",
         "Qt5DocDir": "",
+        "Qt6DocDir": "",
         "PyQt5DocDir": "",
+        "PyQt6DocDir": "",
         "PySide2DocDir": "",
+        "PySide6DocDir": "",
         "EricDocDir": "",
     }
     
@@ -911,8 +948,6 @@
         "ImageSearchEngine": "Google",
         "RssFeeds": [],
         "ShowPreview": True,
-        "WebInspectorPort": 42024,
-        "WebInspectorEnabled": False,
         "DiskCacheEnabled": True,
         "DiskCacheSize": 50,        # 50 MB
         "SslExceptionsDB": "{}",    # empty JSON dictionary
@@ -1052,7 +1087,6 @@
                 QWebEngineSettings.MinimumFontSize),
             "MinimumLogicalFontSize": webEngineSettings.fontSize(
                 QWebEngineSettings.MinimumLogicalFontSize),
-            
             "AutoLoadImages": webEngineSettings.testAttribute(
                 QWebEngineSettings.AutoLoadImages),
             "JavaScriptEnabled": webEngineSettings.testAttribute(
@@ -1082,78 +1116,40 @@
                 QWebEngineSettings.ErrorPageEnabled),
             "FullScreenSupportEnabled": webEngineSettings.testAttribute(
                 QWebEngineSettings.FullScreenSupportEnabled),
+            "PictographFontFamily": webEngineSettings.fontFamily(
+                QWebEngineSettings.PictographFont),
+            "ScreenCaptureEnabled": webEngineSettings.testAttribute(
+                QWebEngineSettings.ScreenCaptureEnabled),
+            "WebGLEnabled": webEngineSettings.testAttribute(
+                QWebEngineSettings.WebGLEnabled),
+            "FocusOnNavigationEnabled": webEngineSettings.testAttribute(
+                QWebEngineSettings.FocusOnNavigationEnabled),
+            "PrintElementBackgrounds": webEngineSettings.testAttribute(
+                QWebEngineSettings.PrintElementBackgrounds),
+            "AllowRunningInsecureContent": webEngineSettings.testAttribute(
+                QWebEngineSettings.AllowRunningInsecureContent),
+            "AllowGeolocationOnInsecureOrigins":
+                webEngineSettings.testAttribute(
+                    QWebEngineSettings.AllowGeolocationOnInsecureOrigins),
+            "AllowWindowActivationFromJavaScript":
+                webEngineSettings.testAttribute(
+                    QWebEngineSettings.AllowWindowActivationFromJavaScript),
+            "ShowScrollBars": webEngineSettings.testAttribute(
+                QWebEngineSettings.ShowScrollBars),
+            "PlaybackRequiresUserGesture":
+                webEngineSettings.testAttribute(
+                    QWebEngineSettings.PlaybackRequiresUserGesture),
+            "JavaScriptCanPaste":
+                webEngineSettings.testAttribute(
+                    QWebEngineSettings.JavascriptCanPaste),
+            "WebRTCPublicInterfacesOnly":
+                webEngineSettings.testAttribute(
+                    QWebEngineSettings.WebRTCPublicInterfacesOnly),
+            "DnsPrefetchEnabled":
+                webEngineSettings.testAttribute(
+                    QWebEngineSettings.DnsPrefetchEnabled),
         })
         try:
-            # Qt 5.7+
-            cls.webBrowserDefaults.update({
-                "PictographFontFamily": webEngineSettings.fontFamily(
-                    QWebEngineSettings.PictographFont),
-                
-                "ScreenCaptureEnabled": webEngineSettings.testAttribute(
-                    QWebEngineSettings.ScreenCaptureEnabled),
-                "WebGLEnabled": webEngineSettings.testAttribute(
-                    QWebEngineSettings.WebGLEnabled),
-            })
-        except AttributeError:
-            pass
-        try:
-            # Qt 5.8+
-            cls.webBrowserDefaults.update({
-                "FocusOnNavigationEnabled": webEngineSettings.testAttribute(
-                    QWebEngineSettings.FocusOnNavigationEnabled),
-                "PrintElementBackgrounds": webEngineSettings.testAttribute(
-                    QWebEngineSettings.PrintElementBackgrounds),
-                "AllowRunningInsecureContent": webEngineSettings.testAttribute(
-                    QWebEngineSettings.AllowRunningInsecureContent),
-            })
-        except AttributeError:
-            pass
-        try:
-            # Qt 5.9+
-            cls.webBrowserDefaults.update({
-                "AllowGeolocationOnInsecureOrigins":
-                    webEngineSettings.testAttribute(
-                        QWebEngineSettings.AllowGeolocationOnInsecureOrigins),
-            })
-        except AttributeError:
-            pass
-        try:
-            # Qt 5.10+
-            cls.webBrowserDefaults.update({
-                "AllowWindowActivationFromJavaScript":
-                    webEngineSettings.testAttribute(
-                        QWebEngineSettings.AllowWindowActivationFromJavaScript
-                    ),
-                "ShowScrollBars": webEngineSettings.testAttribute(
-                    QWebEngineSettings.ShowScrollBars),
-            })
-        except AttributeError:
-            pass
-        try:
-            # Qt 5.11+
-            cls.webBrowserDefaults.update({
-                "PlaybackRequiresUserGesture":
-                    webEngineSettings.testAttribute(
-                        QWebEngineSettings.PlaybackRequiresUserGesture),
-                "JavaScriptCanPaste":
-                    webEngineSettings.testAttribute(
-                        QWebEngineSettings.JavascriptCanPaste),
-                "WebRTCPublicInterfacesOnly":
-                    webEngineSettings.testAttribute(
-                        QWebEngineSettings.WebRTCPublicInterfacesOnly),
-            })
-        except AttributeError:
-            pass
-        try:
-            # Qt 5.12+
-            cls.webBrowserDefaults.update({
-                "DnsPrefetchEnabled":
-                    webEngineSettings.testAttribute(
-                        QWebEngineSettings.DnsPrefetchEnabled),
-            })
-        except AttributeError:
-            pass
-        try:
             # Qt 5.13
             cls.webBrowserDefaults.update({
                 "PdfViewerEnabled":
@@ -1201,9 +1197,18 @@
         "PyuicIndent": 4,
         "PyuicFromImports": False,
         "PyuicExecute": True,
+        "PyQtVenvName": "",
         "PyQtToolsDir": "",
+        "Pyuic6Indent": 4,
+        "Pyuic6Execute": True,
+        "PyQt6VenvName": "",
+        "PyQt6ToolsDir": "",
         "PySide2FromImports": False,
+        "PySide2VenvName": "",
         "PySide2ToolsDir": "",
+        "PySide6FromImports": False,
+        "PySide6VenvName": "",
+        "PySide6ToolsDir": "",
     }
     
     # defaults for corba related stuff
@@ -1450,19 +1455,26 @@
         "MpyCrossCompiler": "",         # path of the mpy-cross compiler
         "DfuUtilPath": "",              # path of the dfu-util flashing tool
         "IgnoredUnknownDevices": "[]",  # empty list encoded as JSON
-        # documentation URLs
+        # MicroPython URLs
         "MicroPythonDocuUrl":
             "https://docs.micropython.org/en/latest/",
+        "MicroPythonFirmwareUrl":
+            "http://micropython.org/download/",
+        # CircuitPython URLS
         "CircuitPythonDocuUrl":
             "https://circuitpython.readthedocs.io/en/latest/",
+        "CircuitPythonFirmwareUrl":
+            "https://circuitpython.org/downloads/",
+        # BBC micro:bit URLs
         "MicrobitDocuUrl":
             "https://microbit-micropython.readthedocs.io/en/latest/",
+        "MicrobitFirmwareUrl":
+            "https://microbit.org/guide/firmware/",
+        "MicrobitMicroPythonUrl":
+            "https://github.com/bbcmicrobit/micropython/releases",
+        # calliope mini URLS
         "CalliopeDocuUrl":
             "https://github.com/calliope-mini/calliope-mini-micropython/",
-        # MicroPython firmware URLs
-        "MicroPythonFirmwareUrl": "http://micropython.org/download/",
-        "CircuitPythonFirmwareUrl": "https://circuitpython.org/downloads/",
-        "MicrobitFirmwareUrl": "https://microbit.org/guide/firmware/",
         "CalliopeFirmwareUrl":
             "https://github.com/calliope-mini/calliope-mini-micropython/",
     }
@@ -1725,8 +1737,8 @@
                "RubyRedirect",
                "ConsoleDbgEnabled", "PathTranslation",
                "Autosave", "ThreeStateBreakPoints",
-               "SuppressClientExit", "BreakAlways",
-               "AutoViewSourceCode", "ShowExceptionInShell",
+               "BreakAlways", "AutoViewSourceCode",
+               "ShowExceptionInShell", "MultiProcessEnabled",
                ]:
         return toBool(prefClass.settings.value(
             "Debugger/" + key, prefClass.debuggerDefaults[key]))
@@ -1909,8 +1921,7 @@
                "CaptionShowsFilename", "ShowSplash",
                "SplitOrientationVertical",
                "UseProxy", "UseSystemProxy", "UseHttpProxyForAll",
-               "RequestDownloadFilename",
-               "CheckErrorLog", "NotificationsEnabled", "DynamicOnlineCheck",
+               "RequestDownloadFilename", "CheckErrorLog",
                "OpenCrashSessionOnStartup", "CrashSessionEnabled",
                "ShowCodeDocumentationViewer", "ShowPyPIPackageManager",
                "ShowCondaPackageManager", "ShowCooperation", "ShowIrc",
@@ -1932,7 +1943,7 @@
         return pwConvert(
             prefClass.settings.value("UI/" + key, prefClass.uiDefaults[key]),
             encode=False)
-    elif key in ["LogStdErrColour"]:
+    elif key in ("LogStdErrColour",):
         col = prefClass.settings.value("UI/" + key)
         if col is not None:
             return QColor(col)
@@ -1996,7 +2007,7 @@
             for ba in value[name][2]:
                 profiles[name][2].append(bytes(ba.toBase64()).decode())
         prefClass.settings.setValue("UI/" + key, json.dumps(profiles))
-    elif key == "LogStdErrColour":
+    elif key in ("LogStdErrColour",):
         prefClass.settings.setValue("UI/" + key, value.name())
     elif key in ["ProxyPassword/Http", "ProxyPassword/Https",
                  "ProxyPassword/Ftp", ]:
@@ -2083,7 +2094,8 @@
     if key in ["DefaultEncoding", "DefaultOpenFilter", "DefaultSaveFilter",
                "SpellCheckingDefaultLanguage", "SpellCheckingPersonalWordList",
                "SpellCheckingPersonalExcludeList",
-               "PreviewMarkdownHTMLFormat", "PreviewRestDocutilsHTMLFormat"]:
+               "PreviewMarkdownHTMLFormat", "PreviewRestDocutilsHTMLFormat",
+               "DocstringType"]:
         return prefClass.settings.value(
             "Editor/" + key, prefClass.editorDefaults[key])
     elif key in ["AutosaveInterval", "TabWidth", "IndentWidth",
@@ -2651,17 +2663,21 @@
     prefClass.settings.setValue("MultiProject/" + key, value)
 
 
-def getQt5DocDir(prefClass=Prefs):
+def getQtDocDir(version, prefClass=Prefs):
     """
     Module function to retrieve the Qt5DocDir setting.
     
+    @param version Qt version to get documentation directory for
+    @type int
     @param prefClass preferences class used as the storage area
-    @return the requested Qt5DocDir setting (string)
+    @return the requested Qt5DocDir setting
+    @rtype str
     """
+    key = "Qt{0}DocDir".format(version)
     s = prefClass.settings.value(
-        "Help/Qt5DocDir", prefClass.helpDefaults["Qt5DocDir"])
+        "Help/{0}".format(key), prefClass.helpDefaults[key])
     if s == "":
-        s = os.getenv("QT5DOCDIR", "")
+        s = os.getenv(key.upper(), "")
     if s == "":
         s = os.path.join(
             QLibraryInfo.location(QLibraryInfo.DocumentationPath), "qtdoc")
@@ -2699,15 +2715,6 @@
     @param prefClass preferences class used as the storage area
     @return the requested help setting
     """
-    # Web inspector stuff must come before initializing web engine settings
-    # because that starts the chromium web process
-    if key == "WebInspectorPort":
-        return int(prefClass.settings.value(
-            "WebBrowser/" + key, prefClass.webBrowserDefaults[key]))
-    elif key == "WebInspectorEnabled":
-        return toBool(prefClass.settings.value(
-            "WebBrowser/" + key, prefClass.webBrowserDefaults[key]))
-    
     if not prefClass.webEngineSettingsIntitialized:
         prefClass.initWebEngineSettingsDefaults()
     
@@ -2786,8 +2793,7 @@
     elif key in ["StartupBehavior", "HistoryLimit",
                  "DownloadManagerRemovePolicy", "SyncType", "SyncFtpPort",
                  "SyncFtpIdleTimeout", "SyncEncryptionKeyLength",
-                 "SearchLanguage", "WebInspectorPort",
-                 "DefaultFontSize", "DefaultFixedFontSize",
+                 "SearchLanguage", "DefaultFontSize", "DefaultFixedFontSize",
                  "MinimumFontSize", "MinimumLogicalFontSize",
                  "DiskCacheSize", "AcceptCookies", "KeepCookiesUntil",
                  "AdBlockUpdatePeriod", "TabManagerGroupByType",
@@ -2810,7 +2816,7 @@
                  "SyncEnabled", "SyncBookmarks", "SyncHistory",
                  "SyncPasswords", "SyncUserAgents", "SyncSpeedDial",
                  "SyncEncryptData", "SyncEncryptPasswordsOnly",
-                 "ShowPreview", "WebInspectorEnabled", "DiskCacheEnabled",
+                 "ShowPreview", "DiskCacheEnabled",
                  "DoNotTrack", "FilterTrackingCookies",
                  "AdBlockEnabled", "AdBlockUseLimitedEasyList",
                  "PluginsEnabled", "FullScreenSupportEnabled",
@@ -2979,10 +2985,11 @@
     """
     if key in ["Qt5TranslationsDir"]:
         return getQtTranslationsDir(prefClass)
-    elif key in ["PyuicIndent"]:
+    elif key in ["PyuicIndent", "Pyuic6Indent"]:
         return int(prefClass.settings.value(
             "Qt/" + key, prefClass.qtDefaults[key]))
-    elif key in ["PyuicFromImports", "PyuicExecute", "PySide2FromImports"]:
+    elif key in ["PyuicFromImports", "PyuicExecute", "Pyuic6Execute",
+                 "PySide2FromImports", "PySide6FromImports"]:
         return toBool(prefClass.settings.value(
             "Qt/" + key, prefClass.qtDefaults[key]))
     else:

eric ide

mercurial