36 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
36 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
37 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
37 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
38 |
38 |
39 self.process = QProcess() |
39 self.process = QProcess() |
40 self.vcs = vcs |
40 self.vcs = vcs |
|
41 self.__hgClient = vcs.getClient() |
41 |
42 |
42 self.process.finished.connect(self.__procFinished) |
43 self.process.finished.connect(self.__procFinished) |
43 self.process.readyReadStandardOutput.connect(self.__readStdout) |
44 self.process.readyReadStandardOutput.connect(self.__readStdout) |
44 self.process.readyReadStandardError.connect(self.__readStderr) |
45 self.process.readyReadStandardError.connect(self.__readStderr) |
45 |
46 |
75 return |
76 return |
76 |
77 |
77 args = [] |
78 args = [] |
78 args.append('qheader') |
79 args.append('qheader') |
79 |
80 |
80 self.process.kill() |
81 if self.__hgClient: |
81 self.process.setWorkingDirectory(repodir) |
82 self.inputGroup.setEnabled(False) |
82 |
83 self.inputGroup.hide() |
83 self.process.start('hg', args) |
84 |
84 procStarted = self.process.waitForStarted() |
85 out, err = self.__hgClient.runcommand(args) |
85 if not procStarted: |
86 if err: |
86 E5MessageBox.critical(self, |
87 self.__showError(err) |
87 self.trUtf8('Process Generation Error'), |
88 if out: |
88 self.trUtf8( |
89 self.__showOutPut(out) |
89 'The process {0} could not be started. ' |
90 self.__finish() |
90 'Ensure, that it is in the search path.' |
91 else: |
91 ).format('hg')) |
92 self.process.kill() |
|
93 self.process.setWorkingDirectory(repodir) |
|
94 |
|
95 self.process.start('hg', args) |
|
96 procStarted = self.process.waitForStarted() |
|
97 if not procStarted: |
|
98 E5MessageBox.critical(self, |
|
99 self.trUtf8('Process Generation Error'), |
|
100 self.trUtf8( |
|
101 'The process {0} could not be started. ' |
|
102 'Ensure, that it is in the search path.' |
|
103 ).format('hg')) |
92 |
104 |
93 def __finish(self): |
105 def __finish(self): |
94 """ |
106 """ |
95 Private slot called when the process finished or the user pressed the button. |
107 Private slot called when the process finished or the user pressed the button. |
96 """ |
108 """ |
114 @param button button that was clicked (QAbstractButton) |
126 @param button button that was clicked (QAbstractButton) |
115 """ |
127 """ |
116 if button == self.buttonBox.button(QDialogButtonBox.Close): |
128 if button == self.buttonBox.button(QDialogButtonBox.Close): |
117 self.close() |
129 self.close() |
118 elif button == self.buttonBox.button(QDialogButtonBox.Cancel): |
130 elif button == self.buttonBox.button(QDialogButtonBox.Cancel): |
119 self.__finish() |
131 if self.__hgClient: |
|
132 self.__hgClient.cancel() |
|
133 else: |
|
134 self.__finish() |
120 |
135 |
121 def __procFinished(self, exitCode, exitStatus): |
136 def __procFinished(self, exitCode, exitStatus): |
122 """ |
137 """ |
123 Private slot connected to the finished signal. |
138 Private slot connected to the finished signal. |
124 |
139 |
136 """ |
151 """ |
137 if self.process is not None: |
152 if self.process is not None: |
138 s = str(self.process.readAllStandardOutput(), |
153 s = str(self.process.readAllStandardOutput(), |
139 Preferences.getSystem("IOEncoding"), |
154 Preferences.getSystem("IOEncoding"), |
140 'replace') |
155 'replace') |
141 self.messageEdit.appendPlainText(s) |
156 self.__showOutput(s) |
|
157 |
|
158 def __showOutput(self, out): |
|
159 """ |
|
160 Private slot to show some output. |
|
161 |
|
162 @param out output to be shown (string) |
|
163 """ |
|
164 self.messageEdit.appendPlainText(out) |
142 |
165 |
143 def __readStderr(self): |
166 def __readStderr(self): |
144 """ |
167 """ |
145 Private slot to handle the readyReadStderr signal. |
168 Private slot to handle the readyReadStderr signal. |
146 |
169 |
149 """ |
172 """ |
150 if self.process is not None: |
173 if self.process is not None: |
151 s = str(self.process.readAllStandardError(), |
174 s = str(self.process.readAllStandardError(), |
152 Preferences.getSystem("IOEncoding"), |
175 Preferences.getSystem("IOEncoding"), |
153 'replace') |
176 'replace') |
154 self.messageEdit.appendPlainText(self.trUtf8("Error: ")) |
177 self.__showError(s) |
155 self.messageEdit.appendPlainText(s) |
178 |
|
179 def __showError(self, out): |
|
180 """ |
|
181 Private slot to show some error. |
|
182 |
|
183 @param out error to be shown (string) |
|
184 """ |
|
185 self.messageEdit.appendPlainText(self.trUtf8("Error: ")) |
|
186 self.messageEdit.appendPlainText(out) |