Merged with default branch. multi_processing

Sun, 03 May 2020 13:42:52 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 03 May 2020 13:42:52 +0200
branch
multi_processing
changeset 7568
e8688eb98b98
parent 7564
787684e6f2f3 (current diff)
parent 7567
bb196e51827d (diff)
child 7627
812ee8c0a91a

Merged with default branch.

eric6/Preferences/__init__.py file | annotate | diff | comparison | revisions
--- a/docs/changelog	Sat May 02 14:45:06 2020 +0200
+++ b/docs/changelog	Sun May 03 13:42:52 2020 +0200
@@ -1,5 +1,10 @@
 Change Log
 ----------
+Version 20.6:
+- bug fixes
+- Web Browser:
+  -- added a configurable URL entry color to indicate sites with certificate
+     issues
 Version 20.5:
 - bug fixes
 - MicroPython
--- a/eric6/Preferences/ConfigurationPages/WebBrowserAppearancePage.py	Sat May 02 14:45:06 2020 +0200
+++ b/eric6/Preferences/ConfigurationPages/WebBrowserAppearancePage.py	Sun May 03 13:42:52 2020 +0200
@@ -80,7 +80,17 @@
             self.pictographFontLabel.setEnabled(False)
             self.pictographFontCombo.setEnabled(False)
         
-        self.initColour("SaveUrlColor", self.secureURLsColourButton,
+        self.initColour("SecureUrlColor",
+                        self.secureURLsColourButton,
+                        Preferences.getWebBrowser)
+        self.initColour("InsecureUrlColor",
+                        self.insecureURLsColourButton,
+                        Preferences.getWebBrowser)
+        self.initColour("MaliciousUrlColor",
+                        self.maliciousURLsColourButton,
+                        Preferences.getWebBrowser)
+        self.initColour("PrivateModeUrlColor",
+                        self.privateModeURLsColourButton,
                         Preferences.getWebBrowser)
         
         self.autoLoadImagesCheckBox.setChecked(
--- a/eric6/Preferences/ConfigurationPages/WebBrowserAppearancePage.ui	Sat May 02 14:45:06 2020 +0200
+++ b/eric6/Preferences/ConfigurationPages/WebBrowserAppearancePage.ui	Sun May 03 13:42:52 2020 +0200
@@ -7,10 +7,10 @@
     <x>0</x>
     <y>0</y>
     <width>499</width>
-    <height>905</height>
+    <height>1256</height>
    </rect>
   </property>
-  <layout class="QVBoxLayout" name="verticalLayout_5">
+  <layout class="QVBoxLayout" name="verticalLayout_6">
    <item>
     <widget class="QLabel" name="headerLabel">
      <property name="text">
@@ -278,43 +278,121 @@
      <property name="title">
       <string>Colors</string>
      </property>
-     <layout class="QGridLayout" name="gridLayout_2">
-      <item row="0" column="0">
-       <widget class="QLabel" name="textLabel1_3">
-        <property name="text">
-         <string>Background color of secure URLs:</string>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1">
-       <widget class="QPushButton" name="secureURLsColourButton">
-        <property name="minimumSize">
-         <size>
-          <width>100</width>
-          <height>0</height>
-         </size>
+     <layout class="QVBoxLayout" name="verticalLayout_5">
+      <item>
+       <widget class="QGroupBox" name="groupBox_8">
+        <property name="title">
+         <string>URL Entry Background</string>
         </property>
-        <property name="toolTip">
-         <string>Select the background color for secure URLs.</string>
-        </property>
-        <property name="text">
-         <string/>
-        </property>
+        <layout class="QGridLayout" name="gridLayout_2">
+         <item row="0" column="0">
+          <widget class="QLabel" name="textLabel1_3">
+           <property name="text">
+            <string>Secure URLs:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="1">
+          <widget class="QPushButton" name="secureURLsColourButton">
+           <property name="minimumSize">
+            <size>
+             <width>100</width>
+             <height>0</height>
+            </size>
+           </property>
+           <property name="toolTip">
+            <string>Select the background color for secure URLs.</string>
+           </property>
+           <property name="text">
+            <string/>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="2">
+          <spacer name="horizontalSpacer">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>223</width>
+             <height>17</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item row="1" column="0">
+          <widget class="QLabel" name="textLabel1_4">
+           <property name="text">
+            <string>Insecure URLs:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="1">
+          <widget class="QPushButton" name="insecureURLsColourButton">
+           <property name="minimumSize">
+            <size>
+             <width>100</width>
+             <height>0</height>
+            </size>
+           </property>
+           <property name="toolTip">
+            <string>Select the background color for insecure URLs.</string>
+           </property>
+           <property name="text">
+            <string/>
+           </property>
+          </widget>
+         </item>
+         <item row="2" column="0">
+          <widget class="QLabel" name="textLabel1_5">
+           <property name="text">
+            <string>Malicious URLs:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="2" column="1">
+          <widget class="QPushButton" name="maliciousURLsColourButton">
+           <property name="minimumSize">
+            <size>
+             <width>100</width>
+             <height>0</height>
+            </size>
+           </property>
+           <property name="toolTip">
+            <string>Select the background color for malicious URLs.</string>
+           </property>
+           <property name="text">
+            <string/>
+           </property>
+          </widget>
+         </item>
+         <item row="3" column="0">
+          <widget class="QLabel" name="label_12">
+           <property name="text">
+            <string>Private Mode:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="3" column="1">
+          <widget class="QPushButton" name="privateModeURLsColourButton">
+           <property name="minimumSize">
+            <size>
+             <width>100</width>
+             <height>0</height>
+            </size>
+           </property>
+           <property name="toolTip">
+            <string>Select the background color for URLs in private mode.</string>
+           </property>
+           <property name="text">
+            <string/>
+           </property>
+          </widget>
+         </item>
+        </layout>
        </widget>
       </item>
-      <item row="0" column="2">
-       <spacer name="horizontalSpacer">
-        <property name="orientation">
-         <enum>Qt::Horizontal</enum>
-        </property>
-        <property name="sizeHint" stdset="0">
-         <size>
-          <width>141</width>
-          <height>20</height>
-         </size>
-        </property>
-       </spacer>
-      </item>
      </layout>
     </widget>
    </item>
@@ -482,6 +560,9 @@
   <tabstop>minSizeSpinBox</tabstop>
   <tabstop>minLogicalSizeSpinBox</tabstop>
   <tabstop>secureURLsColourButton</tabstop>
+  <tabstop>insecureURLsColourButton</tabstop>
+  <tabstop>maliciousURLsColourButton</tabstop>
+  <tabstop>privateModeURLsColourButton</tabstop>
   <tabstop>autoLoadImagesCheckBox</tabstop>
   <tabstop>styleSheetPicker</tabstop>
   <tabstop>warnOnMultipleCloseCheckBox</tabstop>
--- a/eric6/Preferences/__init__.py	Sat May 02 14:45:06 2020 +0200
+++ b/eric6/Preferences/__init__.py	Sun May 03 13:42:52 2020 +0200
@@ -962,7 +962,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)
@@ -1484,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"
@@ -2723,7 +2726,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)
@@ -2870,7 +2874,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)
--- a/eric6/WebBrowser/Network/NetworkManager.py	Sat May 02 14:45:06 2020 +0200
+++ b/eric6/WebBrowser/Network/NetworkManager.py	Sun May 03 13:42:52 2020 +0200
@@ -70,6 +70,8 @@
         self.__permanentlyIgnoredSslErrors = {}
         # dictionaries of permanently and temporarily ignored SSL errors
         
+        self.__insecureHosts = set()
+        
         self.__loaded = False
         self.__saveTimer = AutoSaver(self, self.__save)
         
@@ -179,6 +181,8 @@
         
         host = error.url().host()
         
+        self.__insecureHosts.add(host)
+        
         if (
             host in self.__temporarilyIgnoredSslErrors and
             error.error() in self.__temporarilyIgnoredSslErrors[host]
@@ -222,6 +226,15 @@
         else:
             return False
     
+    def isInsecureHost(self, host):
+        """
+        Public method to check a host against the list of insecure hosts.
+        
+        @return flag indicating an insecure host
+        @rtype bool
+        """
+        return host in self.__insecureHosts
+    
     def authentication(self, url, auth, page=None):
         """
         Public slot to handle an authentication request.
--- a/eric6/WebBrowser/SiteInfo/SiteInfoWidget.py	Sat May 02 14:45:06 2020 +0200
+++ b/eric6/WebBrowser/SiteInfo/SiteInfoWidget.py	Sun May 03 13:42:52 2020 +0200
@@ -59,10 +59,17 @@
         secureLabel.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
         layout.addWidget(secureLabel, rows, 1)
         if url.scheme() in ["https"]:
-            secureLabel.setText(
-                self.tr("Your connection to this site is <b>secure</b>."))
-            secureIcon.setPixmap(
-                UI.PixmapCache.getPixmap("securityHigh"))
+            if WebBrowserWindow.networkManager().isInsecureHost(url.host()):
+                secureLabel.setText(
+                    self.tr("Your connection to this site "
+                            "<b>may not be secure</b>."))
+                secureIcon.setPixmap(
+                    UI.PixmapCache.getPixmap("securityMedium"))
+            else:
+                secureLabel.setText(
+                    self.tr("Your connection to this site is <b>secure</b>."))
+                secureIcon.setPixmap(
+                    UI.PixmapCache.getPixmap("securityHigh"))
         else:
             secureLabel.setText(
                 self.tr("Your connection to this site is <b>not secure</b>."))
--- a/eric6/WebBrowser/Tools/WebIconLoader.py	Sat May 02 14:45:06 2020 +0200
+++ b/eric6/WebBrowser/Tools/WebIconLoader.py	Sun May 03 13:42:52 2020 +0200
@@ -19,7 +19,7 @@
     """
     Class implementing a loader for web site icons.
     
-    @signal iconLoaded(icon) emitted when the con has been loaded
+    @signal iconLoaded(icon) emitted when the icon has been loaded
     """
     iconLoaded = pyqtSignal(QIcon)
     
@@ -50,5 +50,7 @@
         icon = QIcon(QPixmap.fromImage(QImage.fromData(data)))
         self.iconLoaded.emit(icon)
         
+        # TODO: extract SSL data as a by-product
+        
         self.__reply.deleteLater()
         self.__reply = None
--- a/eric6/WebBrowser/UrlBar/UrlBar.py	Sat May 02 14:45:06 2020 +0200
+++ b/eric6/WebBrowser/UrlBar/UrlBar.py	Sun May 03 13:42:52 2020 +0200
@@ -221,12 +221,12 @@
         
         @param evt reference to the paint event (QPaintEvent)
         """
+        foregroundColor = QApplication.palette().color(QPalette.Text)
+        
         if self.__privateMode:
-            backgroundColor = QColor(220, 220, 220)     # light gray
-            foregroundColor = Qt.black
+            backgroundColor = Preferences.getWebBrowser("PrivateModeUrlColor")
         else:
             backgroundColor = QApplication.palette().color(QPalette.Base)
-            foregroundColor = QApplication.palette().color(QPalette.Text)
         
         if self.__browser is not None:
             p = self.palette()
@@ -234,11 +234,17 @@
             
             if not self.__browser.getSafeBrowsingStatus():
                 # malicious web site
-                backgroundColor = QColor(170, 0, 0)
-                foregroundColor = QColor(Qt.white)
+                backgroundColor = Preferences.getWebBrowser(
+                        "MaliciousUrlColor")
             elif self.__browser.url().scheme() == "https":
-                backgroundColor = Preferences.getWebBrowser(
-                    "SaveUrlColor")
+                if WebBrowserWindow.networkManager().isInsecureHost(
+                    self.__browser.url().host()
+                ):
+                    backgroundColor = Preferences.getWebBrowser(
+                        "InsecureUrlColor")
+                else:
+                    backgroundColor = Preferences.getWebBrowser(
+                        "SecureUrlColor")
             
             if progress == 0 or progress == 100:
                 p.setBrush(QPalette.Base, backgroundColor)
--- a/scripts/install.py	Sat May 02 14:45:06 2020 +0200
+++ b/scripts/install.py	Sun May 03 13:42:52 2020 +0200
@@ -1027,11 +1027,12 @@
     
     # 1. create desktop shortcuts
     regName = "Desktop"
-    desktopFolder = os.path.normpath(
-        os.path.expandvars(getWinregEntry(regName, regPath)))
-    for linkName, targetPath, iconPath in windowsDesktopEntries():
-        linkPath = os.path.join(desktopFolder, linkName)
-        createWindowsShortcut(linkPath, targetPath, iconPath)
+    desktopEntry = getWinregEntry(regName, regPath)
+    if desktopEntry:
+        desktopFolder = os.path.normpath(os.path.expandvars(desktopEntry))
+        for linkName, targetPath, iconPath in windowsDesktopEntries():
+            linkPath = os.path.join(desktopFolder, linkName)
+            createWindowsShortcut(linkPath, targetPath, iconPath)
     
     # 2. create start menu entry and shortcuts
     regName = "Programs"

eric ide

mercurial