WebBrowser/SpellCheck/ManageDictionariesDialog.py

changeset 6121
d3d64f3128b3
parent 6048
82ad8ec9548c
child 6469
70855c97dd09
--- a/WebBrowser/SpellCheck/ManageDictionariesDialog.py	Wed Feb 07 18:57:46 2018 +0100
+++ b/WebBrowser/SpellCheck/ManageDictionariesDialog.py	Wed Feb 07 20:14:09 2018 +0100
@@ -194,7 +194,8 @@
             request.setAttribute(QNetworkRequest.CacheLoadControlAttribute,
                                  QNetworkRequest.AlwaysNetwork)
             reply = WebBrowserWindow.networkManager().get(request)
-            reply.finished.connect(self.__listFileDownloaded)
+            reply.finished.connect(
+                lambda: self.__listFileDownloaded(reply))
             reply.downloadProgress.connect(self.__downloadProgress)
             self.__replies.append(reply)
         else:
@@ -206,10 +207,13 @@
                     """ from {0}.</p><p>Error: {1}</p>"""
                 ).format(url, self.tr("Computer is offline.")))
     
-    def __listFileDownloaded(self):
+    def __listFileDownloaded(self, reply):
         """
         Private method called, after the dictionaries list file has been
         downloaded from the Internet.
+        
+        @param reply reference to the network reply
+        @type QNetworkReply
         """
         self.__refreshButton.setEnabled(True)
         self.__cancelButton.setEnabled(False)
@@ -217,7 +221,6 @@
         
         self.downloadProgress.setValue(0)
         
-        reply = self.sender()
         if reply in self.__replies:
             self.__replies.remove(reply)
         reply.deleteLater()
@@ -382,7 +385,8 @@
                 request.setAttribute(QNetworkRequest.CacheLoadControlAttribute,
                                      QNetworkRequest.AlwaysNetwork)
                 reply = WebBrowserWindow.networkManager().get(request)
-                reply.finished.connect(self.__installDictionary)
+                reply.finished.connect(
+                    lambda: self.__installDictionary(reply))
                 reply.downloadProgress.connect(self.__downloadProgress)
                 self.__replies.append(reply)
             else:
@@ -398,11 +402,13 @@
             
             self.__installationFinished()
     
-    def __installDictionary(self):
+    def __installDictionary(self, reply):
         """
         Private slot to install the downloaded dictionary.
+        
+        @param reply reference to the network reply
+        @type QNetworkReply
         """
-        reply = self.sender()
         if reply in self.__replies:
             self.__replies.remove(reply)
         reply.deleteLater()

eric ide

mercurial