37 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
37 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
38 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
38 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
39 |
39 |
40 self.process = QProcess() |
40 self.process = QProcess() |
41 self.vcs = vcs |
41 self.vcs = vcs |
|
42 self.__hgClient = vcs.getClient() |
42 |
43 |
43 self.patchesList.header().setSortIndicator(0, Qt.AscendingOrder) |
44 self.patchesList.header().setSortIndicator(0, Qt.AscendingOrder) |
44 |
45 |
45 self.process.finished.connect(self.__procFinished) |
46 self.process.finished.connect(self.__procFinished) |
46 self.process.readyReadStandardOutput.connect(self.__readStdout) |
47 self.process.readyReadStandardOutput.connect(self.__readStdout) |
108 args.append('--summary') |
109 args.append('--summary') |
109 args.append('--verbose') |
110 args.append('--verbose') |
110 if missing: |
111 if missing: |
111 args.append('--missing') |
112 args.append('--missing') |
112 |
113 |
113 self.process.kill() |
114 if self.__hgClient: |
114 self.process.setWorkingDirectory(self.__repodir) |
|
115 |
|
116 self.process.start('hg', args) |
|
117 procStarted = self.process.waitForStarted() |
|
118 if not procStarted: |
|
119 self.inputGroup.setEnabled(False) |
115 self.inputGroup.setEnabled(False) |
120 self.inputGroup.hide() |
116 self.inputGroup.hide() |
121 E5MessageBox.critical(self, |
117 |
122 self.trUtf8('Process Generation Error'), |
118 out, err = self.__hgClient.runcommand(args) |
123 self.trUtf8( |
119 if err: |
124 'The process {0} could not be started. ' |
120 self.__showError(err) |
125 'Ensure, that it is in the search path.' |
121 if out: |
126 ).format('hg')) |
122 for line in out.splitlines(): |
127 else: |
123 self.__processOutputLine(line) |
128 self.inputGroup.setEnabled(True) |
124 if self.__mode == "qseries": |
129 self.inputGroup.show() |
125 self.__getSeries(True) |
|
126 elif self.__mode == "missing": |
|
127 self.__getTop() |
|
128 else: |
|
129 self.__finish() |
|
130 else: |
|
131 self.process.kill() |
|
132 self.process.setWorkingDirectory(self.__repodir) |
|
133 |
|
134 self.process.start('hg', args) |
|
135 procStarted = self.process.waitForStarted() |
|
136 if not procStarted: |
|
137 self.inputGroup.setEnabled(False) |
|
138 self.inputGroup.hide() |
|
139 E5MessageBox.critical(self, |
|
140 self.trUtf8('Process Generation Error'), |
|
141 self.trUtf8( |
|
142 'The process {0} could not be started. ' |
|
143 'Ensure, that it is in the search path.' |
|
144 ).format('hg')) |
|
145 else: |
|
146 self.inputGroup.setEnabled(True) |
|
147 self.inputGroup.show() |
130 |
148 |
131 def __getTop(self): |
149 def __getTop(self): |
132 """ |
150 """ |
133 Private slot to get patch at the top of the stack. |
151 Private slot to get patch at the top of the stack. |
134 """ |
152 """ |
135 self.__mode = "qtop" |
153 self.__mode = "qtop" |
136 |
154 |
137 args = [] |
155 args = [] |
138 args.append('qtop') |
156 args.append('qtop') |
139 |
157 |
140 self.process.kill() |
158 if self.__hgClient: |
141 self.process.setWorkingDirectory(self.__repodir) |
|
142 |
|
143 self.process.start('hg', args) |
|
144 procStarted = self.process.waitForStarted() |
|
145 if not procStarted: |
|
146 self.inputGroup.setEnabled(False) |
159 self.inputGroup.setEnabled(False) |
147 self.inputGroup.hide() |
160 self.inputGroup.hide() |
148 E5MessageBox.critical(self, |
161 |
149 self.trUtf8('Process Generation Error'), |
162 out, err = self.__hgClient.runcommand(args) |
150 self.trUtf8( |
163 if err: |
151 'The process {0} could not be started. ' |
164 self.__showError(err) |
152 'Ensure, that it is in the search path.' |
165 if out: |
153 ).format('hg')) |
166 for line in out.splitlines(): |
154 else: |
167 self.__processOutputLine(line) |
155 self.inputGroup.setEnabled(True) |
168 self.__finish() |
156 self.inputGroup.show() |
169 else: |
|
170 self.process.kill() |
|
171 self.process.setWorkingDirectory(self.__repodir) |
|
172 |
|
173 self.process.start('hg', args) |
|
174 procStarted = self.process.waitForStarted() |
|
175 if not procStarted: |
|
176 self.inputGroup.setEnabled(False) |
|
177 self.inputGroup.hide() |
|
178 E5MessageBox.critical(self, |
|
179 self.trUtf8('Process Generation Error'), |
|
180 self.trUtf8( |
|
181 'The process {0} could not be started. ' |
|
182 'Ensure, that it is in the search path.' |
|
183 ).format('hg')) |
|
184 else: |
|
185 self.inputGroup.setEnabled(True) |
|
186 self.inputGroup.show() |
157 |
187 |
158 def __finish(self): |
188 def __finish(self): |
159 """ |
189 """ |
160 Private slot called when the process finished or the user pressed the button. |
190 Private slot called when the process finished or the user pressed the button. |
161 """ |
191 """ |
290 |
324 |
291 while self.process.canReadLine(): |
325 while self.process.canReadLine(): |
292 s = str(self.process.readLine(), |
326 s = str(self.process.readLine(), |
293 Preferences.getSystem("IOEncoding"), |
327 Preferences.getSystem("IOEncoding"), |
294 'replace').strip() |
328 'replace').strip() |
295 if self.__mode == "qtop": |
329 self.__processOutputLine(s) |
296 self.__markTopItem(s) |
330 |
297 else: |
331 def __processOutputLine(self, line): |
298 l = s.split(": ", 1) |
332 """ |
299 if len(l) == 1: |
333 Private method to process the lines of output. |
300 data, summary = l[0][:-1], "" |
334 |
301 else: |
335 @param line output line to be processed (string) |
302 data, summary = l[0], l[1] |
336 """ |
303 l = data.split(None, 2) |
337 if self.__mode == "qtop": |
304 if len(l) == 2: |
338 self.__markTopItem(line) |
305 # missing entry |
339 else: |
306 index, status, name = -1, l[0], l[1] |
340 l = line.split(": ", 1) |
307 elif len(l) == 3: |
341 if len(l) == 1: |
308 index, status, name = l[:3] |
342 data, summary = l[0][:-1], "" |
309 else: |
343 else: |
310 continue |
344 data, summary = l[0], l[1] |
311 self.__generateItem(index, status, name, summary) |
345 l = data.split(None, 2) |
|
346 if len(l) == 2: |
|
347 # missing entry |
|
348 index, status, name = -1, l[0], l[1] |
|
349 elif len(l) == 3: |
|
350 index, status, name = l[:3] |
|
351 else: |
|
352 return |
|
353 self.__generateItem(index, status, name, summary) |
312 |
354 |
313 def __readStderr(self): |
355 def __readStderr(self): |
314 """ |
356 """ |
315 Private slot to handle the readyReadStderr signal. |
357 Private slot to handle the readyReadStderr signal. |
316 |
358 |
317 It reads the error output of the process and inserts it into the |
359 It reads the error output of the process and inserts it into the |
318 error pane. |
360 error pane. |
319 """ |
361 """ |
320 if self.process is not None: |
362 if self.process is not None: |
321 self.errorGroup.show() |
|
322 s = str(self.process.readAllStandardError(), |
363 s = str(self.process.readAllStandardError(), |
323 Preferences.getSystem("IOEncoding"), |
364 Preferences.getSystem("IOEncoding"), |
324 'replace') |
365 'replace') |
325 self.errors.insertPlainText(s) |
366 self.__showError(s) |
326 self.errors.ensureCursorVisible() |
367 |
|
368 def __showError(self, out): |
|
369 """ |
|
370 Private slot to show some error. |
|
371 |
|
372 @param out error to be shown (string) |
|
373 """ |
|
374 self.errorGroup.show() |
|
375 self.errors.insertPlainText(out) |
|
376 self.errors.ensureCursorVisible() |
327 |
377 |
328 def on_passwordCheckBox_toggled(self, isOn): |
378 def on_passwordCheckBox_toggled(self, isOn): |
329 """ |
379 """ |
330 Private slot to handle the password checkbox toggled. |
380 Private slot to handle the password checkbox toggled. |
331 |
381 |