25 |
25 |
26 It starts a QProcess and displays a dialog that |
26 It starts a QProcess and displays a dialog that |
27 shows the output of the process. The dialog is modal, |
27 shows the output of the process. The dialog is modal, |
28 which causes a synchronized execution of the process. |
28 which causes a synchronized execution of the process. |
29 """ |
29 """ |
30 def __init__(self, text, fixed = False, linewrap = True, |
30 def __init__(self, text, fixed=False, linewrap=True, |
31 msgSuccess = None, msgError = None, |
31 msgSuccess=None, msgError=None, |
32 saveFilters = None, |
32 saveFilters=None, |
33 parent = None): |
33 parent=None): |
34 """ |
34 """ |
35 Constructor |
35 Constructor |
36 |
36 |
37 @param text text to be shown by the label (string) |
37 @param text text to be shown by the label (string) |
38 @keyparam fixed flag indicating a fixed font should be used (boolean) |
38 @keyparam fixed flag indicating a fixed font should be used (boolean) |
106 self.proc = None |
106 self.proc = None |
107 |
107 |
108 if self.argsLists: |
108 if self.argsLists: |
109 args = self.argsLists[0][:] |
109 args = self.argsLists[0][:] |
110 del self.argsLists[0] |
110 del self.argsLists[0] |
111 self.startProcess(args, self.workingDir, mergedOutput = self.mergedOutput) |
111 self.startProcess(args, self.workingDir, mergedOutput=self.mergedOutput) |
112 |
112 |
113 def __procFinished(self, exitCode, exitStatus): |
113 def __procFinished(self, exitCode, exitStatus): |
114 """ |
114 """ |
115 Private slot connected to the finished signal. |
115 Private slot connected to the finished signal. |
116 |
116 |
125 elif not self.normal and self.msgError: |
125 elif not self.normal and self.msgError: |
126 self.resultbox.insertPlainText(self.msgError) |
126 self.resultbox.insertPlainText(self.msgError) |
127 self.errorGroup.show() |
127 self.errorGroup.show() |
128 self.resultbox.ensureCursorVisible() |
128 self.resultbox.ensureCursorVisible() |
129 |
129 |
130 def startProcess(self, args, workingDir = None, showCommand = True, |
130 def startProcess(self, args, workingDir=None, showCommand=True, |
131 mergedOutput = False): |
131 mergedOutput=False): |
132 """ |
132 """ |
133 Public slot used to start the process. |
133 Public slot used to start the process. |
134 |
134 |
135 @param args list of arguments for the process (list of strings) |
135 @param args list of arguments for the process (list of strings) |
136 @param workingDir working directory for the process (string) |
136 @param workingDir working directory for the process (string) |
172 'The process {0} could not be started. ' |
172 'The process {0} could not be started. ' |
173 'Ensure, that it is in the search path.' |
173 'Ensure, that it is in the search path.' |
174 ).format(prog)) |
174 ).format(prog)) |
175 return procStarted |
175 return procStarted |
176 |
176 |
177 def startBatchProcesses(self, argsLists, workingDir = None, mergedOutput = False): |
177 def startBatchProcesses(self, argsLists, workingDir=None, mergedOutput=False): |
178 """ |
178 """ |
179 Public slot used to start a batch of processes. |
179 Public slot used to start a batch of processes. |
180 |
180 |
181 @param argsLists list of lists of arguments for the processes |
181 @param argsLists list of lists of arguments for the processes |
182 (list of lists of strings) |
182 (list of lists of strings) |
189 self.mergedOutput = mergedOutput |
189 self.mergedOutput = mergedOutput |
190 |
190 |
191 # start the first process |
191 # start the first process |
192 args = self.argsLists[0][:] |
192 args = self.argsLists[0][:] |
193 del self.argsLists[0] |
193 del self.argsLists[0] |
194 res = self.startProcess(args, self.workingDir, mergedOutput = self.mergedOutput) |
194 res = self.startProcess(args, self.workingDir, mergedOutput=self.mergedOutput) |
195 if not res: |
195 if not res: |
196 self.argsLists = [] |
196 self.argsLists = [] |
197 |
197 |
198 return res |
198 return res |
199 |
199 |
214 """ |
214 """ |
215 return self.normal and self.errors.toPlainText() == "" |
215 return self.normal and self.errors.toPlainText() == "" |
216 |
216 |
217 def __readStdout(self): |
217 def __readStdout(self): |
218 """ |
218 """ |
219 Private slot to handle the readyReadStdout signal. |
219 Private slot to handle the readyReadStdout signal. |
220 |
220 |
221 It reads the output of the process, formats it and inserts it into |
221 It reads the output of the process, formats it and inserts it into |
222 the contents pane. |
222 the contents pane. |
223 """ |
223 """ |
224 if self.proc is not None: |
224 if self.proc is not None: |