eric6/Plugins/VcsPlugins/vcsGit/GitRemoteRepositoriesDialog.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
41 self.process.finished.connect(self.__procFinished) 41 self.process.finished.connect(self.__procFinished)
42 self.process.readyReadStandardOutput.connect(self.__readStdout) 42 self.process.readyReadStandardOutput.connect(self.__readStdout)
43 self.process.readyReadStandardError.connect(self.__readStderr) 43 self.process.readyReadStandardError.connect(self.__readStderr)
44 44
45 self.refreshButton = self.buttonBox.addButton( 45 self.refreshButton = self.buttonBox.addButton(
46 self.tr("Refresh"), QDialogButtonBox.ActionRole) 46 self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole)
47 self.refreshButton.setToolTip( 47 self.refreshButton.setToolTip(
48 self.tr("Press to refresh the repositories display")) 48 self.tr("Press to refresh the repositories display"))
49 self.refreshButton.setEnabled(False) 49 self.refreshButton.setEnabled(False)
50 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) 50 self.buttonBox.button(
51 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) 51 QDialogButtonBox.StandardButton.Close).setEnabled(False)
52 self.buttonBox.button(
53 QDialogButtonBox.StandardButton.Cancel).setDefault(True)
52 54
53 self.__lastColumn = self.repolist.columnCount() 55 self.__lastColumn = self.repolist.columnCount()
54 56
55 self.repolist.headerItem().setText(self.__lastColumn, "") 57 self.repolist.headerItem().setText(self.__lastColumn, "")
56 self.repolist.header().setSortIndicator(0, Qt.AscendingOrder) 58 self.repolist.header().setSortIndicator(0, Qt.SortOrder.AscendingOrder)
57 59
58 self.__ioEncoding = Preferences.getSystem("IOEncoding") 60 self.__ioEncoding = Preferences.getSystem("IOEncoding")
59 61
60 def __resort(self): 62 def __resort(self):
61 """ 63 """
67 69
68 def __resizeColumns(self): 70 def __resizeColumns(self):
69 """ 71 """
70 Private method to resize the list columns. 72 Private method to resize the list columns.
71 """ 73 """
72 self.repolist.header().resizeSections(QHeaderView.ResizeToContents) 74 self.repolist.header().resizeSections(
75 QHeaderView.ResizeMode.ResizeToContents)
73 self.repolist.header().setStretchLastSection(True) 76 self.repolist.header().setStretchLastSection(True)
74 77
75 def __generateItem(self, name, url, oper): 78 def __generateItem(self, name, url, oper):
76 """ 79 """
77 Private method to generate a status item in the status list. 80 Private method to generate a status item in the status list.
78 81
79 @param name name of the remote repository (string) 82 @param name name of the remote repository (string)
80 @param url URL of the remote repository (string) 83 @param url URL of the remote repository (string)
81 @param oper operation the remote repository may be used for (string) 84 @param oper operation the remote repository may be used for (string)
82 """ 85 """
83 foundItems = self.repolist.findItems(name, Qt.MatchExactly, 0) 86 foundItems = self.repolist.findItems(
87 name, Qt.MatchFlag.MatchExactly, 0)
84 if foundItems: 88 if foundItems:
85 # modify the operations column only 89 # modify the operations column only
86 foundItems[0].setText( 90 foundItems[0].setText(
87 2, "{0} + {1}".format(foundItems[0].text(2), oper)) 91 2, "{0} + {1}".format(foundItems[0].text(2), oper))
88 else: 92 else:
94 98
95 @param e close event (QCloseEvent) 99 @param e close event (QCloseEvent)
96 """ 100 """
97 if ( 101 if (
98 self.process is not None and 102 self.process is not None and
99 self.process.state() != QProcess.NotRunning 103 self.process.state() != QProcess.ProcessState.NotRunning
100 ): 104 ):
101 self.process.terminate() 105 self.process.terminate()
102 QTimer.singleShot(2000, self.process.kill) 106 QTimer.singleShot(2000, self.process.kill)
103 self.process.waitForFinished(3000) 107 self.process.waitForFinished(3000)
104 108
147 self.tr( 151 self.tr(
148 'The process {0} could not be started. ' 152 'The process {0} could not be started. '
149 'Ensure, that it is in the search path.' 153 'Ensure, that it is in the search path.'
150 ).format('git')) 154 ).format('git'))
151 else: 155 else:
152 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) 156 self.buttonBox.button(
153 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) 157 QDialogButtonBox.StandardButton.Close).setEnabled(False)
154 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) 158 self.buttonBox.button(
159 QDialogButtonBox.StandardButton.Cancel).setEnabled(True)
160 self.buttonBox.button(
161 QDialogButtonBox.StandardButton.Cancel).setDefault(True)
155 162
156 self.inputGroup.setEnabled(True) 163 self.inputGroup.setEnabled(True)
157 self.inputGroup.show() 164 self.inputGroup.show()
158 self.refreshButton.setEnabled(False) 165 self.refreshButton.setEnabled(False)
159 166
162 Private slot called when the process finished or the user pressed 169 Private slot called when the process finished or the user pressed
163 the button. 170 the button.
164 """ 171 """
165 if ( 172 if (
166 self.process is not None and 173 self.process is not None and
167 self.process.state() != QProcess.NotRunning 174 self.process.state() != QProcess.ProcessState.NotRunning
168 ): 175 ):
169 self.process.terminate() 176 self.process.terminate()
170 QTimer.singleShot(2000, self.process.kill) 177 QTimer.singleShot(2000, self.process.kill)
171 self.process.waitForFinished(3000) 178 self.process.waitForFinished(3000)
172 179
173 self.inputGroup.setEnabled(False) 180 self.inputGroup.setEnabled(False)
174 self.inputGroup.hide() 181 self.inputGroup.hide()
175 self.refreshButton.setEnabled(True) 182 self.refreshButton.setEnabled(True)
176 183
177 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) 184 self.buttonBox.button(
178 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) 185 QDialogButtonBox.StandardButton.Close).setEnabled(True)
179 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) 186 self.buttonBox.button(
180 self.buttonBox.button(QDialogButtonBox.Close).setFocus( 187 QDialogButtonBox.StandardButton.Cancel).setEnabled(False)
181 Qt.OtherFocusReason) 188 self.buttonBox.button(
189 QDialogButtonBox.StandardButton.Close).setDefault(True)
190 self.buttonBox.button(
191 QDialogButtonBox.StandardButton.Close).setFocus(
192 Qt.FocusReason.OtherFocusReason)
182 193
183 self.__resort() 194 self.__resort()
184 self.__resizeColumns() 195 self.__resizeColumns()
185 196
186 self.__updateButtons() 197 self.__updateButtons()
189 """ 200 """
190 Private slot called by a button of the button box clicked. 201 Private slot called by a button of the button box clicked.
191 202
192 @param button button that was clicked (QAbstractButton) 203 @param button button that was clicked (QAbstractButton)
193 """ 204 """
194 if button == self.buttonBox.button(QDialogButtonBox.Close): 205 if button == self.buttonBox.button(
206 QDialogButtonBox.StandardButton.Close
207 ):
195 self.close() 208 self.close()
196 elif button == self.buttonBox.button(QDialogButtonBox.Cancel): 209 elif button == self.buttonBox.button(
210 QDialogButtonBox.StandardButton.Cancel
211 ):
197 self.__finish() 212 self.__finish()
198 elif button == self.refreshButton: 213 elif button == self.refreshButton:
199 self.on_refreshButton_clicked() 214 self.on_refreshButton_clicked()
200 215
201 def __procFinished(self, exitCode, exitStatus): 216 def __procFinished(self, exitCode, exitStatus):
213 228
214 It reads the output of the process, formats it and inserts it into 229 It reads the output of the process, formats it and inserts it into
215 the contents pane. 230 the contents pane.
216 """ 231 """
217 if self.process is not None: 232 if self.process is not None:
218 self.process.setReadChannel(QProcess.StandardOutput) 233 self.process.setReadChannel(QProcess.ProcessChannel.StandardOutput)
219 234
220 while self.process.canReadLine(): 235 while self.process.canReadLine():
221 line = str(self.process.readLine(), self.__ioEncoding, 236 line = str(self.process.readLine(), self.__ioEncoding,
222 'replace').strip() 237 'replace').strip()
223 238
245 Private slot to handle the password checkbox toggled. 260 Private slot to handle the password checkbox toggled.
246 261
247 @param isOn flag indicating the status of the check box (boolean) 262 @param isOn flag indicating the status of the check box (boolean)
248 """ 263 """
249 if isOn: 264 if isOn:
250 self.input.setEchoMode(QLineEdit.Password) 265 self.input.setEchoMode(QLineEdit.EchoMode.Password)
251 else: 266 else:
252 self.input.setEchoMode(QLineEdit.Normal) 267 self.input.setEchoMode(QLineEdit.EchoMode.Normal)
253 268
254 @pyqtSlot() 269 @pyqtSlot()
255 def on_sendButton_clicked(self): 270 def on_sendButton_clicked(self):
256 """ 271 """
257 Private slot to send the input to the git process. 272 Private slot to send the input to the git process.

eric ide

mercurial