77 self.show() |
77 self.show() |
78 QCoreApplication.processEvents() |
78 QCoreApplication.processEvents() |
79 |
79 |
80 def finish(self): |
80 def finish(self): |
81 """ |
81 """ |
82 Public slot called when the process finished or the user pressed the button. |
82 Public slot called when the process finished or the user pressed the |
|
83 button. |
83 """ |
84 """ |
84 if self.proc is not None and \ |
85 if self.proc is not None and \ |
85 self.proc.state() != QProcess.NotRunning: |
86 self.proc.state() != QProcess.NotRunning: |
86 self.proc.terminate() |
87 self.proc.terminate() |
87 QTimer.singleShot(2000, self.proc.kill) |
88 QTimer.singleShot(2000, self.proc.kill) |
93 self.proc = None |
94 self.proc = None |
94 |
95 |
95 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
96 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
96 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
97 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
97 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
98 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
98 self.buttonBox.button(QDialogButtonBox.Close).setFocus(Qt.OtherFocusReason) |
99 self.buttonBox.button(QDialogButtonBox.Close).setFocus( |
|
100 Qt.OtherFocusReason) |
99 |
101 |
100 if self.argsLists: |
102 if self.argsLists: |
101 args = self.argsLists[0][:] |
103 args = self.argsLists[0][:] |
102 del self.argsLists[0] |
104 del self.argsLists[0] |
103 self.startProcess(args[0], args[1:], self.workingDir) |
105 self.startProcess(args[0], args[1:], self.workingDir) |
144 self.intercept = False |
146 self.intercept = False |
145 |
147 |
146 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
148 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
147 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) |
149 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) |
148 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
150 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
149 self.buttonBox.button(QDialogButtonBox.Cancel).setFocus(Qt.OtherFocusReason) |
151 self.buttonBox.button(QDialogButtonBox.Cancel).setFocus( |
|
152 Qt.OtherFocusReason) |
150 |
153 |
151 if showArgs: |
154 if showArgs: |
152 self.resultbox.append(command + ' ' + ' '.join(args)) |
155 self.resultbox.append(command + ' ' + ' '.join(args)) |
153 self.resultbox.append('') |
156 self.resultbox.append('') |
154 |
157 |
163 self.proc.start(command, args) |
166 self.proc.start(command, args) |
164 procStarted = self.proc.waitForStarted() |
167 procStarted = self.proc.waitForStarted() |
165 if not procStarted: |
168 if not procStarted: |
166 self.buttonBox.setFocus() |
169 self.buttonBox.setFocus() |
167 self.inputGroup.setEnabled(False) |
170 self.inputGroup.setEnabled(False) |
168 E5MessageBox.critical(self, |
171 E5MessageBox.critical( |
|
172 self, |
169 self.trUtf8('Process Generation Error'), |
173 self.trUtf8('Process Generation Error'), |
170 self.trUtf8( |
174 self.trUtf8( |
171 'The process {0} could not be started. ' |
175 'The process {0} could not be started. ' |
172 'Ensure, that it is in the search path.' |
176 'Ensure, that it is in the search path.' |
173 ).format(command)) |
177 ).format(command)) |
181 Public slot used to start a batch of processes. |
185 Public slot used to start a batch of processes. |
182 |
186 |
183 @param argsLists list of lists of arguments for the processes |
187 @param argsLists list of lists of arguments for the processes |
184 (list of list of string) |
188 (list of list of string) |
185 @param workingDir working directory for the process (string) |
189 @param workingDir working directory for the process (string) |
186 @return flag indicating a successful start of the first process (boolean) |
190 @return flag indicating a successful start of the first process |
|
191 (boolean) |
187 """ |
192 """ |
188 self.argsLists = argsLists[:] |
193 self.argsLists = argsLists[:] |
189 self.workingDir = workingDir |
194 self.workingDir = workingDir |
190 |
195 |
191 # start the first process |
196 # start the first process |
221 It reads the output of the process, formats it and inserts it into |
226 It reads the output of the process, formats it and inserts it into |
222 the contents pane. |
227 the contents pane. |
223 """ |
228 """ |
224 if self.proc is not None: |
229 if self.proc is not None: |
225 out = str(self.proc.readAllStandardOutput(), |
230 out = str(self.proc.readAllStandardOutput(), |
226 Preferences.getSystem("IOEncoding"), |
231 Preferences.getSystem("IOEncoding"), |
227 'replace') |
232 'replace') |
228 self.resultbox.insertPlainText(out) |
233 self.resultbox.insertPlainText(out) |
229 self.resultbox.ensureCursorVisible() |
234 self.resultbox.ensureCursorVisible() |
230 |
235 |
231 QCoreApplication.processEvents() |
236 QCoreApplication.processEvents() |
232 |
237 |
237 It reads the error output of the process and inserts it into the |
242 It reads the error output of the process and inserts it into the |
238 error pane. |
243 error pane. |
239 """ |
244 """ |
240 if self.proc is not None: |
245 if self.proc is not None: |
241 err = str(self.proc.readAllStandardError(), |
246 err = str(self.proc.readAllStandardError(), |
242 Preferences.getSystem("IOEncoding"), |
247 Preferences.getSystem("IOEncoding"), |
243 'replace') |
248 'replace') |
244 self.errorGroup.show() |
249 self.errorGroup.show() |
245 self.errors.insertPlainText(err) |
250 self.errors.insertPlainText(err) |
246 self.errors.ensureCursorVisible() |
251 self.errors.ensureCursorVisible() |
247 |
252 |
248 QCoreApplication.processEvents() |
253 QCoreApplication.processEvents() |