33 @param vcs reference to the vcs object |
33 @param vcs reference to the vcs object |
34 @param parent reference to the parent widget (QWidget) |
34 @param parent reference to the parent widget (QWidget) |
35 """ |
35 """ |
36 super(GitDescribeDialog, self).__init__(parent) |
36 super(GitDescribeDialog, self).__init__(parent) |
37 self.setupUi(self) |
37 self.setupUi(self) |
38 self.setWindowFlags(Qt.Window) |
38 self.setWindowFlags(Qt.WindowType.Window) |
39 |
39 |
40 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
40 self.buttonBox.button( |
41 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
41 QDialogButtonBox.StandardButton.Close).setEnabled(False) |
|
42 self.buttonBox.button( |
|
43 QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
42 |
44 |
43 self.process = QProcess() |
45 self.process = QProcess() |
44 self.vcs = vcs |
46 self.vcs = vcs |
45 |
47 |
46 self.tagList.headerItem().setText(self.tagList.columnCount(), "") |
48 self.tagList.headerItem().setText(self.tagList.columnCount(), "") |
47 self.tagList.header().setSortIndicator(1, Qt.AscendingOrder) |
49 self.tagList.header().setSortIndicator(1, Qt.SortOrder.AscendingOrder) |
48 |
50 |
49 self.process.finished.connect(self.__procFinished) |
51 self.process.finished.connect(self.__procFinished) |
50 self.process.readyReadStandardOutput.connect(self.__readStdout) |
52 self.process.readyReadStandardOutput.connect(self.__readStdout) |
51 self.process.readyReadStandardError.connect(self.__readStderr) |
53 self.process.readyReadStandardError.connect(self.__readStderr) |
52 |
54 |
59 |
61 |
60 @param e close event (QCloseEvent) |
62 @param e close event (QCloseEvent) |
61 """ |
63 """ |
62 if ( |
64 if ( |
63 self.process is not None and |
65 self.process is not None and |
64 self.process.state() != QProcess.NotRunning |
66 self.process.state() != QProcess.ProcessState.NotRunning |
65 ): |
67 ): |
66 self.process.terminate() |
68 self.process.terminate() |
67 QTimer.singleShot(2000, self.process.kill) |
69 QTimer.singleShot(2000, self.process.kill) |
68 self.process.waitForFinished(3000) |
70 self.process.waitForFinished(3000) |
69 |
71 |
126 Private slot called when the process finished or the user pressed |
128 Private slot called when the process finished or the user pressed |
127 the button. |
129 the button. |
128 """ |
130 """ |
129 if ( |
131 if ( |
130 self.process is not None and |
132 self.process is not None and |
131 self.process.state() != QProcess.NotRunning |
133 self.process.state() != QProcess.ProcessState.NotRunning |
132 ): |
134 ): |
133 self.process.terminate() |
135 self.process.terminate() |
134 QTimer.singleShot(2000, self.process.kill) |
136 QTimer.singleShot(2000, self.process.kill) |
135 self.process.waitForFinished(3000) |
137 self.process.waitForFinished(3000) |
136 |
138 |
137 self.inputGroup.setEnabled(False) |
139 self.inputGroup.setEnabled(False) |
138 self.inputGroup.hide() |
140 self.inputGroup.hide() |
139 |
141 |
140 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
142 self.buttonBox.button( |
141 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
143 QDialogButtonBox.StandardButton.Close).setEnabled(True) |
142 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
144 self.buttonBox.button( |
143 self.buttonBox.button(QDialogButtonBox.Close).setFocus( |
145 QDialogButtonBox.StandardButton.Cancel).setEnabled(False) |
144 Qt.OtherFocusReason) |
146 self.buttonBox.button( |
|
147 QDialogButtonBox.StandardButton.Close).setDefault(True) |
|
148 self.buttonBox.button( |
|
149 QDialogButtonBox.StandardButton.Close).setFocus( |
|
150 Qt.FocusReason.OtherFocusReason) |
145 |
151 |
146 self.__resizeColumns() |
152 self.__resizeColumns() |
147 self.__resort() |
153 self.__resort() |
148 |
154 |
149 def on_buttonBox_clicked(self, button): |
155 def on_buttonBox_clicked(self, button): |
150 """ |
156 """ |
151 Private slot called by a button of the button box clicked. |
157 Private slot called by a button of the button box clicked. |
152 |
158 |
153 @param button button that was clicked (QAbstractButton) |
159 @param button button that was clicked (QAbstractButton) |
154 """ |
160 """ |
155 if button == self.buttonBox.button(QDialogButtonBox.Close): |
161 if button == self.buttonBox.button( |
|
162 QDialogButtonBox.StandardButton.Close |
|
163 ): |
156 self.close() |
164 self.close() |
157 elif button == self.buttonBox.button(QDialogButtonBox.Cancel): |
165 elif button == self.buttonBox.button( |
|
166 QDialogButtonBox.StandardButton.Cancel |
|
167 ): |
158 self.__finish() |
168 self.__finish() |
159 |
169 |
160 def __procFinished(self, exitCode, exitStatus): |
170 def __procFinished(self, exitCode, exitStatus): |
161 """ |
171 """ |
162 Private slot connected to the finished signal. |
172 Private slot connected to the finished signal. |
185 |
195 |
186 def __resizeColumns(self): |
196 def __resizeColumns(self): |
187 """ |
197 """ |
188 Private method to resize the list columns. |
198 Private method to resize the list columns. |
189 """ |
199 """ |
190 self.tagList.header().resizeSections(QHeaderView.ResizeToContents) |
200 self.tagList.header().resizeSections( |
|
201 QHeaderView.ResizeMode.ResizeToContents) |
191 self.tagList.header().setStretchLastSection(True) |
202 self.tagList.header().setStretchLastSection(True) |
192 |
203 |
193 def __readStdout(self): |
204 def __readStdout(self): |
194 """ |
205 """ |
195 Private slot to handle the readyReadStdout signal. |
206 Private slot to handle the readyReadStdout signal. |
196 |
207 |
197 It reads the output of the process, formats it and inserts it into |
208 It reads the output of the process, formats it and inserts it into |
198 the contents pane. |
209 the contents pane. |
199 """ |
210 """ |
200 self.process.setReadChannel(QProcess.StandardOutput) |
211 self.process.setReadChannel(QProcess.ProcessChannel.StandardOutput) |
201 |
212 |
202 while self.process.canReadLine(): |
213 while self.process.canReadLine(): |
203 s = str(self.process.readLine(), |
214 s = str(self.process.readLine(), |
204 Preferences.getSystem("IOEncoding"), |
215 Preferences.getSystem("IOEncoding"), |
205 'replace') |
216 'replace') |
225 Private slot to handle the password checkbox toggled. |
236 Private slot to handle the password checkbox toggled. |
226 |
237 |
227 @param isOn flag indicating the status of the check box (boolean) |
238 @param isOn flag indicating the status of the check box (boolean) |
228 """ |
239 """ |
229 if isOn: |
240 if isOn: |
230 self.input.setEchoMode(QLineEdit.Password) |
241 self.input.setEchoMode(QLineEdit.EchoMode.Password) |
231 else: |
242 else: |
232 self.input.setEchoMode(QLineEdit.Normal) |
243 self.input.setEchoMode(QLineEdit.EchoMode.Normal) |
233 |
244 |
234 @pyqtSlot() |
245 @pyqtSlot() |
235 def on_sendButton_clicked(self): |
246 def on_sendButton_clicked(self): |
236 """ |
247 """ |
237 Private slot to send the input to the git process. |
248 Private slot to send the input to the git process. |