15 from E5Gui import E5MessageBox |
15 from E5Gui import E5MessageBox |
16 |
16 |
17 from .Ui_SvnDialog import Ui_SvnDialog |
17 from .Ui_SvnDialog import Ui_SvnDialog |
18 |
18 |
19 import Preferences |
19 import Preferences |
|
20 |
20 |
21 |
21 class SvnDialog(QDialog, Ui_SvnDialog): |
22 class SvnDialog(QDialog, Ui_SvnDialog): |
22 """ |
23 """ |
23 Class implementing a dialog starting a process and showing its output. |
24 Class implementing a dialog starting a process and showing its output. |
24 |
25 |
25 It starts a QProcess and displays a dialog that |
26 It starts a QProcess and displays a dialog that |
26 shows the output of the process. The dialog is modal, |
27 shows the output of the process. The dialog is modal, |
27 which causes a synchronized execution of the process. |
28 which causes a synchronized execution of the process. |
28 """ |
29 """ |
29 def __init__(self, text, parent = None): |
30 def __init__(self, text, parent=None): |
30 """ |
31 """ |
31 Constructor |
32 Constructor |
32 |
33 |
33 @param text text to be shown by the label (string) |
34 @param text text to be shown by the label (string) |
34 @param parent parent widget (QWidget) |
35 @param parent parent widget (QWidget) |
87 @param exitStatus exit status of the process (QProcess.ExitStatus) |
88 @param exitStatus exit status of the process (QProcess.ExitStatus) |
88 """ |
89 """ |
89 self.normal = (exitStatus == QProcess.NormalExit) and (exitCode == 0) |
90 self.normal = (exitStatus == QProcess.NormalExit) and (exitCode == 0) |
90 self.__finish() |
91 self.__finish() |
91 |
92 |
92 def startProcess(self, args, workingDir = None): |
93 def startProcess(self, args, workingDir=None): |
93 """ |
94 """ |
94 Public slot used to start the process. |
95 Public slot used to start the process. |
95 |
96 |
96 @param args list of arguments for the process (list of strings) |
97 @param args list of arguments for the process (list of strings) |
97 @param workingDir working directory for the process (string) |
98 @param workingDir working directory for the process (string) |
147 """ |
148 """ |
148 return self.normal |
149 return self.normal |
149 |
150 |
150 def __readStdout(self): |
151 def __readStdout(self): |
151 """ |
152 """ |
152 Private slot to handle the readyReadStdout signal. |
153 Private slot to handle the readyReadStdout signal. |
153 |
154 |
154 It reads the output of the process, formats it and inserts it into |
155 It reads the output of the process, formats it and inserts it into |
155 the contents pane. |
156 the contents pane. |
156 """ |
157 """ |
157 if self.proc is not None: |
158 if self.proc is not None: |
158 s = str(self.proc.readAllStandardOutput(), |
159 s = str(self.proc.readAllStandardOutput(), |
159 Preferences.getSystem("IOEncoding"), |
160 Preferences.getSystem("IOEncoding"), |
160 'replace') |
161 'replace') |
161 self.resultbox.insertPlainText(s) |
162 self.resultbox.insertPlainText(s) |
162 self.resultbox.ensureCursorVisible() |
163 self.resultbox.ensureCursorVisible() |
163 if not self.__hasAddOrDelete and len(s) > 0: |
164 if not self.__hasAddOrDelete and len(s) > 0: |
164 # check the output |
165 # check the output |
174 It reads the error output of the process and inserts it into the |
175 It reads the error output of the process and inserts it into the |
175 error pane. |
176 error pane. |
176 """ |
177 """ |
177 if self.proc is not None: |
178 if self.proc is not None: |
178 self.errorGroup.show() |
179 self.errorGroup.show() |
179 s = str(self.proc.readAllStandardError(), |
180 s = str(self.proc.readAllStandardError(), |
180 Preferences.getSystem("IOEncoding"), |
181 Preferences.getSystem("IOEncoding"), |
181 'replace') |
182 'replace') |
182 self.errors.insertPlainText(s) |
183 self.errors.insertPlainText(s) |
183 self.errors.ensureCursorVisible() |
184 self.errors.ensureCursorVisible() |
184 |
185 |
185 def on_passwordCheckBox_toggled(self, isOn): |
186 def on_passwordCheckBox_toggled(self, isOn): |