44 super(GitReflogBrowserDialog, self).__init__(parent) |
44 super(GitReflogBrowserDialog, self).__init__(parent) |
45 self.setupUi(self) |
45 self.setupUi(self) |
46 |
46 |
47 self.__position = QPoint() |
47 self.__position = QPoint() |
48 |
48 |
49 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
49 self.buttonBox.button( |
50 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
50 QDialogButtonBox.StandardButton.Close).setEnabled(False) |
|
51 self.buttonBox.button( |
|
52 QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
51 |
53 |
52 self.logTree.headerItem().setText(self.logTree.columnCount(), "") |
54 self.logTree.headerItem().setText(self.logTree.columnCount(), "") |
53 |
55 |
54 self.refreshButton = self.buttonBox.addButton( |
56 self.refreshButton = self.buttonBox.addButton( |
55 self.tr("&Refresh"), QDialogButtonBox.ActionRole) |
57 self.tr("&Refresh"), QDialogButtonBox.ButtonRole.ActionRole) |
56 self.refreshButton.setToolTip( |
58 self.refreshButton.setToolTip( |
57 self.tr("Press to refresh the list of commits")) |
59 self.tr("Press to refresh the list of commits")) |
58 self.refreshButton.setEnabled(False) |
60 self.refreshButton.setEnabled(False) |
59 |
61 |
60 self.vcs = vcs |
62 self.vcs = vcs |
93 |
95 |
94 @param e close event (QCloseEvent) |
96 @param e close event (QCloseEvent) |
95 """ |
97 """ |
96 if ( |
98 if ( |
97 self.__process is not None and |
99 self.__process is not None and |
98 self.__process.state() != QProcess.NotRunning |
100 self.__process.state() != QProcess.ProcessState.NotRunning |
99 ): |
101 ): |
100 self.__process.terminate() |
102 self.__process.terminate() |
101 QTimer.singleShot(2000, self.__process.kill) |
103 QTimer.singleShot(2000, self.__process.kill) |
102 self.__process.waitForFinished(3000) |
104 self.__process.waitForFinished(3000) |
103 |
105 |
126 |
128 |
127 def __resizeColumnsLog(self): |
129 def __resizeColumnsLog(self): |
128 """ |
130 """ |
129 Private method to resize the log tree columns. |
131 Private method to resize the log tree columns. |
130 """ |
132 """ |
131 self.logTree.header().resizeSections(QHeaderView.ResizeToContents) |
133 self.logTree.header().resizeSections( |
|
134 QHeaderView.ResizeMode.ResizeToContents) |
132 self.logTree.header().setStretchLastSection(True) |
135 self.logTree.header().setStretchLastSection(True) |
133 |
136 |
134 def __generateReflogItem(self, commitId, selector, name, subject): |
137 def __generateReflogItem(self, commitId, selector, name, subject): |
135 """ |
138 """ |
136 Private method to generate a reflog tree entry. |
139 Private method to generate a reflog tree entry. |
157 Private method to retrieve reflog entries from the repository. |
160 Private method to retrieve reflog entries from the repository. |
158 |
161 |
159 @param skip number of reflog entries to skip (integer) |
162 @param skip number of reflog entries to skip (integer) |
160 """ |
163 """ |
161 self.refreshButton.setEnabled(False) |
164 self.refreshButton.setEnabled(False) |
162 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
165 self.buttonBox.button( |
163 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) |
166 QDialogButtonBox.StandardButton.Close).setEnabled(False) |
164 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
167 self.buttonBox.button( |
|
168 QDialogButtonBox.StandardButton.Cancel).setEnabled(True) |
|
169 self.buttonBox.button( |
|
170 QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
165 QApplication.processEvents() |
171 QApplication.processEvents() |
166 |
172 |
167 self.buf = [] |
173 self.buf = [] |
168 self.cancelled = False |
174 self.cancelled = False |
169 self.errors.clear() |
175 self.errors.clear() |
237 Private slot called when the process finished or the user pressed |
243 Private slot called when the process finished or the user pressed |
238 the button. |
244 the button. |
239 """ |
245 """ |
240 if ( |
246 if ( |
241 self.__process is not None and |
247 self.__process is not None and |
242 self.__process.state() != QProcess.NotRunning |
248 self.__process.state() != QProcess.ProcessState.NotRunning |
243 ): |
249 ): |
244 self.__process.terminate() |
250 self.__process.terminate() |
245 QTimer.singleShot(2000, self.__process.kill) |
251 QTimer.singleShot(2000, self.__process.kill) |
246 self.__process.waitForFinished(3000) |
252 self.__process.waitForFinished(3000) |
247 |
253 |
248 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
254 self.buttonBox.button( |
249 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
255 QDialogButtonBox.StandardButton.Close).setEnabled(True) |
250 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
256 self.buttonBox.button( |
|
257 QDialogButtonBox.StandardButton.Cancel).setEnabled(False) |
|
258 self.buttonBox.button( |
|
259 QDialogButtonBox.StandardButton.Close).setDefault(True) |
251 |
260 |
252 self.inputGroup.setEnabled(False) |
261 self.inputGroup.setEnabled(False) |
253 self.inputGroup.hide() |
262 self.inputGroup.hide() |
254 self.refreshButton.setEnabled(True) |
263 self.refreshButton.setEnabled(True) |
255 |
264 |
294 self.limitSpinBox.setEnabled(True) |
303 self.limitSpinBox.setEnabled(True) |
295 |
304 |
296 # restore current item |
305 # restore current item |
297 if self.__currentCommitId: |
306 if self.__currentCommitId: |
298 items = self.logTree.findItems( |
307 items = self.logTree.findItems( |
299 self.__currentCommitId, Qt.MatchExactly, self.CommitIdColumn) |
308 self.__currentCommitId, Qt.MatchFlag.MatchExactly, |
|
309 self.CommitIdColumn) |
300 if items: |
310 if items: |
301 self.logTree.setCurrentItem(items[0]) |
311 self.logTree.setCurrentItem(items[0]) |
302 self.__currentCommitId = "" |
312 self.__currentCommitId = "" |
303 |
313 |
304 def __readStdout(self): |
314 def __readStdout(self): |
305 """ |
315 """ |
306 Private slot to handle the readyReadStandardOutput signal. |
316 Private slot to handle the readyReadStandardOutput signal. |
307 |
317 |
308 It reads the output of the process and inserts it into a buffer. |
318 It reads the output of the process and inserts it into a buffer. |
309 """ |
319 """ |
310 self.__process.setReadChannel(QProcess.StandardOutput) |
320 self.__process.setReadChannel(QProcess.ProcessChannel.StandardOutput) |
311 |
321 |
312 while self.__process.canReadLine(): |
322 while self.__process.canReadLine(): |
313 line = str(self.__process.readLine(), |
323 line = str(self.__process.readLine(), |
314 Preferences.getSystem("IOEncoding"), |
324 Preferences.getSystem("IOEncoding"), |
315 'replace') |
325 'replace') |
342 """ |
352 """ |
343 Private slot called by a button of the button box clicked. |
353 Private slot called by a button of the button box clicked. |
344 |
354 |
345 @param button button that was clicked (QAbstractButton) |
355 @param button button that was clicked (QAbstractButton) |
346 """ |
356 """ |
347 if button == self.buttonBox.button(QDialogButtonBox.Close): |
357 if button == self.buttonBox.button( |
|
358 QDialogButtonBox.StandardButton.Close |
|
359 ): |
348 self.close() |
360 self.close() |
349 elif button == self.buttonBox.button(QDialogButtonBox.Cancel): |
361 elif button == self.buttonBox.button( |
|
362 QDialogButtonBox.StandardButton.Cancel |
|
363 ): |
350 self.cancelled = True |
364 self.cancelled = True |
351 self.__finish() |
365 self.__finish() |
352 elif button == self.refreshButton: |
366 elif button == self.refreshButton: |
353 self.on_refreshButton_clicked() |
367 self.on_refreshButton_clicked() |
354 |
368 |
371 Private slot to handle the password checkbox toggled. |
385 Private slot to handle the password checkbox toggled. |
372 |
386 |
373 @param isOn flag indicating the status of the check box (boolean) |
387 @param isOn flag indicating the status of the check box (boolean) |
374 """ |
388 """ |
375 if isOn: |
389 if isOn: |
376 self.input.setEchoMode(QLineEdit.Password) |
390 self.input.setEchoMode(QLineEdit.EchoMode.Password) |
377 else: |
391 else: |
378 self.input.setEchoMode(QLineEdit.Normal) |
392 self.input.setEchoMode(QLineEdit.EchoMode.Normal) |
379 |
393 |
380 @pyqtSlot() |
394 @pyqtSlot() |
381 def on_sendButton_clicked(self): |
395 def on_sendButton_clicked(self): |
382 """ |
396 """ |
383 Private slot to send the input to the git process. |
397 Private slot to send the input to the git process. |