Plugins/VcsPlugins/vcsGit/GitDiffGenerator.py

changeset 6115
ac3a98f3ebc2
parent 6048
82ad8ec9548c
child 6645
ad476851d7e0
equal deleted inserted replaced
6113:0cf5c9683a51 6115:ac3a98f3ebc2
40 40
41 self.vcs = vcs 41 self.vcs = vcs
42 42
43 self.process = QProcess() 43 self.process = QProcess()
44 self.process.finished.connect(self.__procFinished) 44 self.process.finished.connect(self.__procFinished)
45 self.process.readyReadStandardOutput.connect(self.__readStdout) 45 self.process.readyReadStandardOutput.connect(
46 self.process.readyReadStandardError.connect(self.__readStderr) 46 lambda: self.__readStdout(self.process))
47 self.process.readyReadStandardError.connect(
48 lambda: self.__readStderr(self.process))
47 49
48 self.process2 = QProcess() 50 self.process2 = QProcess()
49 self.process2.finished.connect(self.__procFinished) 51 self.process2.finished.connect(self.__procFinished)
50 self.process2.readyReadStandardOutput.connect(self.__readStdout) 52 self.process2.readyReadStandardOutput.connect(
51 self.process2.readyReadStandardError.connect(self.__readStderr) 53 lambda: self.__readStdout(self.process2))
54 self.process2.readyReadStandardError.connect(
55 lambda: self.__readStderr(self.process2))
52 56
53 def stopProcesses(self): 57 def stopProcesses(self):
54 """ 58 """
55 Public slot to stop the diff processes. 59 Public slot to stop the diff processes.
56 """ 60 """
206 if isTopDiff: 210 if isTopDiff:
207 self.__output1.append(line) 211 self.__output1.append(line)
208 else: 212 else:
209 self.__output2.append(line) 213 self.__output2.append(line)
210 214
211 def __readStdout(self): 215 def __readStdout(self, process):
212 """ 216 """
213 Private slot to handle the readyReadStandardOutput signal. 217 Private slot to handle the readyReadStandardOutput signal.
214 218
215 It reads the output of the process, formats it and inserts it into 219 It reads the output of the process, formats it and inserts it into
216 the contents pane. 220 the contents pane.
217 """ 221
218 process = self.sender() 222 @param process reference to the process providing output
223 @type QProcess
224 """
219 process.setReadChannel(QProcess.StandardOutput) 225 process.setReadChannel(QProcess.StandardOutput)
220 226
221 isTopDiff = process == self.process 227 isTopDiff = process == self.process
222 228
223 while process.canReadLine(): 229 while process.canReadLine():
224 line = str(process.readLine(), self.__ioEncoding, 230 line = str(process.readLine(), self.__ioEncoding,
225 'replace') 231 'replace')
226 self.__processLine(line, isTopDiff) 232 self.__processLine(line, isTopDiff)
227 233
228 def __readStderr(self): 234 def __readStderr(self, process):
229 """ 235 """
230 Private slot to handle the readyReadStandardError signal. 236 Private slot to handle the readyReadStandardError signal.
231 237
232 It reads the error output of the process and inserts it into the 238 It reads the error output of the process and inserts it into the
233 error pane. 239 error pane.
234 """ 240
235 if self.process is not None: 241 @param process reference to the process providing error output
236 s = str(self.process.readAllStandardError(), 242 @type QProcess
237 self.__ioEncoding, 'replace') 243 """
238 self.__errors.append(s) 244 s = str(process.readAllStandardError(), self.__ioEncoding,
245 'replace')
246 self.__errors.append(s)

eric ide

mercurial