Plugins/VcsPlugins/vcsGit/GitDiffGenerator.py

changeset 6115
ac3a98f3ebc2
parent 6048
82ad8ec9548c
child 6645
ad476851d7e0
--- a/Plugins/VcsPlugins/vcsGit/GitDiffGenerator.py	Sun Feb 04 10:56:30 2018 +0100
+++ b/Plugins/VcsPlugins/vcsGit/GitDiffGenerator.py	Mon Feb 05 19:15:47 2018 +0100
@@ -42,13 +42,17 @@
         
         self.process = QProcess()
         self.process.finished.connect(self.__procFinished)
-        self.process.readyReadStandardOutput.connect(self.__readStdout)
-        self.process.readyReadStandardError.connect(self.__readStderr)
+        self.process.readyReadStandardOutput.connect(
+            lambda: self.__readStdout(self.process))
+        self.process.readyReadStandardError.connect(
+            lambda: self.__readStderr(self.process))
         
         self.process2 = QProcess()
         self.process2.finished.connect(self.__procFinished)
-        self.process2.readyReadStandardOutput.connect(self.__readStdout)
-        self.process2.readyReadStandardError.connect(self.__readStderr)
+        self.process2.readyReadStandardOutput.connect(
+            lambda: self.__readStdout(self.process2))
+        self.process2.readyReadStandardError.connect(
+            lambda: self.__readStderr(self.process2))
     
     def stopProcesses(self):
         """
@@ -208,14 +212,16 @@
         else:
             self.__output2.append(line)
     
-    def __readStdout(self):
+    def __readStdout(self, process):
         """
         Private slot to handle the readyReadStandardOutput signal.
         
         It reads the output of the process, formats it and inserts it into
         the contents pane.
+        
+        @param process reference to the process providing output
+        @type QProcess
         """
-        process = self.sender()
         process.setReadChannel(QProcess.StandardOutput)
         
         isTopDiff = process == self.process
@@ -225,14 +231,16 @@
                        'replace')
             self.__processLine(line, isTopDiff)
     
-    def __readStderr(self):
+    def __readStderr(self, process):
         """
         Private slot to handle the readyReadStandardError signal.
         
         It reads the error output of the process and inserts it into the
         error pane.
+        
+        @param process reference to the process providing error output
+        @type QProcess
         """
-        if self.process is not None:
-            s = str(self.process.readAllStandardError(),
-                    self.__ioEncoding, 'replace')
-            self.__errors.append(s)
+        s = str(process.readAllStandardError(), self.__ioEncoding,
+                'replace')
+        self.__errors.append(s)

eric ide

mercurial