eric6/Preferences/__init__.py

branch
maintenance
changeset 7607
dd1054be15aa
parent 7560
343db73c4842
parent 7598
6bb50f2a1df2
child 7642
72721823d453
--- a/eric6/Preferences/__init__.py	Sat May 02 14:04:18 2020 +0200
+++ b/eric6/Preferences/__init__.py	Sun May 31 17:26:14 2020 +0200
@@ -952,6 +952,7 @@
         "DiskCacheEnabled": True,
         "DiskCacheSize": 50,        # 50 MB
         "SslExceptionsDB": "{}",    # empty JSON dictionary
+        "AlwaysRejectFaultyCertificates": False,
         "DoNotTrack": False,
         "RefererSendReferer": 2,        # send always
         "RefererDefaultPolicy": 3,      # don't send a referer when downgrading
@@ -960,7 +961,10 @@
         "AcceptCookies": 2,         # CookieJar.AcceptOnlyFromSitesNavigatedTo
         "KeepCookiesUntil": 0,      # CookieJar.KeepUntilExpire
         "FilterTrackingCookies": True,
-        "SaveUrlColor": QColor(184, 248, 169),
+        "SecureUrlColor": QColor(184, 248, 169),
+        "InsecureUrlColor": QColor(248, 227, 169),
+        "MaliciousUrlColor": QColor(255, 132, 140),
+        "PrivateModeUrlColor": QColor(220, 220, 220),
         "UserAgent": "",
         "AcceptQuotaRequest": 2,            # yes/no/ask (0, 1, 2)
         "AcceptProtocolHandlerRequest": 2,  # yes/no/ask (0, 1, 2)
@@ -1474,6 +1478,7 @@
                                         # QChart.ChartTheme otherwise
         "MpyCrossCompiler": "",         # path of the mpy-cross compiler
         "DfuUtilPath": "",              # path of the dfu-util flashing tool
+        "IgnoredUnknownDevices": "[]",  # empty list encoded as JSON
         # documentation URLs
         "MicroPythonDocuUrl":
             "https://docs.micropython.org/en/latest/",
@@ -1482,13 +1487,13 @@
         "MicrobitDocuUrl":
             "https://microbit-micropython.readthedocs.io/en/latest/",
         "CalliopeDocuUrl":
-            "https://github.com/calliope-mini/calliope-mini-micropython/", 
+            "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/", 
+            "https://github.com/calliope-mini/calliope-mini-micropython/",
     }
     if Globals.isWindowsPlatform():
         microPythonDefaults["ColorScheme"] = "Windows 10"
@@ -2720,7 +2725,8 @@
         f.fromString(prefClass.settings.value(
             "WebBrowser/" + key, prefClass.webBrowserDefaults[key]))
         return f
-    elif key in ["SaveUrlColor"]:
+    elif key in ["SecureUrlColor", "InsecureUrlColor", "MaliciousUrlColor",
+                 "PrivateModeUrlColor"]:
         col = prefClass.settings.value("WebBrowser/" + key)
         if col is not None:
             return QColor(col)
@@ -2832,7 +2838,7 @@
                  "WebRTCPublicInterfacesOnly", "DnsPrefetchEnabled",
                  "FlashCookiesDeleteOnStartExit", "FlashCookieAutoRefresh",
                  "FlashCookieNotify", "VirusTotalEnabled", "VirusTotalSecure",
-                 "PdfViewerEnabled",
+                 "PdfViewerEnabled", "AlwaysRejectFaultyCertificates",
                  ]:
         return toBool(prefClass.settings.value(
             "WebBrowser/" + key, prefClass.webBrowserDefaults[key]))
@@ -2867,7 +2873,8 @@
     """
     if key in ["StandardFont", "FixedFont"]:
         prefClass.settings.setValue("WebBrowser/" + key, value.toString())
-    elif key == "SaveUrlColor":
+    elif key in ["SecureUrlColor", "InsecureUrlColor", "MaliciousUrlColor",
+                 "PrivateModeUrlColor"]:
         prefClass.settings.setValue("WebBrowser/" + key, value.name())
     elif key == "WebSearchKeywords":
         # value is list of tuples of (keyword, engine name)
@@ -2962,10 +2969,6 @@
         "Qt/Qt5TranslationsDir",
         prefClass.qtDefaults["Qt5TranslationsDir"])
     if s == "":
-        s = os.getenv("QTTRANSLATIONSDIR", "")
-    if s == "":
-        s = os.getenv("QT5TRANSLATIONSDIR", "")
-    if s == "":
         s = QLibraryInfo.location(QLibraryInfo.TranslationsPath)
     if s == "" and Globals.isWindowsPlatform():
         transPath = os.path.join(Globals.getPyQt5ModulesDirectory(),
@@ -3570,6 +3573,14 @@
         return toBool(prefClass.settings.value(
             "MicroPython/" + key,
             prefClass.microPythonDefaults[key]))
+    elif key in ["IgnoredUnknownDevices"]:
+        jsonStr = prefClass.settings.value(
+            "MicroPython/" + key,
+            prefClass.microPythonDefaults[key])
+        if jsonStr:
+            return json.loads(jsonStr)
+        else:
+            return None
     else:
         return prefClass.settings.value(
             "MicroPython/" + key,
@@ -3584,7 +3595,14 @@
     @param value the value to be set
     @param prefClass preferences class used as the storage area
     """
-    prefClass.settings.setValue("MicroPython/" + key, value)
+    if key in ["IgnoredUnknownDevices"]:
+        prefClass.settings.setValue(
+            "MicroPython/" + key,
+            json.dumps(value))
+    else:
+        prefClass.settings.setValue(
+            "MicroPython/" + key,
+            value)
 
 
 def getGeometry(key, prefClass=Prefs):

eric ide

mercurial