Removed use of sender() in the plug-in repository dialog and the plug-in manager.

Thu, 25 Jan 2018 11:54:38 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 25 Jan 2018 11:54:38 +0100
changeset 6088
b7fdd0db835e
parent 6087
23da86c1ba4d
child 6089
ca484325f02a

Removed use of sender() in the plug-in repository dialog and the plug-in manager.

Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Source/eric6.PluginManager.PluginManager.html file | annotate | diff | comparison | revisions
Documentation/Source/eric6.PluginManager.PluginRepositoryDialog.html file | annotate | diff | comparison | revisions
PluginManager/PluginManager.py file | annotate | diff | comparison | revisions
PluginManager/PluginRepositoryDialog.py file | annotate | diff | comparison | revisions
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Source/eric6.PluginManager.PluginManager.html	Thu Jan 25 10:13:32 2018 +0100
+++ b/Documentation/Source/eric6.PluginManager.PluginManager.html	Thu Jan 25 11:54:38 2018 +0100
@@ -301,10 +301,15 @@
         directory.
 </p><a NAME="PluginManager.__downloadRepositoryFileDone" ID="PluginManager.__downloadRepositoryFileDone"></a>
 <h4>PluginManager.__downloadRepositoryFileDone</h4>
-<b>__downloadRepositoryFileDone</b>(<i></i>)
+<b>__downloadRepositoryFileDone</b>(<i>reply</i>)
 <p>
         Private method called after the repository file was downloaded.
-</p><a NAME="PluginManager.__getShortInfo" ID="PluginManager.__getShortInfo"></a>
+</p><dl>
+<dt><i>reply</i> (QNetworkReply)</dt>
+<dd>
+reference to the reply object of the download
+</dd>
+</dl><a NAME="PluginManager.__getShortInfo" ID="PluginManager.__getShortInfo"></a>
 <h4>PluginManager.__getShortInfo</h4>
 <b>__getShortInfo</b>(<i>module</i>)
 <p>
--- a/Documentation/Source/eric6.PluginManager.PluginRepositoryDialog.html	Thu Jan 25 10:13:32 2018 +0100
+++ b/Documentation/Source/eric6.PluginManager.PluginRepositoryDialog.html	Thu Jan 25 11:54:38 2018 +0100
@@ -284,11 +284,16 @@
 </dd>
 </dl><a NAME="PluginRepositoryWidget.__downloadFileDone" ID="PluginRepositoryWidget.__downloadFileDone"></a>
 <h4>PluginRepositoryWidget.__downloadFileDone</h4>
-<b>__downloadFileDone</b>(<i></i>)
+<b>__downloadFileDone</b>(<i>reply</i>)
 <p>
         Private method called, after the file has been downloaded
         from the Internet.
-</p><a NAME="PluginRepositoryWidget.__downloadPlugin" ID="PluginRepositoryWidget.__downloadPlugin"></a>
+</p><dl>
+<dt><i>reply</i> (QNetworkReply)</dt>
+<dd>
+reference to the reply object of the download
+</dd>
+</dl><a NAME="PluginRepositoryWidget.__downloadPlugin" ID="PluginRepositoryWidget.__downloadPlugin"></a>
 <h4>PluginRepositoryWidget.__downloadPlugin</h4>
 <b>__downloadPlugin</b>(<i></i>)
 <p>
--- a/PluginManager/PluginManager.py	Thu Jan 25 10:13:32 2018 +0100
+++ b/PluginManager/PluginManager.py	Thu Jan 25 11:54:38 2018 +0100
@@ -1198,16 +1198,20 @@
         request.setAttribute(QNetworkRequest.CacheLoadControlAttribute,
                              QNetworkRequest.AlwaysNetwork)
         reply = self.__networkManager.get(request)
-        reply.finished.connect(self.__downloadRepositoryFileDone)
+        reply.finished.connect(
+            lambda: self.__downloadRepositoryFileDone(reply))
         self.__replies.append(reply)
     
-    def __downloadRepositoryFileDone(self):
+    def __downloadRepositoryFileDone(self, reply):
         """
         Private method called after the repository file was downloaded.
+        
+        @param reply reference to the reply object of the download
+        @type QNetworkReply
         """
-        reply = self.sender()
         if reply in self.__replies:
             self.__replies.remove(reply)
+        
         if reply.error() != QNetworkReply.NoError:
             E5MessageBox.warning(
                 None,
--- a/PluginManager/PluginRepositoryDialog.py	Thu Jan 25 10:13:32 2018 +0100
+++ b/PluginManager/PluginRepositoryDialog.py	Thu Jan 25 11:54:38 2018 +0100
@@ -469,7 +469,7 @@
             request.setAttribute(QNetworkRequest.CacheLoadControlAttribute,
                                  QNetworkRequest.AlwaysNetwork)
             reply = self.__networkManager.get(request)
-            reply.finished.connect(self.__downloadFileDone)
+            reply.finished.connect(lambda: self.__downloadFileDone(reply))
             reply.downloadProgress.connect(self.__downloadProgress)
             self.__replies.append(reply)
         else:
@@ -481,17 +481,19 @@
                     """ from {0}.</p><p>Error: {1}</p>"""
                 ).format(url, self.tr("Computer is offline.")))
     
-    def __downloadFileDone(self):
+    def __downloadFileDone(self, reply):
         """
         Private method called, after the file has been downloaded
         from the Internet.
+        
+        @param reply reference to the reply object of the download
+        @type QNetworkReply
         """
         self.__updateButton.setEnabled(True)
         self.__downloadCancelButton.setEnabled(False)
         self.__onlineStateChanged(self.__isOnline())
         
         ok = True
-        reply = self.sender()
         if reply in self.__replies:
             self.__replies.remove(reply)
         if reply.error() != QNetworkReply.NoError:

eric ide

mercurial