34 if possible (boolean) |
34 if possible (boolean) |
35 @param parent parent widget (QWidget) |
35 @param parent parent widget (QWidget) |
36 """ |
36 """ |
37 super(HgDialog, self).__init__(parent) |
37 super(HgDialog, self).__init__(parent) |
38 self.setupUi(self) |
38 self.setupUi(self) |
39 self.setWindowFlags(Qt.Window) |
39 self.setWindowFlags(Qt.WindowType.Window) |
40 |
40 |
41 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
41 self.buttonBox.button( |
42 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
42 QDialogButtonBox.StandardButton.Close).setEnabled(False) |
|
43 self.buttonBox.button( |
|
44 QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
43 |
45 |
44 self.username = '' |
46 self.username = '' |
45 self.password = '' |
47 self.password = '' |
46 self.vcs = hg |
48 self.vcs = hg |
47 |
49 |
53 def __finish(self): |
55 def __finish(self): |
54 """ |
56 """ |
55 Private slot called when the process finished or the user pressed |
57 Private slot called when the process finished or the user pressed |
56 the button. |
58 the button. |
57 """ |
59 """ |
58 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
60 self.buttonBox.button( |
59 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
61 QDialogButtonBox.StandardButton.Close).setEnabled(True) |
60 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
62 self.buttonBox.button( |
61 self.buttonBox.button(QDialogButtonBox.Close).setFocus( |
63 QDialogButtonBox.StandardButton.Cancel).setEnabled(False) |
62 Qt.OtherFocusReason) |
64 self.buttonBox.button( |
|
65 QDialogButtonBox.StandardButton.Close).setDefault(True) |
|
66 self.buttonBox.button( |
|
67 QDialogButtonBox.StandardButton.Close).setFocus( |
|
68 Qt.FocusReason.OtherFocusReason) |
63 |
69 |
64 if ( |
70 if ( |
65 Preferences.getVCS("AutoClose") and |
71 Preferences.getVCS("AutoClose") and |
66 self.normal and |
72 self.normal and |
67 self.errors.toPlainText() == "" |
73 self.errors.toPlainText() == "" |
72 """ |
78 """ |
73 Private slot called by a button of the button box clicked. |
79 Private slot called by a button of the button box clicked. |
74 |
80 |
75 @param button button that was clicked (QAbstractButton) |
81 @param button button that was clicked (QAbstractButton) |
76 """ |
82 """ |
77 if button == self.buttonBox.button(QDialogButtonBox.Close): |
83 if button == self.buttonBox.button( |
|
84 QDialogButtonBox.StandardButton.Close |
|
85 ): |
78 self.close() |
86 self.close() |
79 elif button == self.buttonBox.button(QDialogButtonBox.Cancel): |
87 elif button == self.buttonBox.button( |
|
88 QDialogButtonBox.StandardButton.Cancel |
|
89 ): |
80 self.vcs.getClient().cancel() |
90 self.vcs.getClient().cancel() |
81 |
91 |
82 def startProcess(self, args, showArgs=True, environment=None, client=None): |
92 def startProcess(self, args, showArgs=True, environment=None, client=None): |
83 """ |
93 """ |
84 Public slot used to start the process. |
94 Public slot used to start the process. |
205 a flag indicating a password input |
215 a flag indicating a password input |
206 @rtype tuple of (str, bool) |
216 @rtype tuple of (str, bool) |
207 """ |
217 """ |
208 self.inputGroup.show() |
218 self.inputGroup.show() |
209 self.input.setMaxLength(size) |
219 self.input.setMaxLength(size) |
210 self.input.setFocus(Qt.OtherFocusReason) |
220 self.input.setFocus(Qt.FocusReason.OtherFocusReason) |
211 |
221 |
212 self.resultbox.ensureCursorVisible() |
222 self.resultbox.ensureCursorVisible() |
213 self.errors.ensureCursorVisible() |
223 self.errors.ensureCursorVisible() |
214 |
224 |
215 from PyQt5.QtCore import QEventLoop |
225 from PyQt5.QtCore import QEventLoop |