16 |
16 |
17 from .Ui_EricdocExecDialog import Ui_EricdocExecDialog |
17 from .Ui_EricdocExecDialog import Ui_EricdocExecDialog |
18 |
18 |
19 import Preferences |
19 import Preferences |
20 |
20 |
|
21 |
21 class EricdocExecDialog(QDialog, Ui_EricdocExecDialog): |
22 class EricdocExecDialog(QDialog, Ui_EricdocExecDialog): |
22 """ |
23 """ |
23 Class implementing a dialog to show the output of the ericdoc process. |
24 Class implementing a dialog to show the output of the ericdoc process. |
24 |
25 |
25 This class starts a QProcess and displays a dialog that |
26 This class starts a QProcess and displays a dialog that |
26 shows the output of the documentation command process. |
27 shows the output of the documentation command process. |
27 """ |
28 """ |
28 def __init__(self, cmdname, parent = None): |
29 def __init__(self, cmdname, parent=None): |
29 """ |
30 """ |
30 Constructor |
31 Constructor |
31 |
32 |
32 @param cmdname name of the documentation generator (string) |
33 @param cmdname name of the documentation generator (string) |
33 @param parent parent widget of this dialog (QWidget) |
34 @param parent parent widget of this dialog (QWidget) |
123 self.trUtf8('\n{0} finished.\n').format(self.cmdname)) |
124 self.trUtf8('\n{0} finished.\n').format(self.cmdname)) |
124 self.contents.ensureCursorVisible() |
125 self.contents.ensureCursorVisible() |
125 |
126 |
126 def __readStdout(self): |
127 def __readStdout(self): |
127 """ |
128 """ |
128 Private slot to handle the readyReadStandardOutput signal. |
129 Private slot to handle the readyReadStandardOutput signal. |
129 |
130 |
130 It reads the output of the process, formats it and inserts it into |
131 It reads the output of the process, formats it and inserts it into |
131 the contents pane. |
132 the contents pane. |
132 """ |
133 """ |
133 self.process.setReadChannel(QProcess.StandardOutput) |
134 self.process.setReadChannel(QProcess.StandardOutput) |
134 |
135 |
135 while self.process.canReadLine(): |
136 while self.process.canReadLine(): |
136 s = str(self.process.readLine(), |
137 s = str(self.process.readLine(), |
137 Preferences.getSystem("IOEncoding"), |
138 Preferences.getSystem("IOEncoding"), |
138 'replace') |
139 'replace') |
139 self.contents.insertPlainText(s) |
140 self.contents.insertPlainText(s) |
140 self.contents.ensureCursorVisible() |
141 self.contents.ensureCursorVisible() |
141 |
142 |
142 def __readStderr(self): |
143 def __readStderr(self): |
143 """ |
144 """ |
144 Private slot to handle the readyReadStandardError signal. |
145 Private slot to handle the readyReadStandardError signal. |
145 |
146 |
146 It reads the error output of the process and inserts it into the |
147 It reads the error output of the process and inserts it into the |
147 error pane. |
148 error pane. |
148 """ |
149 """ |
149 self.process.setReadChannel(QProcess.StandardError) |
150 self.process.setReadChannel(QProcess.StandardError) |
150 |
151 |
151 while self.process.canReadLine(): |
152 while self.process.canReadLine(): |
152 self.errorGroup.show() |
153 self.errorGroup.show() |
153 s = str(self.process.readLine(), |
154 s = str(self.process.readLine(), |
154 Preferences.getSystem("IOEncoding"), |
155 Preferences.getSystem("IOEncoding"), |
155 'replace') |
156 'replace') |
156 self.errors.insertPlainText(s) |
157 self.errors.insertPlainText(s) |
157 self.errors.ensureCursorVisible() |
158 self.errors.ensureCursorVisible() |