71 self.show() |
71 self.show() |
72 QCoreApplication.processEvents() |
72 QCoreApplication.processEvents() |
73 |
73 |
74 def finish(self): |
74 def finish(self): |
75 """ |
75 """ |
76 Public slot called when the process finished or the user pressed the button. |
76 Public slot called when the process finished or the user pressed the |
|
77 button. |
77 """ |
78 """ |
78 if self.proc is not None and \ |
79 if self.proc is not None and \ |
79 self.proc.state() != QProcess.NotRunning: |
80 self.proc.state() != QProcess.NotRunning: |
80 self.proc.terminate() |
81 self.proc.terminate() |
81 QTimer.singleShot(2000, self.proc.kill) |
82 QTimer.singleShot(2000, self.proc.kill) |
87 self.proc = None |
88 self.proc = None |
88 |
89 |
89 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
90 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
90 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
91 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
91 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
92 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
92 self.buttonBox.button(QDialogButtonBox.Close).setFocus(Qt.OtherFocusReason) |
93 self.buttonBox.button(QDialogButtonBox.Close).setFocus( |
|
94 Qt.OtherFocusReason) |
93 |
95 |
94 if self.argsLists: |
96 if self.argsLists: |
95 args = self.argsLists[0][:] |
97 args = self.argsLists[0][:] |
96 del self.argsLists[0] |
98 del self.argsLists[0] |
97 self.startProcess(args[0], args[1:], self.workingDir) |
99 self.startProcess(args[0], args[1:], self.workingDir) |
138 self.intercept = False |
140 self.intercept = False |
139 |
141 |
140 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
142 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
141 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) |
143 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) |
142 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
144 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
143 self.buttonBox.button(QDialogButtonBox.Cancel).setFocus(Qt.OtherFocusReason) |
145 self.buttonBox.button(QDialogButtonBox.Cancel).setFocus( |
|
146 Qt.OtherFocusReason) |
144 |
147 |
145 if showArgs: |
148 if showArgs: |
146 self.resultbox.append(command + ' ' + ' '.join(args)) |
149 self.resultbox.append(command + ' ' + ' '.join(args)) |
147 self.resultbox.append('') |
150 self.resultbox.append('') |
148 |
151 |
157 self.proc.start(command, args) |
160 self.proc.start(command, args) |
158 procStarted = self.proc.waitForStarted() |
161 procStarted = self.proc.waitForStarted() |
159 if not procStarted: |
162 if not procStarted: |
160 self.buttonBox.setFocus() |
163 self.buttonBox.setFocus() |
161 self.inputGroup.setEnabled(False) |
164 self.inputGroup.setEnabled(False) |
162 E5MessageBox.critical(self, |
165 E5MessageBox.critical( |
|
166 self, |
163 self.trUtf8('Process Generation Error'), |
167 self.trUtf8('Process Generation Error'), |
164 self.trUtf8( |
168 self.trUtf8( |
165 'The process {0} could not be started. ' |
169 'The process {0} could not be started. ' |
166 'Ensure, that it is in the search path.' |
170 'Ensure, that it is in the search path.' |
167 ).format(command)) |
171 ).format(command)) |
175 Public slot used to start a batch of processes. |
179 Public slot used to start a batch of processes. |
176 |
180 |
177 @param argsLists list of lists of arguments for the processes |
181 @param argsLists list of lists of arguments for the processes |
178 (list of list of string) |
182 (list of list of string) |
179 @param workingDir working directory for the process (string) |
183 @param workingDir working directory for the process (string) |
180 @return flag indicating a successful start of the first process (boolean) |
184 @return flag indicating a successful start of the first process |
|
185 (boolean) |
181 """ |
186 """ |
182 self.argsLists = argsLists[:] |
187 self.argsLists = argsLists[:] |
183 self.workingDir = workingDir |
188 self.workingDir = workingDir |
184 |
189 |
185 # start the first process |
190 # start the first process |
215 It reads the output of the process, formats it and inserts it into |
220 It reads the output of the process, formats it and inserts it into |
216 the contents pane. |
221 the contents pane. |
217 """ |
222 """ |
218 if self.proc is not None: |
223 if self.proc is not None: |
219 out = str(self.proc.readAllStandardOutput(), |
224 out = str(self.proc.readAllStandardOutput(), |
220 Preferences.getSystem("IOEncoding"), |
225 Preferences.getSystem("IOEncoding"), |
221 'replace') |
226 'replace') |
222 self.resultbox.insertPlainText(out) |
227 self.resultbox.insertPlainText(out) |
223 self.resultbox.ensureCursorVisible() |
228 self.resultbox.ensureCursorVisible() |
224 |
229 |
225 QCoreApplication.processEvents() |
230 QCoreApplication.processEvents() |
226 |
231 |
231 It reads the error output of the process and inserts it into the |
236 It reads the error output of the process and inserts it into the |
232 error pane. |
237 error pane. |
233 """ |
238 """ |
234 if self.proc is not None: |
239 if self.proc is not None: |
235 err = str(self.proc.readAllStandardError(), |
240 err = str(self.proc.readAllStandardError(), |
236 Preferences.getSystem("IOEncoding"), |
241 Preferences.getSystem("IOEncoding"), |
237 'replace') |
242 'replace') |
238 self.errorGroup.show() |
243 self.errorGroup.show() |
239 self.errors.insertPlainText(err) |
244 self.errors.insertPlainText(err) |
240 self.errors.ensureCursorVisible() |
245 self.errors.ensureCursorVisible() |
241 |
246 |
242 QCoreApplication.processEvents() |
247 QCoreApplication.processEvents() |