eric6/Plugins/VcsPlugins/vcsSubversion/SvnTagBranchListDialog.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
35 @param vcs reference to the vcs object 35 @param vcs reference to the vcs object
36 @param parent parent widget (QWidget) 36 @param parent parent widget (QWidget)
37 """ 37 """
38 super(SvnTagBranchListDialog, self).__init__(parent) 38 super(SvnTagBranchListDialog, self).__init__(parent)
39 self.setupUi(self) 39 self.setupUi(self)
40 self.setWindowFlags(Qt.Window) 40 self.setWindowFlags(Qt.WindowType.Window)
41 41
42 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) 42 self.buttonBox.button(
43 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) 43 QDialogButtonBox.StandardButton.Close).setEnabled(False)
44 self.buttonBox.button(
45 QDialogButtonBox.StandardButton.Cancel).setDefault(True)
44 46
45 self.vcs = vcs 47 self.vcs = vcs
46 self.tagsList = None 48 self.tagsList = None
47 self.allTagsList = None 49 self.allTagsList = None
48 50
49 self.tagList.headerItem().setText(self.tagList.columnCount(), "") 51 self.tagList.headerItem().setText(self.tagList.columnCount(), "")
50 self.tagList.header().setSortIndicator(3, Qt.AscendingOrder) 52 self.tagList.header().setSortIndicator(3, Qt.SortOrder.AscendingOrder)
51 53
52 self.process = QProcess() 54 self.process = QProcess()
53 self.process.finished.connect(self.__procFinished) 55 self.process.finished.connect(self.__procFinished)
54 self.process.readyReadStandardOutput.connect(self.__readStdout) 56 self.process.readyReadStandardOutput.connect(self.__readStdout)
55 self.process.readyReadStandardError.connect(self.__readStderr) 57 self.process.readyReadStandardError.connect(self.__readStderr)
64 66
65 @param e close event (QCloseEvent) 67 @param e close event (QCloseEvent)
66 """ 68 """
67 if ( 69 if (
68 self.process is not None and 70 self.process is not None and
69 self.process.state() != QProcess.NotRunning 71 self.process.state() != QProcess.ProcessState.NotRunning
70 ): 72 ):
71 self.process.terminate() 73 self.process.terminate()
72 QTimer.singleShot(2000, self.process.kill) 74 QTimer.singleShot(2000, self.process.kill)
73 self.process.waitForFinished(3000) 75 self.process.waitForFinished(3000)
74 76
142 reposPath, ok = QInputDialog.getText( 144 reposPath, ok = QInputDialog.getText(
143 self, 145 self,
144 self.tr("Subversion List"), 146 self.tr("Subversion List"),
145 self.tr("Enter the repository URL containing the tags" 147 self.tr("Enter the repository URL containing the tags"
146 " or branches"), 148 " or branches"),
147 QLineEdit.Normal, 149 QLineEdit.EchoMode.Normal,
148 self.vcs.svnNormalizeURL(reposURL)) 150 self.vcs.svnNormalizeURL(reposURL))
149 if not ok: 151 if not ok:
150 self.close() 152 self.close()
151 return 153 return
152 if not reposPath: 154 if not reposPath:
183 Private slot called when the process finished or the user pressed the 185 Private slot called when the process finished or the user pressed the
184 button. 186 button.
185 """ 187 """
186 if ( 188 if (
187 self.process is not None and 189 self.process is not None and
188 self.process.state() != QProcess.NotRunning 190 self.process.state() != QProcess.ProcessState.NotRunning
189 ): 191 ):
190 self.process.terminate() 192 self.process.terminate()
191 QTimer.singleShot(2000, self.process.kill) 193 QTimer.singleShot(2000, self.process.kill)
192 self.process.waitForFinished(3000) 194 self.process.waitForFinished(3000)
193 195
194 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) 196 self.buttonBox.button(
195 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) 197 QDialogButtonBox.StandardButton.Close).setEnabled(True)
196 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) 198 self.buttonBox.button(
197 self.buttonBox.button(QDialogButtonBox.Close).setFocus( 199 QDialogButtonBox.StandardButton.Cancel).setEnabled(False)
198 Qt.OtherFocusReason) 200 self.buttonBox.button(
201 QDialogButtonBox.StandardButton.Close).setDefault(True)
202 self.buttonBox.button(
203 QDialogButtonBox.StandardButton.Close).setFocus(
204 Qt.FocusReason.OtherFocusReason)
199 205
200 self.inputGroup.setEnabled(False) 206 self.inputGroup.setEnabled(False)
201 self.inputGroup.hide() 207 self.inputGroup.hide()
202 208
203 self.__resizeColumns() 209 self.__resizeColumns()
207 """ 213 """
208 Private slot called by a button of the button box clicked. 214 Private slot called by a button of the button box clicked.
209 215
210 @param button button that was clicked (QAbstractButton) 216 @param button button that was clicked (QAbstractButton)
211 """ 217 """
212 if button == self.buttonBox.button(QDialogButtonBox.Close): 218 if button == self.buttonBox.button(
219 QDialogButtonBox.StandardButton.Close
220 ):
213 self.close() 221 self.close()
214 elif button == self.buttonBox.button(QDialogButtonBox.Cancel): 222 elif button == self.buttonBox.button(
223 QDialogButtonBox.StandardButton.Cancel
224 ):
215 self.__finish() 225 self.__finish()
216 226
217 def __procFinished(self, exitCode, exitStatus): 227 def __procFinished(self, exitCode, exitStatus):
218 """ 228 """
219 Private slot connected to the finished signal. 229 Private slot connected to the finished signal.
233 243
234 def __resizeColumns(self): 244 def __resizeColumns(self):
235 """ 245 """
236 Private method to resize the list columns. 246 Private method to resize the list columns.
237 """ 247 """
238 self.tagList.header().resizeSections(QHeaderView.ResizeToContents) 248 self.tagList.header().resizeSections(
249 QHeaderView.ResizeMode.ResizeToContents)
239 self.tagList.header().setStretchLastSection(True) 250 self.tagList.header().setStretchLastSection(True)
240 251
241 def __generateItem(self, revision, author, date, name): 252 def __generateItem(self, revision, author, date, name):
242 """ 253 """
243 Private method to generate a tag item in the taglist. 254 Private method to generate a tag item in the taglist.
246 @param author author of the tag (string) 257 @param author author of the tag (string)
247 @param date date of the tag (string) 258 @param date date of the tag (string)
248 @param name name (path) of the tag (string) 259 @param name name (path) of the tag (string)
249 """ 260 """
250 itm = QTreeWidgetItem(self.tagList) 261 itm = QTreeWidgetItem(self.tagList)
251 itm.setData(0, Qt.DisplayRole, int(revision)) 262 itm.setData(0, Qt.ItemDataRole.DisplayRole, int(revision))
252 itm.setData(1, Qt.DisplayRole, author) 263 itm.setData(1, Qt.ItemDataRole.DisplayRole, author)
253 itm.setData(2, Qt.DisplayRole, date) 264 itm.setData(2, Qt.ItemDataRole.DisplayRole, date)
254 itm.setData(3, Qt.DisplayRole, name) 265 itm.setData(3, Qt.ItemDataRole.DisplayRole, name)
255 itm.setTextAlignment(0, Qt.AlignRight) 266 itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight)
256 267
257 def __readStdout(self): 268 def __readStdout(self):
258 """ 269 """
259 Private slot to handle the readyReadStdout signal. 270 Private slot to handle the readyReadStdout signal.
260 271
261 It reads the output of the process, formats it and inserts it into 272 It reads the output of the process, formats it and inserts it into
262 the contents pane. 273 the contents pane.
263 """ 274 """
264 self.process.setReadChannel(QProcess.StandardOutput) 275 self.process.setReadChannel(QProcess.ProcessChannel.StandardOutput)
265 276
266 while self.process.canReadLine(): 277 while self.process.canReadLine():
267 s = str(self.process.readLine(), 278 s = str(self.process.readLine(),
268 Preferences.getSystem("IOEncoding"), 279 Preferences.getSystem("IOEncoding"),
269 'replace') 280 'replace')
303 Private slot to handle the password checkbox toggled. 314 Private slot to handle the password checkbox toggled.
304 315
305 @param isOn flag indicating the status of the check box (boolean) 316 @param isOn flag indicating the status of the check box (boolean)
306 """ 317 """
307 if isOn: 318 if isOn:
308 self.input.setEchoMode(QLineEdit.Password) 319 self.input.setEchoMode(QLineEdit.EchoMode.Password)
309 else: 320 else:
310 self.input.setEchoMode(QLineEdit.Normal) 321 self.input.setEchoMode(QLineEdit.EchoMode.Normal)
311 322
312 @pyqtSlot() 323 @pyqtSlot()
313 def on_sendButton_clicked(self): 324 def on_sendButton_clicked(self):
314 """ 325 """
315 Private slot to send the input to the subversion process. 326 Private slot to send the input to the subversion process.

eric ide

mercurial