ProjectTranslationsBrowser: fixed some 'lambda' related issues by converting them to 'functools.partial'.

Sat, 02 Jan 2021 15:19:11 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 02 Jan 2021 15:19:11 +0100
changeset 7938
1d3a2a0dac22
parent 7937
181d1160f617
child 7941
cf988a30ba47

ProjectTranslationsBrowser: fixed some 'lambda' related issues by converting them to 'functools.partial'.

eric6/Project/ProjectTranslationsBrowser.py file | annotate | diff | comparison | revisions
--- a/eric6/Project/ProjectTranslationsBrowser.py	Sat Jan 02 15:18:36 2021 +0100
+++ b/eric6/Project/ProjectTranslationsBrowser.py	Sat Jan 02 15:19:11 2021 +0100
@@ -11,6 +11,7 @@
 import os
 import shutil
 import fnmatch
+import functools
 
 from PyQt5.QtCore import pyqtSignal, QProcess
 from PyQt5.QtWidgets import QDialog, QMenu
@@ -922,16 +923,16 @@
         if self.hooks["extractMessages"] is not None:
             self.hooks["extractMessages"]()
         
-    def __generateTSFileDone(self, exitCode, exitStatus, proc):
+    def __generateTSFileDone(self, proc, exitCode, exitStatus):
         """
         Private slot to handle the finished signal of the pylupdate process.
         
+        @param proc reference to the process
+        @type QProcess
         @param exitCode exit code of the process
         @type int
         @param exitStatus exit status of the process
         @type QProcess.ExitStatus
-        @param proc reference to the process
-        @type QProcess
         """
         if exitStatus == QProcess.NormalExit and exitCode == 0:
             ui = e5App().getObject("UserInterface")
@@ -1078,11 +1079,14 @@
                 
                 proc.setWorkingDirectory(self.project.ppath)
                 proc.finished.connect(
-                    lambda c, s: self.__generateTSFileDone(c, s, proc))
+                    functools.partial(self.__generateTSFileDone, proc)
+                )
                 proc.readyReadStandardOutput.connect(
-                    lambda: self.__readStdoutLupdate(proc))
+                    functools.partial(self.__readStdoutLupdate, proc)
+                )
                 proc.readyReadStandardError.connect(
-                    lambda: self.__readStderrLupdate(proc))
+                    functools.partial(self.__readStderrLupdate, proc)
+                )
                 
                 proc.start(self.pylupdate, args)
                 procStarted = proc.waitForStarted()
@@ -1111,11 +1115,14 @@
                 proc.setWorkingDirectory(
                     os.path.join(self.project.ppath, path))
                 proc.finished.connect(
-                    lambda c, s: self.__generateTSFileDone(c, s, proc))
+                    functools.partial(self.__generateTSFileDone, proc)
+                )
                 proc.readyReadStandardOutput.connect(
-                    lambda: self.__readStdoutLupdate(proc))
+                    functools.partial(self.__readStdoutLupdate, proc)
+                )
                 proc.readyReadStandardError.connect(
-                    lambda: self.__readStderrLupdate(proc))
+                    functools.partial(self.__readStderrLupdate, proc)
+                )
                 
                 proc.start(self.pylupdate, args)
                 procStarted = proc.waitForStarted()
@@ -1175,16 +1182,16 @@
     ##  Methods for the release commands
     ###########################################################################
     
-    def __releaseTSFileDone(self, exitCode, exitStatus, proc):
+    def __releaseTSFileDone(self, proc, exitCode, exitStatus):
         """
         Private slot to handle the finished signal of the lrelease process.
         
+        @param proc reference to the process
+        @type QProcess
         @param exitCode exit code of the process
         @type int
         @param exitStatus exit status of the process
         @type QProcess.ExitStatus
-        @param proc reference to the process
-        @type QProcess
         """
         if exitStatus == QProcess.NormalExit and exitCode == 0:
             ui = e5App().getObject("UserInterface")
@@ -1290,11 +1297,14 @@
         proc = QProcess()
         proc.setWorkingDirectory(os.path.join(self.project.ppath, path))
         proc.finished.connect(
-            lambda c, s: self.__releaseTSFileDone(c, s, proc))
+            functools.partial(self.__releaseTSFileDone, proc)
+        )
         proc.readyReadStandardOutput.connect(
-            lambda: self.__readStdoutLrelease(proc))
+            functools.partial(self.__readStdoutLrelease, proc)
+        )
         proc.readyReadStandardError.connect(
-            lambda: self.__readStderrLrelease(proc))
+            functools.partial(self.__readStderrLrelease, proc)
+        )
         
         proc.start(lrelease, args)
         procStarted = proc.waitForStarted()

eric ide

mercurial