PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.

Tue, 02 Jul 2019 19:33:49 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 02 Jul 2019 19:33:49 +0200
changeset 7049
0a8a9bd15242
parent 7048
eb0d3cc6dbf5
child 7050
b66cac9a6560

PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.

eric6/Documentation/Help/source.qch file | annotate | diff | comparison | revisions
eric6/Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
eric6/Documentation/Source/eric6.PluginManager.PluginRepositoryDialog.html file | annotate | diff | comparison | revisions
eric6/PluginManager/PluginRepositoryDialog.py file | annotate | diff | comparison | revisions
Binary file eric6/Documentation/Help/source.qch has changed
--- a/eric6/Documentation/Help/source.qhp	Mon Jul 01 19:20:10 2019 +0200
+++ b/eric6/Documentation/Help/source.qhp	Tue Jul 02 19:33:49 2019 +0200
@@ -12668,6 +12668,7 @@
       <keyword name="PluginRepositoryReader.readXML" id="PluginRepositoryReader.readXML" ref="eric6.E5XML.PluginRepositoryReader.html#PluginRepositoryReader.readXML" />
       <keyword name="PluginRepositoryWidget" id="PluginRepositoryWidget" ref="eric6.PluginManager.PluginRepositoryDialog.html#PluginRepositoryWidget" />
       <keyword name="PluginRepositoryWidget (Constructor)" id="PluginRepositoryWidget (Constructor)" ref="eric6.PluginManager.PluginRepositoryDialog.html#PluginRepositoryWidget.__init__" />
+      <keyword name="PluginRepositoryWidget.__changeScheme" id="PluginRepositoryWidget.__changeScheme" ref="eric6.PluginManager.PluginRepositoryDialog.html#PluginRepositoryWidget.__changeScheme" />
       <keyword name="PluginRepositoryWidget.__cleanupDownloads" id="PluginRepositoryWidget.__cleanupDownloads" ref="eric6.PluginManager.PluginRepositoryDialog.html#PluginRepositoryWidget.__cleanupDownloads" />
       <keyword name="PluginRepositoryWidget.__closeAndInstall" id="PluginRepositoryWidget.__closeAndInstall" ref="eric6.PluginManager.PluginRepositoryDialog.html#PluginRepositoryWidget.__closeAndInstall" />
       <keyword name="PluginRepositoryWidget.__downloadCancel" id="PluginRepositoryWidget.__downloadCancel" ref="eric6.PluginManager.PluginRepositoryDialog.html#PluginRepositoryWidget.__downloadCancel" />
--- a/eric6/Documentation/Source/eric6.PluginManager.PluginRepositoryDialog.html	Mon Jul 01 19:20:10 2019 +0200
+++ b/eric6/Documentation/Source/eric6.PluginManager.PluginRepositoryDialog.html	Tue Jul 02 19:33:49 2019 +0200
@@ -142,6 +142,9 @@
 <td><a href="#PluginRepositoryWidget.__init__">PluginRepositoryWidget</a></td>
 <td>Constructor</td>
 </tr><tr>
+<td><a href="#PluginRepositoryWidget.__changeScheme">__changeScheme</a></td>
+<td>Private method to change the scheme of the given URL.</td>
+</tr><tr>
 <td><a href="#PluginRepositoryWidget.__cleanupDownloads">__cleanupDownloads</a></td>
 <td>Private slot to cleanup the plug-in downloads area.</td>
 </tr><tr>
@@ -256,6 +259,29 @@
 <dd>
 parent of this dialog
 </dd>
+</dl><a NAME="PluginRepositoryWidget.__changeScheme" ID="PluginRepositoryWidget.__changeScheme"></a>
+<h4>PluginRepositoryWidget.__changeScheme</h4>
+<b>__changeScheme</b>(<i>url, newScheme=""</i>)
+<p>
+        Private method to change the scheme of the given URL.
+</p><dl>
+<dt><i>url</i> (str)</dt>
+<dd>
+URL to be modified
+</dd><dt><i>newScheme</i></dt>
+<dd>
+scheme to be set for the given URL
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+modified URL
+</dd>
+</dl><dl>
+<dt>Return Type:</dt>
+<dd>
+str
+</dd>
 </dl><a NAME="PluginRepositoryWidget.__cleanupDownloads" ID="PluginRepositoryWidget.__cleanupDownloads"></a>
 <h4>PluginRepositoryWidget.__cleanupDownloads</h4>
 <b>__cleanupDownloads</b>(<i></i>)
--- a/eric6/PluginManager/PluginRepositoryDialog.py	Mon Jul 01 19:20:10 2019 +0200
+++ b/eric6/PluginManager/PluginRepositoryDialog.py	Tue Jul 02 19:33:49 2019 +0200
@@ -97,11 +97,13 @@
         self.__downloadInstallButton.setEnabled(False)
         self.__downloadCancelButton = self.buttonBox.addButton(
             self.tr("Cancel"), QDialogButtonBox.ActionRole)
+        self.__downloadCancelButton.setEnabled(False)
         self.__installButton = \
             self.buttonBox.addButton(self.tr("Close && Install"),
                                      QDialogButtonBox.ActionRole)
-        self.__downloadCancelButton.setEnabled(False)
         self.__installButton.setEnabled(False)
+        self.__closeButton = self.buttonBox.button(QDialogButtonBox.Close)
+        self.__closeButton.setEnabled(True)
         
         self.repositoryUrlEdit.setText(
             Preferences.getUI("PluginRepositoryUrl6"))
@@ -227,6 +229,21 @@
         # join lines by a blank
         return ' '.join(newlines)
     
+    def __changeScheme(self, url, newScheme=""):
+        """
+        Private method to change the scheme of the given URL.
+        
+        @param url URL to be modified
+        @type str
+        @param newScheme scheme to be set for the given URL
+        @return modified URL
+        @rtype str
+        """
+        if not newScheme:
+            newScheme = self.repositoryUrlEdit.text().split("//", 1)[0]
+        
+        return newScheme + "//" + url.split("//", 1)[1]
+    
     @pyqtSlot(QPoint)
     def on_repositoryList_customContextMenuRequested(self, pos):
         """
@@ -253,8 +270,12 @@
         if self.__repositoryMissing or current is None:
             return
         
-        self.urlEdit.setText(
-            current.data(0, PluginRepositoryWidget.UrlRole) or "")
+        url = current.data(0, PluginRepositoryWidget.UrlRole)
+        if url is None:
+            url = ""
+        else:
+            url = self.__changeScheme(url)
+        self.urlEdit.setText(url)
         self.descriptionEdit.setPlainText(
             current.data(0, PluginRepositoryWidget.DescrRole) and
             self.__formatDescription(
@@ -341,10 +362,14 @@
         self.__downloadButton.setEnabled(False)
         self.__downloadInstallButton.setEnabled(False)
         self.__installButton.setEnabled(False)
+        
+        newScheme = self.repositoryUrlEdit.text().split("//", 1)[0]
         for itm in self.repositoryList.selectedItems():
             if itm not in [self.__stableItem, self.__unstableItem,
                            self.__unknownItem, self.__obsoleteItem]:
-                url = itm.data(0, PluginRepositoryWidget.UrlRole)
+                url = self.__changeScheme(
+                    itm.data(0, PluginRepositoryWidget.UrlRole),
+                    newScheme)
                 filename = os.path.join(
                     Preferences.getPluginManager("DownloadPath"),
                     itm.data(0, PluginRepositoryWidget.FilenameRole))
@@ -357,7 +382,7 @@
         """
         self.__downloadButton.setEnabled(len(self.__selectedItems()))
         self.__downloadInstallButton.setEnabled(len(self.__selectedItems()))
-        self.__installButton.setEnabled(True)
+        self.__installButton.setEnabled(len(self.__selectedItems()))
         if not self.__external:
             ui = e5App().getObject("UserInterface")
         else:
@@ -461,6 +486,7 @@
             self.__updateButton.setEnabled(False)
             self.__downloadButton.setEnabled(False)
             self.__downloadInstallButton.setEnabled(False)
+            self.__closeButton.setEnabled(False)
             self.__downloadCancelButton.setEnabled(True)
             
             self.statusLabel.setText(url)
@@ -495,6 +521,7 @@
         @type func
         """
         self.__updateButton.setEnabled(True)
+        self.__closeButton.setEnabled(True)
         self.__downloadCancelButton.setEnabled(False)
         self.__onlineStateChanged(self.__isOnline())
         

eric ide

mercurial