eric6/Preferences/__init__.py

changeset 8143
2c730d5fd177
parent 8109
486984bb52e3
child 8176
31965986ecd1
child 8205
4a0f1f896341
--- a/eric6/Preferences/__init__.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/Preferences/__init__.py	Tue Mar 02 17:17:09 2021 +0100
@@ -228,7 +228,7 @@
                                             # 2 = QtCriticalMsg, QtSystemMsg
                                             # 3 = QtFatalMsg
         
-        "LogStdErrColour": QColor(Qt.red),
+        "LogStdErrColour": QColor(Qt.GlobalColor.red),
         "NotificationTimeout": 5,       # time in seconds the notification
                                         # is shown
         "NotificationPosition": QPoint(10, 10),
@@ -376,9 +376,9 @@
         "WhitespaceSize": 1,
         "ShowEOL": False,
         "UseMonospacedFont": False,
-        "WrapLongLinesMode": QsciScintilla.WrapNone,
-        "WrapVisualFlag": QsciScintilla.WrapFlagNone,
-        "WrapIndentMode": QsciScintilla.WrapIndentFixed,
+        "WrapLongLinesMode": QsciScintilla.WrapMode.WrapNone,
+        "WrapVisualFlag": QsciScintilla.WrapVisualFlag.WrapFlagNone,
+        "WrapIndentMode": QsciScintilla.WrapIndentMode.WrapIndentFixed,
         "WrapStartIndent": 0,
         "WarnFilesize": 512,
         "ClearBreaksOnClose": True,
@@ -387,7 +387,7 @@
         "CommentColumn0": True,
         "OverrideEditAreaColours": False,
         
-        "EdgeMode": QsciScintilla.EdgeNone,
+        "EdgeMode": QsciScintilla.EdgeMode.EdgeNone,
         "EdgeColumn": 80,
         
         "AutoIndentation": True,
@@ -408,7 +408,7 @@
         "AutoCompletionCaseSensitivity": True,
         "AutoCompletionReplaceWord": False,
         "AutoCompletionShowSingle": False,
-        "AutoCompletionSource": QsciScintilla.AcsDocument,
+        "AutoCompletionSource": QsciScintilla.AutoCompletionSource.AcsDocument,
         "AutoCompletionThreshold": 2,
         # timeout in ms before auto-completion is started
         "AutoCompletionTimeout": 200,
@@ -425,7 +425,7 @@
         
         "CallTipsEnabled": False,
         "CallTipsVisible": 0,
-        "CallTipsStyle": QsciScintilla.CallTipsNoContext,
+        "CallTipsStyle": QsciScintilla.CallTipsStyle.CallTipsNoContext,
         # show QScintilla calltips, if plug-in fails
         "CallTipsScintillaOnFail": False,
         
@@ -581,7 +581,9 @@
         "PropertiesInitialSpaces": True,
         
         # Python specifics
-        "PythonBadIndentation": QsciLexerPython.Inconsistent,
+        "PythonBadIndentation": (
+            QsciLexerPython.IndentationWarning.Inconsistent
+        ),
         "PythonFoldComment": True,
         "PythonFoldString": True,
         "PythonAutoIndent": True,
@@ -626,50 +628,52 @@
     }
     
     if Globals.isWindowsPlatform():
-        editorDefaults["EOLMode"] = QsciScintilla.EolWindows
+        editorDefaults["EOLMode"] = QsciScintilla.EolMode.EolWindows
     else:
-        editorDefaults["EOLMode"] = QsciScintilla.EolUnix
+        editorDefaults["EOLMode"] = QsciScintilla.EolMode.EolUnix
     
     try:
         # since QScintilla 2.7.0
-        editorDefaults["CallTipsPosition"] = QsciScintilla.CallTipsBelowText
+        editorDefaults["CallTipsPosition"] = (
+            QsciScintilla.CallTipsPosition.CallTipsBelowText
+        )
     except AttributeError:
         editorDefaults["CallTipsPosition"] = 0
     
     editorColourDefaults = {
-        "CurrentMarker": QColor(Qt.yellow),
-        "ErrorMarker": QColor(Qt.red),
-        "MatchingBrace": QColor(Qt.green),
-        "MatchingBraceBack": QColor(Qt.white),
-        "NonmatchingBrace": QColor(Qt.red),
-        "NonmatchingBraceBack": QColor(Qt.white),
-        "CallTipsBackground": QColor(Qt.white),
+        "CurrentMarker": QColor(Qt.GlobalColor.yellow),
+        "ErrorMarker": QColor(Qt.GlobalColor.red),
+        "MatchingBrace": QColor(Qt.GlobalColor.green),
+        "MatchingBraceBack": QColor(Qt.GlobalColor.white),
+        "NonmatchingBrace": QColor(Qt.GlobalColor.red),
+        "NonmatchingBraceBack": QColor(Qt.GlobalColor.white),
+        "CallTipsBackground": QColor(Qt.GlobalColor.white),
         "CallTipsForeground": QColor("#7f7f7f"),
         "CallTipsHighlight": QColor("#00007f"),
-        "CaretForeground": QColor(Qt.black),
-        "CaretLineBackground": QColor(Qt.white),
-        "Edge": QColor(Qt.lightGray),
-        "SelectionBackground": QColor(Qt.black),
-        "SelectionForeground": QColor(Qt.white),
-        "SearchMarkers": QColor(Qt.blue),
-        "MarginsBackground": QColor(Qt.lightGray),
-        "MarginsForeground": QColor(Qt.black),
+        "CaretForeground": QColor(Qt.GlobalColor.black),
+        "CaretLineBackground": QColor(Qt.GlobalColor.white),
+        "Edge": QColor(Qt.GlobalColor.lightGray),
+        "SelectionBackground": QColor(Qt.GlobalColor.black),
+        "SelectionForeground": QColor(Qt.GlobalColor.white),
+        "SearchMarkers": QColor(Qt.GlobalColor.blue),
+        "MarginsBackground": QColor(Qt.GlobalColor.lightGray),
+        "MarginsForeground": QColor(Qt.GlobalColor.black),
         "FoldmarginBackground": QColor("#e6e6e6"),
-        "FoldMarkersForeground": QColor(Qt.white),
-        "FoldMarkersBackground": QColor(Qt.black),
-        "SpellingMarkers": QColor(Qt.red),
+        "FoldMarkersForeground": QColor(Qt.GlobalColor.white),
+        "FoldMarkersBackground": QColor(Qt.GlobalColor.black),
+        "SpellingMarkers": QColor(Qt.GlobalColor.red),
         "AnnotationsWarningForeground": QColor("#606000"),
         "AnnotationsWarningBackground": QColor("#ffffd0"),
         "AnnotationsErrorForeground": QColor("#600000"),
         "AnnotationsErrorBackground": QColor("#ffd0d0"),
         "AnnotationsStyleForeground": QColor("#000060"),
         "AnnotationsStyleBackground": QColor("#d0d0ff"),
-        "WhitespaceForeground": QColor(Qt.darkGray),
-        "WhitespaceBackground": QColor(Qt.white),
+        "WhitespaceForeground": QColor(Qt.GlobalColor.darkGray),
+        "WhitespaceBackground": QColor(Qt.GlobalColor.white),
         "OnlineChangeTraceMarkerUnsaved": QColor("#ff8888"),
         "OnlineChangeTraceMarkerSaved": QColor("#88ff88"),
-        "IndentationGuidesBackground": QColor(Qt.white),
-        "IndentationGuidesForeground": QColor(Qt.black),
+        "IndentationGuidesBackground": QColor(Qt.GlobalColor.white),
+        "IndentationGuidesForeground": QColor(Qt.GlobalColor.black),
         "HighlightMarker": QColor("#200000FF"),     # ARGB format
         # colors for the marker map
         "BookmarksMap": QColor("#f8c700"),
@@ -680,7 +684,7 @@
         "CoverageMap": QColor("#ad3636"),
         "ChangesMap": QColor("#00b000"),
         "CurrentMap": QColor("#000000"),
-        "SearchMarkersMap": QColor(Qt.blue),
+        "SearchMarkersMap": QColor(Qt.GlobalColor.blue),
         "VcsConflictMarkersMap": QColor("#dd00dd"),
         "MarkerMapBackground": QColor("#e7e7e7"),
     }
@@ -888,14 +892,14 @@
     
     # defaults for the project browser colour settings
     projectBrowserColourDefaults = {
-        "Highlighted": QColor(Qt.red),
+        "Highlighted": QColor(Qt.GlobalColor.red),
         
-        "VcsAdded": QColor(Qt.blue),
-        "VcsConflict": QColor(Qt.red),
-        "VcsModified": QColor(Qt.yellow),
-        "VcsReplaced": QColor(Qt.cyan),
-        "VcsUpdate": QColor(Qt.green),
-        "VcsRemoved": QColor(Qt.magenta)
+        "VcsAdded": QColor(Qt.GlobalColor.blue),
+        "VcsConflict": QColor(Qt.GlobalColor.red),
+        "VcsModified": QColor(Qt.GlobalColor.yellow),
+        "VcsReplaced": QColor(Qt.GlobalColor.cyan),
+        "VcsUpdate": QColor(Qt.GlobalColor.green),
+        "VcsRemoved": QColor(Qt.GlobalColor.magenta)
     }
     
     # defaults for the help settings
@@ -1058,93 +1062,98 @@
         webEngineSettings = QWebEngineSettings.defaultSettings()
         cls.webBrowserDefaults.update({
             "StandardFontFamily": webEngineSettings.fontFamily(
-                QWebEngineSettings.StandardFont),
+                QWebEngineSettings.FontFamily.StandardFont),
             "FixedFontFamily": webEngineSettings.fontFamily(
-                QWebEngineSettings.FixedFont),
+                QWebEngineSettings.FontFamily.FixedFont),
             "SerifFontFamily": webEngineSettings.fontFamily(
-                QWebEngineSettings.StandardFont),
+                QWebEngineSettings.FontFamily.StandardFont),
             "SansSerifFontFamily": webEngineSettings.fontFamily(
-                QWebEngineSettings.SansSerifFont),
+                QWebEngineSettings.FontFamily.SansSerifFont),
             "CursiveFontFamily": webEngineSettings.fontFamily(
-                QWebEngineSettings.CursiveFont),
+                QWebEngineSettings.FontFamily.CursiveFont),
             "FantasyFontFamily": webEngineSettings.fontFamily(
-                QWebEngineSettings.FantasyFont),
+                QWebEngineSettings.FontFamily.FantasyFont),
             "DefaultFontSize": webEngineSettings.fontSize(
-                QWebEngineSettings.DefaultFontSize),
+                QWebEngineSettings.FontSize.DefaultFontSize),
             "DefaultFixedFontSize": webEngineSettings.fontSize(
-                QWebEngineSettings.DefaultFixedFontSize),
+                QWebEngineSettings.FontSize.DefaultFixedFontSize),
             "MinimumFontSize": webEngineSettings.fontSize(
-                QWebEngineSettings.MinimumFontSize),
+                QWebEngineSettings.FontSize.MinimumFontSize),
             "MinimumLogicalFontSize": webEngineSettings.fontSize(
-                QWebEngineSettings.MinimumLogicalFontSize),
+                QWebEngineSettings.FontSize.MinimumLogicalFontSize),
             "AutoLoadImages": webEngineSettings.testAttribute(
-                QWebEngineSettings.AutoLoadImages),
+                QWebEngineSettings.WebAttribute.AutoLoadImages),
             "JavaScriptEnabled": webEngineSettings.testAttribute(
-                QWebEngineSettings.JavascriptEnabled),
+                QWebEngineSettings.WebAttribute.JavascriptEnabled),
             "JavaScriptCanOpenWindows": webEngineSettings.testAttribute(
-                QWebEngineSettings.JavascriptCanOpenWindows),
+                QWebEngineSettings.WebAttribute.JavascriptCanOpenWindows),
             "JavaScriptCanAccessClipboard": webEngineSettings.testAttribute(
-                QWebEngineSettings.JavascriptCanAccessClipboard),
+                QWebEngineSettings.WebAttribute.JavascriptCanAccessClipboard),
             "PluginsEnabled": webEngineSettings.testAttribute(
-                QWebEngineSettings.PluginsEnabled),
+                QWebEngineSettings.WebAttribute.PluginsEnabled),
             "LocalStorageEnabled": webEngineSettings.testAttribute(
-                QWebEngineSettings.LocalStorageEnabled),
+                QWebEngineSettings.WebAttribute.LocalStorageEnabled),
             "DefaultTextEncoding": webEngineSettings.defaultTextEncoding(),
             "SpatialNavigationEnabled": webEngineSettings.testAttribute(
-                QWebEngineSettings.SpatialNavigationEnabled),
+                QWebEngineSettings.WebAttribute.SpatialNavigationEnabled),
             "LinksIncludedInFocusChain": webEngineSettings.testAttribute(
-                QWebEngineSettings.LinksIncludedInFocusChain),
+                QWebEngineSettings.WebAttribute.LinksIncludedInFocusChain),
             "LocalContentCanAccessRemoteUrls": webEngineSettings.testAttribute(
-                QWebEngineSettings.LocalContentCanAccessRemoteUrls),
+                QWebEngineSettings.WebAttribute
+                .LocalContentCanAccessRemoteUrls),
             "LocalContentCanAccessFileUrls": webEngineSettings.testAttribute(
-                QWebEngineSettings.LocalContentCanAccessFileUrls),
+                QWebEngineSettings.WebAttribute.LocalContentCanAccessFileUrls),
             "XSSAuditingEnabled": webEngineSettings.testAttribute(
-                QWebEngineSettings.XSSAuditingEnabled),
+                QWebEngineSettings.WebAttribute.XSSAuditingEnabled),
             "ScrollAnimatorEnabled": webEngineSettings.testAttribute(
-                QWebEngineSettings.ScrollAnimatorEnabled),
+                QWebEngineSettings.WebAttribute.ScrollAnimatorEnabled),
             "ErrorPageEnabled": webEngineSettings.testAttribute(
-                QWebEngineSettings.ErrorPageEnabled),
+                QWebEngineSettings.WebAttribute.ErrorPageEnabled),
             "FullScreenSupportEnabled": webEngineSettings.testAttribute(
-                QWebEngineSettings.FullScreenSupportEnabled),
+                QWebEngineSettings.WebAttribute.FullScreenSupportEnabled),
             "PictographFontFamily": webEngineSettings.fontFamily(
-                QWebEngineSettings.PictographFont),
+                QWebEngineSettings.FontFamily.PictographFont),
             "ScreenCaptureEnabled": webEngineSettings.testAttribute(
-                QWebEngineSettings.ScreenCaptureEnabled),
+                QWebEngineSettings.WebAttribute.ScreenCaptureEnabled),
             "WebGLEnabled": webEngineSettings.testAttribute(
-                QWebEngineSettings.WebGLEnabled),
+                QWebEngineSettings.WebAttribute.WebGLEnabled),
             "FocusOnNavigationEnabled": webEngineSettings.testAttribute(
-                QWebEngineSettings.FocusOnNavigationEnabled),
+                QWebEngineSettings.WebAttribute.FocusOnNavigationEnabled),
             "PrintElementBackgrounds": webEngineSettings.testAttribute(
-                QWebEngineSettings.PrintElementBackgrounds),
+                QWebEngineSettings.WebAttribute.PrintElementBackgrounds),
             "AllowRunningInsecureContent": webEngineSettings.testAttribute(
-                QWebEngineSettings.AllowRunningInsecureContent),
+                QWebEngineSettings.WebAttribute.AllowRunningInsecureContent),
             "AllowGeolocationOnInsecureOrigins":
                 webEngineSettings.testAttribute(
-                    QWebEngineSettings.AllowGeolocationOnInsecureOrigins),
+                    QWebEngineSettings.WebAttribute
+                    .AllowGeolocationOnInsecureOrigins),
             "AllowWindowActivationFromJavaScript":
                 webEngineSettings.testAttribute(
-                    QWebEngineSettings.AllowWindowActivationFromJavaScript),
+                    QWebEngineSettings.WebAttribute
+                    .AllowWindowActivationFromJavaScript),
             "ShowScrollBars": webEngineSettings.testAttribute(
-                QWebEngineSettings.ShowScrollBars),
+                QWebEngineSettings.WebAttribute.ShowScrollBars),
             "PlaybackRequiresUserGesture":
                 webEngineSettings.testAttribute(
-                    QWebEngineSettings.PlaybackRequiresUserGesture),
+                    QWebEngineSettings.WebAttribute
+                    .PlaybackRequiresUserGesture),
             "JavaScriptCanPaste":
                 webEngineSettings.testAttribute(
-                    QWebEngineSettings.JavascriptCanPaste),
+                    QWebEngineSettings.WebAttribute.JavascriptCanPaste),
             "WebRTCPublicInterfacesOnly":
                 webEngineSettings.testAttribute(
-                    QWebEngineSettings.WebRTCPublicInterfacesOnly),
+                    QWebEngineSettings.WebAttribute
+                    .WebRTCPublicInterfacesOnly),
             "DnsPrefetchEnabled":
                 webEngineSettings.testAttribute(
-                    QWebEngineSettings.DnsPrefetchEnabled),
+                    QWebEngineSettings.WebAttribute.DnsPrefetchEnabled),
         })
         try:
             # Qt 5.13
             cls.webBrowserDefaults.update({
                 "PdfViewerEnabled":
                     webEngineSettings.testAttribute(
-                        QWebEngineSettings.PdfViewerEnabled),
+                        QWebEngineSettings.WebAttribute.PdfViewerEnabled),
             })
         except AttributeError:
             pass
@@ -1391,11 +1400,11 @@
         "OpenReadOnly": False,
         "HighlightChanges": True,
         "HighlightingBackGround": QColor(0xff, 0xff, 0x99, 0xff),
-        "HighlightingForeGround": QColor(Qt.black),
+        "HighlightingForeGround": QColor(Qt.GlobalColor.black),
         "SelectionBackGround": QColor("#308cc6"),
-        "SelectionForeGround": QColor(Qt.white),
+        "SelectionForeGround": QColor(Qt.GlobalColor.white),
         "AddressAreaBackGround": QColor("#efedec"),
-        "AddressAreaForeGround": QColor(Qt.black),
+        "AddressAreaForeGround": QColor(Qt.GlobalColor.black),
         "RecentNumber": 9,
     }
     if Globals.isWindowsPlatform():
@@ -1490,11 +1499,11 @@
     
     # defaults for Python specific settings
     pythonDefaults = {
-        "ASTViewerErrorColor": QColor(Qt.darkRed),
+        "ASTViewerErrorColor": QColor(Qt.GlobalColor.darkRed),
         
-        "DisViewerErrorColor": QColor(Qt.darkRed),
-        "DisViewerCurrentColor": QColor(Qt.darkMagenta),
-        "DisViewerLabeledColor": QColor(Qt.darkGreen),
+        "DisViewerErrorColor": QColor(Qt.GlobalColor.darkRed),
+        "DisViewerCurrentColor": QColor(Qt.GlobalColor.darkMagenta),
+        "DisViewerLabeledColor": QColor(Qt.GlobalColor.darkGreen),
         "DisViewerExpandCodeInfoDetails": False,
     }
 
@@ -1600,7 +1609,7 @@
     """
     from E5Gui.E5Application import e5App
     Prefs.settings = QSettings(
-        QSettings.IniFormat, QSettings.UserScope,
+        QSettings.Format.IniFormat, QSettings.Scope.UserScope,
         Globals.settingsNameOrganization, Globals.settingsNameGlobal,
         e5App())
     if not Globals.isWindowsPlatform():
@@ -1696,7 +1705,7 @@
     This function is called once upon import of the module.
     """
     Prefs.rsettings = QSettings(
-        QSettings.IniFormat, QSettings.UserScope,
+        QSettings.Format.IniFormat, QSettings.Scope.UserScope,
         Globals.settingsNameOrganization, Globals.settingsNameRecent)
     
 
@@ -2178,9 +2187,11 @@
     else:
         # palette based defaults here because of Qt5
         if key == "EditAreaForeground":
-            return QApplication.palette().color(QPalette.Active, QPalette.Base)
+            return QApplication.palette().color(QPalette.ColorGroup.Active,
+                                                QPalette.ColorRole.Base)
         elif key == "EditAreaBackground":
-            return QApplication.palette().color(QPalette.Active, QPalette.Text)
+            return QApplication.palette().color(QPalette.ColorGroup.Active,
+                                                QPalette.ColorRole.Text)
         else:
             return prefClass.editorColourDefaults[key]
     
@@ -2683,7 +2694,9 @@
         s = os.getenv(key.upper(), "")
     if s == "":
         s = os.path.join(
-            QLibraryInfo.location(QLibraryInfo.DocumentationPath), "qtdoc")
+            QLibraryInfo.location(
+                QLibraryInfo.LibraryLocation.DocumentationPath),
+            "qtdoc")
     return s
 
 
@@ -2853,7 +2866,7 @@
     elif key in ["SafeBrowsingUpdateDateTime"]:
         dateTimeStr = prefClass.settings.value("WebBrowser/" + key)
         if dateTimeStr is not None:
-            return QDateTime.fromString(dateTimeStr, Qt.ISODate)
+            return QDateTime.fromString(dateTimeStr, Qt.DateFormat.ISODate)
         else:
             return prefClass.webBrowserDefaults[key]
     else:
@@ -2920,7 +2933,7 @@
     elif key in ["SafeBrowsingUpdateDateTime"]:
         # value is a QDateTime
         prefClass.settings.setValue("WebBrowser/" + key,
-                                    value.toString(Qt.ISODate))
+                                    value.toString(Qt.DateFormat.ISODate))
     else:
         prefClass.settings.setValue("WebBrowser/" + key, value)
     
@@ -2967,7 +2980,8 @@
         "Qt/Qt5TranslationsDir",
         prefClass.qtDefaults["Qt5TranslationsDir"])
     if s == "":
-        s = QLibraryInfo.location(QLibraryInfo.TranslationsPath)
+        s = QLibraryInfo.location(
+            QLibraryInfo.LibraryLocation.TranslationsPath)
     if s == "" and Globals.isWindowsPlatform():
         transPath = os.path.join(Globals.getPyQt5ModulesDirectory(),
                                  "translations")

eric ide

mercurial