26 |
30 |
27 class GitReflogBrowserDialog(QWidget, Ui_GitReflogBrowserDialog): |
31 class GitReflogBrowserDialog(QWidget, Ui_GitReflogBrowserDialog): |
28 """ |
32 """ |
29 Class implementing a dialog to browse the reflog history. |
33 Class implementing a dialog to browse the reflog history. |
30 """ |
34 """ |
|
35 |
31 CommitIdColumn = 0 |
36 CommitIdColumn = 0 |
32 SelectorColumn = 1 |
37 SelectorColumn = 1 |
33 NameColumn = 2 |
38 NameColumn = 2 |
34 OperationColumn = 3 |
39 OperationColumn = 3 |
35 SubjectColumn = 4 |
40 SubjectColumn = 4 |
36 |
41 |
37 def __init__(self, vcs, parent=None): |
42 def __init__(self, vcs, parent=None): |
38 """ |
43 """ |
39 Constructor |
44 Constructor |
40 |
45 |
41 @param vcs reference to the vcs object |
46 @param vcs reference to the vcs object |
42 @param parent reference to the parent widget (QWidget) |
47 @param parent reference to the parent widget (QWidget) |
43 """ |
48 """ |
44 super().__init__(parent) |
49 super().__init__(parent) |
45 self.setupUi(self) |
50 self.setupUi(self) |
46 |
51 |
47 self.__position = QPoint() |
52 self.__position = QPoint() |
48 |
53 |
49 self.buttonBox.button( |
54 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(False) |
50 QDialogButtonBox.StandardButton.Close).setEnabled(False) |
55 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
51 self.buttonBox.button( |
56 |
52 QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
|
53 |
|
54 self.logTree.headerItem().setText(self.logTree.columnCount(), "") |
57 self.logTree.headerItem().setText(self.logTree.columnCount(), "") |
55 |
58 |
56 self.refreshButton = self.buttonBox.addButton( |
59 self.refreshButton = self.buttonBox.addButton( |
57 self.tr("&Refresh"), QDialogButtonBox.ButtonRole.ActionRole) |
60 self.tr("&Refresh"), QDialogButtonBox.ButtonRole.ActionRole |
58 self.refreshButton.setToolTip( |
61 ) |
59 self.tr("Press to refresh the list of commits")) |
62 self.refreshButton.setToolTip(self.tr("Press to refresh the list of commits")) |
60 self.refreshButton.setEnabled(False) |
63 self.refreshButton.setEnabled(False) |
61 |
64 |
62 self.vcs = vcs |
65 self.vcs = vcs |
63 |
66 |
64 self.__formatTemplate = ( |
67 self.__formatTemplate = ( |
65 'format:recordstart%n' |
68 "format:recordstart%n" |
66 'commit|%h%n' |
69 "commit|%h%n" |
67 'selector|%gd%n' |
70 "selector|%gd%n" |
68 'name|%gn%n' |
71 "name|%gn%n" |
69 'subject|%gs%n' |
72 "subject|%gs%n" |
70 'recordend%n' |
73 "recordend%n" |
71 ) |
74 ) |
72 |
75 |
73 self.repodir = "" |
76 self.repodir = "" |
74 self.__currentCommitId = "" |
77 self.__currentCommitId = "" |
75 |
78 |
76 self.__initData() |
79 self.__initData() |
77 self.__resetUI() |
80 self.__resetUI() |
78 |
81 |
79 self.__process = EricOverrideCursorProcess() |
82 self.__process = EricOverrideCursorProcess() |
80 self.__process.finished.connect(self.__procFinished) |
83 self.__process.finished.connect(self.__procFinished) |
81 self.__process.readyReadStandardOutput.connect(self.__readStdout) |
84 self.__process.readyReadStandardOutput.connect(self.__readStdout) |
82 self.__process.readyReadStandardError.connect(self.__readStderr) |
85 self.__process.readyReadStandardError.connect(self.__readStderr) |
83 |
86 |
84 def __initData(self): |
87 def __initData(self): |
85 """ |
88 """ |
86 Private method to (re-)initialize some data. |
89 Private method to (re-)initialize some data. |
87 """ |
90 """ |
88 self.buf = [] # buffer for stdout |
91 self.buf = [] # buffer for stdout |
89 self.__started = False |
92 self.__started = False |
90 self.__skipEntries = 0 |
93 self.__skipEntries = 0 |
91 |
94 |
92 def closeEvent(self, e): |
95 def closeEvent(self, e): |
93 """ |
96 """ |
94 Protected slot implementing a close event handler. |
97 Protected slot implementing a close event handler. |
95 |
98 |
96 @param e close event (QCloseEvent) |
99 @param e close event (QCloseEvent) |
97 """ |
100 """ |
98 if ( |
101 if ( |
99 self.__process is not None and |
102 self.__process is not None |
100 self.__process.state() != QProcess.ProcessState.NotRunning |
103 and self.__process.state() != QProcess.ProcessState.NotRunning |
101 ): |
104 ): |
102 self.__process.terminate() |
105 self.__process.terminate() |
103 QTimer.singleShot(2000, self.__process.kill) |
106 QTimer.singleShot(2000, self.__process.kill) |
104 self.__process.waitForFinished(3000) |
107 self.__process.waitForFinished(3000) |
105 |
108 |
106 self.__position = self.pos() |
109 self.__position = self.pos() |
107 |
110 |
108 e.accept() |
111 e.accept() |
109 |
112 |
110 def show(self): |
113 def show(self): |
111 """ |
114 """ |
112 Public slot to show the dialog. |
115 Public slot to show the dialog. |
113 """ |
116 """ |
114 if not self.__position.isNull(): |
117 if not self.__position.isNull(): |
115 self.move(self.__position) |
118 self.move(self.__position) |
116 self.__resetUI() |
119 self.__resetUI() |
117 |
120 |
118 super().show() |
121 super().show() |
119 |
122 |
120 def __resetUI(self): |
123 def __resetUI(self): |
121 """ |
124 """ |
122 Private method to reset the user interface. |
125 Private method to reset the user interface. |
123 """ |
126 """ |
124 self.limitSpinBox.setValue(self.vcs.getPlugin().getPreferences( |
127 self.limitSpinBox.setValue(self.vcs.getPlugin().getPreferences("LogLimit")) |
125 "LogLimit")) |
128 |
126 |
|
127 self.logTree.clear() |
129 self.logTree.clear() |
128 |
130 |
129 def __resizeColumnsLog(self): |
131 def __resizeColumnsLog(self): |
130 """ |
132 """ |
131 Private method to resize the log tree columns. |
133 Private method to resize the log tree columns. |
132 """ |
134 """ |
133 self.logTree.header().resizeSections( |
135 self.logTree.header().resizeSections(QHeaderView.ResizeMode.ResizeToContents) |
134 QHeaderView.ResizeMode.ResizeToContents) |
|
135 self.logTree.header().setStretchLastSection(True) |
136 self.logTree.header().setStretchLastSection(True) |
136 |
137 |
137 def __generateReflogItem(self, commitId, selector, name, subject): |
138 def __generateReflogItem(self, commitId, selector, name, subject): |
138 """ |
139 """ |
139 Private method to generate a reflog tree entry. |
140 Private method to generate a reflog tree entry. |
140 |
141 |
141 @param commitId commit id info (string) |
142 @param commitId commit id info (string) |
142 @param selector selector info (string) |
143 @param selector selector info (string) |
143 @param name name info (string) |
144 @param name name info (string) |
144 @param subject subject of the reflog entry (string) |
145 @param subject subject of the reflog entry (string) |
145 @return reference to the generated item (QTreeWidgetItem) |
146 @return reference to the generated item (QTreeWidgetItem) |
152 operation, |
153 operation, |
153 subject, |
154 subject, |
154 ] |
155 ] |
155 itm = QTreeWidgetItem(self.logTree, columnLabels) |
156 itm = QTreeWidgetItem(self.logTree, columnLabels) |
156 return itm |
157 return itm |
157 |
158 |
158 def __getReflogEntries(self, skip=0): |
159 def __getReflogEntries(self, skip=0): |
159 """ |
160 """ |
160 Private method to retrieve reflog entries from the repository. |
161 Private method to retrieve reflog entries from the repository. |
161 |
162 |
162 @param skip number of reflog entries to skip (integer) |
163 @param skip number of reflog entries to skip (integer) |
163 """ |
164 """ |
164 self.refreshButton.setEnabled(False) |
165 self.refreshButton.setEnabled(False) |
165 self.buttonBox.button( |
166 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(False) |
166 QDialogButtonBox.StandardButton.Close).setEnabled(False) |
167 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setEnabled(True) |
167 self.buttonBox.button( |
168 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
168 QDialogButtonBox.StandardButton.Cancel).setEnabled(True) |
|
169 self.buttonBox.button( |
|
170 QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
|
171 QApplication.processEvents() |
169 QApplication.processEvents() |
172 |
170 |
173 self.buf = [] |
171 self.buf = [] |
174 self.cancelled = False |
172 self.cancelled = False |
175 self.errors.clear() |
173 self.errors.clear() |
176 self.intercept = False |
174 self.intercept = False |
177 |
175 |
178 args = self.vcs.initCommand("log") |
176 args = self.vcs.initCommand("log") |
179 args.append("--walk-reflogs") |
177 args.append("--walk-reflogs") |
180 args.append('--max-count={0}'.format(self.limitSpinBox.value())) |
178 args.append("--max-count={0}".format(self.limitSpinBox.value())) |
181 args.append('--abbrev={0}'.format( |
179 args.append( |
182 self.vcs.getPlugin().getPreferences("CommitIdLength"))) |
180 "--abbrev={0}".format(self.vcs.getPlugin().getPreferences("CommitIdLength")) |
183 args.append('--format={0}'.format(self.__formatTemplate)) |
181 ) |
184 args.append('--skip={0}'.format(skip)) |
182 args.append("--format={0}".format(self.__formatTemplate)) |
185 |
183 args.append("--skip={0}".format(skip)) |
|
184 |
186 self.__process.kill() |
185 self.__process.kill() |
187 |
186 |
188 self.__process.setWorkingDirectory(self.repodir) |
187 self.__process.setWorkingDirectory(self.repodir) |
189 |
188 |
190 self.inputGroup.setEnabled(True) |
189 self.inputGroup.setEnabled(True) |
191 self.inputGroup.show() |
190 self.inputGroup.show() |
192 |
191 |
193 self.__process.start('git', args) |
192 self.__process.start("git", args) |
194 procStarted = self.__process.waitForStarted(5000) |
193 procStarted = self.__process.waitForStarted(5000) |
195 if not procStarted: |
194 if not procStarted: |
196 self.inputGroup.setEnabled(False) |
195 self.inputGroup.setEnabled(False) |
197 self.inputGroup.hide() |
196 self.inputGroup.hide() |
198 EricMessageBox.critical( |
197 EricMessageBox.critical( |
199 self, |
198 self, |
200 self.tr('Process Generation Error'), |
199 self.tr("Process Generation Error"), |
201 self.tr( |
200 self.tr( |
202 'The process {0} could not be started. ' |
201 "The process {0} could not be started. " |
203 'Ensure, that it is in the search path.' |
202 "Ensure, that it is in the search path." |
204 ).format('git')) |
203 ).format("git"), |
205 |
204 ) |
|
205 |
206 def start(self, projectdir): |
206 def start(self, projectdir): |
207 """ |
207 """ |
208 Public slot to start the git log command. |
208 Public slot to start the git log command. |
209 |
209 |
210 @param projectdir directory name of the project (string) |
210 @param projectdir directory name of the project (string) |
211 """ |
211 """ |
212 self.errorGroup.hide() |
212 self.errorGroup.hide() |
213 QApplication.processEvents() |
213 QApplication.processEvents() |
214 |
214 |
215 self.__initData() |
215 self.__initData() |
216 |
216 |
217 # find the root of the repo |
217 # find the root of the repo |
218 self.repodir = projectdir |
218 self.repodir = projectdir |
219 while not os.path.isdir(os.path.join(self.repodir, self.vcs.adminDir)): |
219 while not os.path.isdir(os.path.join(self.repodir, self.vcs.adminDir)): |
220 self.repodir = os.path.dirname(self.repodir) |
220 self.repodir = os.path.dirname(self.repodir) |
221 if os.path.splitdrive(self.repodir)[1] == os.sep: |
221 if os.path.splitdrive(self.repodir)[1] == os.sep: |
222 return |
222 return |
223 |
223 |
224 self.activateWindow() |
224 self.activateWindow() |
225 self.raise_() |
225 self.raise_() |
226 |
226 |
227 self.logTree.clear() |
227 self.logTree.clear() |
228 self.__started = True |
228 self.__started = True |
229 self.__getReflogEntries() |
229 self.__getReflogEntries() |
230 |
230 |
231 def __procFinished(self, exitCode, exitStatus): |
231 def __procFinished(self, exitCode, exitStatus): |
232 """ |
232 """ |
233 Private slot connected to the finished signal. |
233 Private slot connected to the finished signal. |
234 |
234 |
235 @param exitCode exit code of the process (integer) |
235 @param exitCode exit code of the process (integer) |
236 @param exitStatus exit status of the process (QProcess.ExitStatus) |
236 @param exitStatus exit status of the process (QProcess.ExitStatus) |
237 """ |
237 """ |
238 self.__processBuffer() |
238 self.__processBuffer() |
239 self.__finish() |
239 self.__finish() |
240 |
240 |
241 def __finish(self): |
241 def __finish(self): |
242 """ |
242 """ |
243 Private slot called when the process finished or the user pressed |
243 Private slot called when the process finished or the user pressed |
244 the button. |
244 the button. |
245 """ |
245 """ |
246 if ( |
246 if ( |
247 self.__process is not None and |
247 self.__process is not None |
248 self.__process.state() != QProcess.ProcessState.NotRunning |
248 and self.__process.state() != QProcess.ProcessState.NotRunning |
249 ): |
249 ): |
250 self.__process.terminate() |
250 self.__process.terminate() |
251 QTimer.singleShot(2000, self.__process.kill) |
251 QTimer.singleShot(2000, self.__process.kill) |
252 self.__process.waitForFinished(3000) |
252 self.__process.waitForFinished(3000) |
253 |
253 |
254 self.buttonBox.button( |
254 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(True) |
255 QDialogButtonBox.StandardButton.Close).setEnabled(True) |
255 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setEnabled(False) |
256 self.buttonBox.button( |
256 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setDefault(True) |
257 QDialogButtonBox.StandardButton.Cancel).setEnabled(False) |
257 |
258 self.buttonBox.button( |
|
259 QDialogButtonBox.StandardButton.Close).setDefault(True) |
|
260 |
|
261 self.inputGroup.setEnabled(False) |
258 self.inputGroup.setEnabled(False) |
262 self.inputGroup.hide() |
259 self.inputGroup.hide() |
263 self.refreshButton.setEnabled(True) |
260 self.refreshButton.setEnabled(True) |
264 |
261 |
265 def __processBuffer(self): |
262 def __processBuffer(self): |
266 """ |
263 """ |
267 Private method to process the buffered output of the git log command. |
264 Private method to process the buffered output of the git log command. |
268 """ |
265 """ |
269 noEntries = 0 |
266 noEntries = 0 |
270 |
267 |
271 for line in self.buf: |
268 for line in self.buf: |
272 line = line.rstrip() |
269 line = line.rstrip() |
273 if line == "recordstart": |
270 if line == "recordstart": |
274 logEntry = {} |
271 logEntry = {} |
275 elif line == "recordend": |
272 elif line == "recordend": |
276 if len(logEntry) > 1: |
273 if len(logEntry) > 1: |
277 self.__generateReflogItem( |
274 self.__generateReflogItem( |
278 logEntry["commit"], logEntry["selector"], |
275 logEntry["commit"], |
279 logEntry["name"], logEntry["subject"], |
276 logEntry["selector"], |
|
277 logEntry["name"], |
|
278 logEntry["subject"], |
280 ) |
279 ) |
281 noEntries += 1 |
280 noEntries += 1 |
282 else: |
281 else: |
283 try: |
282 try: |
284 key, value = line.split("|", 1) |
283 key, value = line.split("|", 1) |
285 except ValueError: |
284 except ValueError: |
286 key = "" |
285 key = "" |
287 value = line |
286 value = line |
288 if key in ("commit", "selector", "name", "subject"): |
287 if key in ("commit", "selector", "name", "subject"): |
289 logEntry[key] = value.strip() |
288 logEntry[key] = value.strip() |
290 |
289 |
291 self.__resizeColumnsLog() |
290 self.__resizeColumnsLog() |
292 |
291 |
293 if self.__started: |
292 if self.__started: |
294 self.logTree.setCurrentItem(self.logTree.topLevelItem(0)) |
293 self.logTree.setCurrentItem(self.logTree.topLevelItem(0)) |
295 self.__started = False |
294 self.__started = False |
296 |
295 |
297 self.__skipEntries += noEntries |
296 self.__skipEntries += noEntries |
298 if noEntries < self.limitSpinBox.value() and not self.cancelled: |
297 if noEntries < self.limitSpinBox.value() and not self.cancelled: |
299 self.nextButton.setEnabled(False) |
298 self.nextButton.setEnabled(False) |
300 self.limitSpinBox.setEnabled(False) |
299 self.limitSpinBox.setEnabled(False) |
301 else: |
300 else: |
302 self.nextButton.setEnabled(True) |
301 self.nextButton.setEnabled(True) |
303 self.limitSpinBox.setEnabled(True) |
302 self.limitSpinBox.setEnabled(True) |
304 |
303 |
305 # restore current item |
304 # restore current item |
306 if self.__currentCommitId: |
305 if self.__currentCommitId: |
307 items = self.logTree.findItems( |
306 items = self.logTree.findItems( |
308 self.__currentCommitId, Qt.MatchFlag.MatchExactly, |
307 self.__currentCommitId, Qt.MatchFlag.MatchExactly, self.CommitIdColumn |
309 self.CommitIdColumn) |
308 ) |
310 if items: |
309 if items: |
311 self.logTree.setCurrentItem(items[0]) |
310 self.logTree.setCurrentItem(items[0]) |
312 self.__currentCommitId = "" |
311 self.__currentCommitId = "" |
313 |
312 |
314 def __readStdout(self): |
313 def __readStdout(self): |
315 """ |
314 """ |
316 Private slot to handle the readyReadStandardOutput signal. |
315 Private slot to handle the readyReadStandardOutput signal. |
317 |
316 |
318 It reads the output of the process and inserts it into a buffer. |
317 It reads the output of the process and inserts it into a buffer. |
319 """ |
318 """ |
320 self.__process.setReadChannel(QProcess.ProcessChannel.StandardOutput) |
319 self.__process.setReadChannel(QProcess.ProcessChannel.StandardOutput) |
321 |
320 |
322 while self.__process.canReadLine(): |
321 while self.__process.canReadLine(): |
323 line = str(self.__process.readLine(), |
322 line = str( |
324 Preferences.getSystem("IOEncoding"), |
323 self.__process.readLine(), |
325 'replace') |
324 Preferences.getSystem("IOEncoding"), |
|
325 "replace", |
|
326 ) |
326 self.buf.append(line) |
327 self.buf.append(line) |
327 |
328 |
328 def __readStderr(self): |
329 def __readStderr(self): |
329 """ |
330 """ |
330 Private slot to handle the readyReadStandardError signal. |
331 Private slot to handle the readyReadStandardError signal. |
331 |
332 |
332 It reads the error output of the process and inserts it into the |
333 It reads the error output of the process and inserts it into the |
333 error pane. |
334 error pane. |
334 """ |
335 """ |
335 if self.__process is not None: |
336 if self.__process is not None: |
336 s = str(self.__process.readAllStandardError(), |
337 s = str( |
337 Preferences.getSystem("IOEncoding"), |
338 self.__process.readAllStandardError(), |
338 'replace') |
339 Preferences.getSystem("IOEncoding"), |
|
340 "replace", |
|
341 ) |
339 self.__showError(s) |
342 self.__showError(s) |
340 |
343 |
341 def __showError(self, out): |
344 def __showError(self, out): |
342 """ |
345 """ |
343 Private slot to show some error. |
346 Private slot to show some error. |
344 |
347 |
345 @param out error to be shown (string) |
348 @param out error to be shown (string) |
346 """ |
349 """ |
347 self.errorGroup.show() |
350 self.errorGroup.show() |
348 self.errors.insertPlainText(out) |
351 self.errors.insertPlainText(out) |
349 self.errors.ensureCursorVisible() |
352 self.errors.ensureCursorVisible() |
350 |
353 |
351 def on_buttonBox_clicked(self, button): |
354 def on_buttonBox_clicked(self, button): |
352 """ |
355 """ |
353 Private slot called by a button of the button box clicked. |
356 Private slot called by a button of the button box clicked. |
354 |
357 |
355 @param button button that was clicked (QAbstractButton) |
358 @param button button that was clicked (QAbstractButton) |
356 """ |
359 """ |
357 if button == self.buttonBox.button( |
360 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Close): |
358 QDialogButtonBox.StandardButton.Close |
|
359 ): |
|
360 self.close() |
361 self.close() |
361 elif button == self.buttonBox.button( |
362 elif button == self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel): |
362 QDialogButtonBox.StandardButton.Cancel |
|
363 ): |
|
364 self.cancelled = True |
363 self.cancelled = True |
365 self.__finish() |
364 self.__finish() |
366 elif button == self.refreshButton: |
365 elif button == self.refreshButton: |
367 self.on_refreshButton_clicked() |
366 self.on_refreshButton_clicked() |
368 |
367 |
369 @pyqtSlot() |
368 @pyqtSlot() |
370 def on_refreshButton_clicked(self): |
369 def on_refreshButton_clicked(self): |
371 """ |
370 """ |
372 Private slot to refresh the log. |
371 Private slot to refresh the log. |
373 """ |
372 """ |
375 itm = self.logTree.currentItem() |
374 itm = self.logTree.currentItem() |
376 if itm is not None: |
375 if itm is not None: |
377 self.__currentCommitId = itm.text(self.CommitIdColumn) |
376 self.__currentCommitId = itm.text(self.CommitIdColumn) |
378 else: |
377 else: |
379 self.__currentCommitId = "" |
378 self.__currentCommitId = "" |
380 |
379 |
381 self.start(self.repodir) |
380 self.start(self.repodir) |
382 |
381 |
383 def on_passwordCheckBox_toggled(self, isOn): |
382 def on_passwordCheckBox_toggled(self, isOn): |
384 """ |
383 """ |
385 Private slot to handle the password checkbox toggled. |
384 Private slot to handle the password checkbox toggled. |
386 |
385 |
387 @param isOn flag indicating the status of the check box (boolean) |
386 @param isOn flag indicating the status of the check box (boolean) |
388 """ |
387 """ |
389 if isOn: |
388 if isOn: |
390 self.input.setEchoMode(QLineEdit.EchoMode.Password) |
389 self.input.setEchoMode(QLineEdit.EchoMode.Password) |
391 else: |
390 else: |
392 self.input.setEchoMode(QLineEdit.EchoMode.Normal) |
391 self.input.setEchoMode(QLineEdit.EchoMode.Normal) |
393 |
392 |
394 @pyqtSlot() |
393 @pyqtSlot() |
395 def on_sendButton_clicked(self): |
394 def on_sendButton_clicked(self): |
396 """ |
395 """ |
397 Private slot to send the input to the git process. |
396 Private slot to send the input to the git process. |
398 """ |
397 """ |
399 inputTxt = self.input.text() |
398 inputTxt = self.input.text() |
400 inputTxt += os.linesep |
399 inputTxt += os.linesep |
401 |
400 |
402 if self.passwordCheckBox.isChecked(): |
401 if self.passwordCheckBox.isChecked(): |
403 self.errors.insertPlainText(os.linesep) |
402 self.errors.insertPlainText(os.linesep) |
404 self.errors.ensureCursorVisible() |
403 self.errors.ensureCursorVisible() |
405 else: |
404 else: |
406 self.errors.insertPlainText(inputTxt) |
405 self.errors.insertPlainText(inputTxt) |
407 self.errors.ensureCursorVisible() |
406 self.errors.ensureCursorVisible() |
408 self.errorGroup.show() |
407 self.errorGroup.show() |
409 |
408 |
410 self.__process.write(strToQByteArray(inputTxt)) |
409 self.__process.write(strToQByteArray(inputTxt)) |
411 |
410 |
412 self.passwordCheckBox.setChecked(False) |
411 self.passwordCheckBox.setChecked(False) |
413 self.input.clear() |
412 self.input.clear() |
414 |
413 |
415 def on_input_returnPressed(self): |
414 def on_input_returnPressed(self): |
416 """ |
415 """ |
417 Private slot to handle the press of the return key in the input field. |
416 Private slot to handle the press of the return key in the input field. |
418 """ |
417 """ |
419 self.intercept = True |
418 self.intercept = True |
420 self.on_sendButton_clicked() |
419 self.on_sendButton_clicked() |
421 |
420 |
422 def keyPressEvent(self, evt): |
421 def keyPressEvent(self, evt): |
423 """ |
422 """ |
424 Protected slot to handle a key press event. |
423 Protected slot to handle a key press event. |
425 |
424 |
426 @param evt the key press event (QKeyEvent) |
425 @param evt the key press event (QKeyEvent) |
427 """ |
426 """ |
428 if self.intercept: |
427 if self.intercept: |
429 self.intercept = False |
428 self.intercept = False |
430 evt.accept() |
429 evt.accept() |
431 return |
430 return |
432 super().keyPressEvent(evt) |
431 super().keyPressEvent(evt) |
433 |
432 |
434 @pyqtSlot() |
433 @pyqtSlot() |
435 def on_nextButton_clicked(self): |
434 def on_nextButton_clicked(self): |
436 """ |
435 """ |
437 Private slot to handle the Next button. |
436 Private slot to handle the Next button. |
438 """ |
437 """ |