eric6/Plugins/VcsPlugins/vcsSubversion/SvnLogBrowserDialog.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8151
8c1445825e7b
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
40 super(SvnLogBrowserDialog, self).__init__(parent) 40 super(SvnLogBrowserDialog, self).__init__(parent)
41 self.setupUi(self) 41 self.setupUi(self)
42 42
43 self.__position = QPoint() 43 self.__position = QPoint()
44 44
45 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) 45 self.buttonBox.button(
46 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) 46 QDialogButtonBox.StandardButton.Close).setEnabled(False)
47 self.buttonBox.button(
48 QDialogButtonBox.StandardButton.Cancel).setDefault(True)
47 49
48 self.upButton.setIcon(UI.PixmapCache.getIcon("1uparrow")) 50 self.upButton.setIcon(UI.PixmapCache.getIcon("1uparrow"))
49 self.downButton.setIcon(UI.PixmapCache.getIcon("1downarrow")) 51 self.downButton.setIcon(UI.PixmapCache.getIcon("1downarrow"))
50 52
51 self.filesTree.headerItem().setText(self.filesTree.columnCount(), "") 53 self.filesTree.headerItem().setText(self.filesTree.columnCount(), "")
52 self.filesTree.header().setSortIndicator(0, Qt.AscendingOrder) 54 self.filesTree.header().setSortIndicator(
55 0, Qt.SortOrder.AscendingOrder)
53 56
54 self.vcs = vcs 57 self.vcs = vcs
55 58
56 self.__initData() 59 self.__initData()
57 60
58 self.fromDate.setDisplayFormat("yyyy-MM-dd") 61 self.fromDate.setDisplayFormat("yyyy-MM-dd")
59 self.toDate.setDisplayFormat("yyyy-MM-dd") 62 self.toDate.setDisplayFormat("yyyy-MM-dd")
60 self.__resetUI() 63 self.__resetUI()
61 64
62 self.__messageRole = Qt.UserRole 65 self.__messageRole = Qt.ItemDataRole.UserRole
63 self.__changesRole = Qt.UserRole + 1 66 self.__changesRole = Qt.ItemDataRole.UserRole + 1
64 67
65 self.__process = E5OverrideCursorProcess() 68 self.__process = E5OverrideCursorProcess()
66 self.__process.finished.connect(self.__procFinished) 69 self.__process.finished.connect(self.__procFinished)
67 self.__process.readyReadStandardOutput.connect(self.__readStdout) 70 self.__process.readyReadStandardOutput.connect(self.__readStdout)
68 self.__process.readyReadStandardError.connect(self.__readStderr) 71 self.__process.readyReadStandardError.connect(self.__readStderr)
133 136
134 @param e close event (QCloseEvent) 137 @param e close event (QCloseEvent)
135 """ 138 """
136 if ( 139 if (
137 self.__process is not None and 140 self.__process is not None and
138 self.__process.state() != QProcess.NotRunning 141 self.__process.state() != QProcess.ProcessState.NotRunning
139 ): 142 ):
140 self.__process.terminate() 143 self.__process.terminate()
141 QTimer.singleShot(2000, self.__process.kill) 144 QTimer.singleShot(2000, self.__process.kill)
142 self.__process.waitForFinished(3000) 145 self.__process.waitForFinished(3000)
143 146
175 178
176 def __resizeColumnsLog(self): 179 def __resizeColumnsLog(self):
177 """ 180 """
178 Private method to resize the log tree columns. 181 Private method to resize the log tree columns.
179 """ 182 """
180 self.logTree.header().resizeSections(QHeaderView.ResizeToContents) 183 self.logTree.header().resizeSections(
184 QHeaderView.ResizeMode.ResizeToContents)
181 self.logTree.header().setStretchLastSection(True) 185 self.logTree.header().setStretchLastSection(True)
182 186
183 def __resortLog(self): 187 def __resortLog(self):
184 """ 188 """
185 Private method to resort the log tree. 189 Private method to resort the log tree.
190 194
191 def __resizeColumnsFiles(self): 195 def __resizeColumnsFiles(self):
192 """ 196 """
193 Private method to resize the changed files tree columns. 197 Private method to resize the changed files tree columns.
194 """ 198 """
195 self.filesTree.header().resizeSections(QHeaderView.ResizeToContents) 199 self.filesTree.header().resizeSections(
200 QHeaderView.ResizeMode.ResizeToContents)
196 self.filesTree.header().setStretchLastSection(True) 201 self.filesTree.header().setStretchLastSection(True)
197 202
198 def __resortFiles(self): 203 def __resortFiles(self):
199 """ 204 """
200 Private method to resort the changed files tree. 205 Private method to resort the changed files tree.
220 msg = [] 225 msg = []
221 for line in message: 226 for line in message:
222 msg.append(line.strip()) 227 msg.append(line.strip())
223 228
224 itm = QTreeWidgetItem(self.logTree) 229 itm = QTreeWidgetItem(self.logTree)
225 itm.setData(0, Qt.DisplayRole, int(revision)) 230 itm.setData(0, Qt.ItemDataRole.DisplayRole, int(revision))
226 itm.setData(1, Qt.DisplayRole, author) 231 itm.setData(1, Qt.ItemDataRole.DisplayRole, author)
227 itm.setData(2, Qt.DisplayRole, date) 232 itm.setData(2, Qt.ItemDataRole.DisplayRole, date)
228 itm.setData(3, Qt.DisplayRole, " ".join(msg)) 233 itm.setData(3, Qt.ItemDataRole.DisplayRole, " ".join(msg))
229 234
230 itm.setData(0, self.__messageRole, message) 235 itm.setData(0, self.__messageRole, message)
231 itm.setData(0, self.__changesRole, changedPaths) 236 itm.setData(0, self.__changesRole, changedPaths)
232 237
233 itm.setTextAlignment(0, Qt.AlignRight) 238 itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight)
234 itm.setTextAlignment(1, Qt.AlignLeft) 239 itm.setTextAlignment(1, Qt.AlignmentFlag.AlignLeft)
235 itm.setTextAlignment(2, Qt.AlignLeft) 240 itm.setTextAlignment(2, Qt.AlignmentFlag.AlignLeft)
236 itm.setTextAlignment(3, Qt.AlignLeft) 241 itm.setTextAlignment(3, Qt.AlignmentFlag.AlignLeft)
237 itm.setTextAlignment(4, Qt.AlignLeft) 242 itm.setTextAlignment(4, Qt.AlignmentFlag.AlignLeft)
238 243
239 try: 244 try:
240 self.__lastRev = int(revision) 245 self.__lastRev = int(revision)
241 except ValueError: 246 except ValueError:
242 self.__lastRev = 0 247 self.__lastRev = 0
258 path, 263 path,
259 copyFrom, 264 copyFrom,
260 copyRev, 265 copyRev,
261 ]) 266 ])
262 267
263 itm.setTextAlignment(3, Qt.AlignRight) 268 itm.setTextAlignment(3, Qt.AlignmentFlag.AlignRight)
264 269
265 return itm 270 return itm
266 271
267 def __getLogEntries(self, startRev=None): 272 def __getLogEntries(self, startRev=None):
268 """ 273 """
269 Private method to retrieve log entries from the repository. 274 Private method to retrieve log entries from the repository.
270 275
271 @param startRev revision number to start from (integer, string) 276 @param startRev revision number to start from (integer, string)
272 """ 277 """
273 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) 278 self.buttonBox.button(
274 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) 279 QDialogButtonBox.StandardButton.Close).setEnabled(False)
275 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) 280 self.buttonBox.button(
281 QDialogButtonBox.StandardButton.Cancel).setEnabled(True)
282 self.buttonBox.button(
283 QDialogButtonBox.StandardButton.Cancel).setDefault(True)
276 QApplication.processEvents() 284 QApplication.processEvents()
277 285
278 self.intercept = False 286 self.intercept = False
279 self.__process.kill() 287 self.__process.kill()
280 288
355 Private slot called when the process finished or the user pressed the 363 Private slot called when the process finished or the user pressed the
356 button. 364 button.
357 """ 365 """
358 if ( 366 if (
359 self.__process is not None and 367 self.__process is not None and
360 self.__process.state() != QProcess.NotRunning 368 self.__process.state() != QProcess.ProcessState.NotRunning
361 ): 369 ):
362 self.__process.terminate() 370 self.__process.terminate()
363 QTimer.singleShot(2000, self.__process.kill) 371 QTimer.singleShot(2000, self.__process.kill)
364 self.__process.waitForFinished(3000) 372 self.__process.waitForFinished(3000)
365 373
366 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) 374 self.buttonBox.button(
367 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) 375 QDialogButtonBox.StandardButton.Close).setEnabled(True)
368 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) 376 self.buttonBox.button(
377 QDialogButtonBox.StandardButton.Cancel).setEnabled(False)
378 self.buttonBox.button(
379 QDialogButtonBox.StandardButton.Close).setDefault(True)
369 380
370 self.inputGroup.setEnabled(False) 381 self.inputGroup.setEnabled(False)
371 self.inputGroup.hide() 382 self.inputGroup.hide()
372 383
373 while self.__finishCallbacks: 384 while self.__finishCallbacks:
424 ): 435 ):
425 if len(log) > 1: 436 if len(log) > 1:
426 self.__generateLogItem( 437 self.__generateLogItem(
427 log["author"], log["date"], log["message"], 438 log["author"], log["date"], log["message"],
428 log["revision"], changedPaths) 439 log["revision"], changedPaths)
429 dt = QDate.fromString(log["date"], Qt.ISODate) 440 dt = QDate.fromString(log["date"], Qt.DateFormat.ISODate)
430 if ( 441 if (
431 not self.__maxDate.isValid() and 442 not self.__maxDate.isValid() and
432 not self.__minDate.isValid() 443 not self.__minDate.isValid()
433 ): 444 ):
434 self.__maxDate = dt 445 self.__maxDate = dt
467 """ 478 """
468 Private slot to handle the readyReadStandardOutput signal. 479 Private slot to handle the readyReadStandardOutput signal.
469 480
470 It reads the output of the process and inserts it into a buffer. 481 It reads the output of the process and inserts it into a buffer.
471 """ 482 """
472 self.__process.setReadChannel(QProcess.StandardOutput) 483 self.__process.setReadChannel(QProcess.ProcessChannel.StandardOutput)
473 484
474 while self.__process.canReadLine(): 485 while self.__process.canReadLine():
475 line = str(self.__process.readLine(), 486 line = str(self.__process.readLine(),
476 Preferences.getSystem("IOEncoding"), 487 Preferences.getSystem("IOEncoding"),
477 'replace') 488 'replace')
514 """ 525 """
515 Private slot called by a button of the button box clicked. 526 Private slot called by a button of the button box clicked.
516 527
517 @param button button that was clicked (QAbstractButton) 528 @param button button that was clicked (QAbstractButton)
518 """ 529 """
519 if button == self.buttonBox.button(QDialogButtonBox.Close): 530 if button == self.buttonBox.button(
531 QDialogButtonBox.StandardButton.Close
532 ):
520 self.close() 533 self.close()
521 elif button == self.buttonBox.button(QDialogButtonBox.Cancel): 534 elif button == self.buttonBox.button(
535 QDialogButtonBox.StandardButton.Cancel
536 ):
522 self.cancelled = True 537 self.cancelled = True
523 self.__finish() 538 self.__finish()
524 539
525 @pyqtSlot(QTreeWidgetItem, QTreeWidgetItem) 540 @pyqtSlot(QTreeWidgetItem, QTreeWidgetItem)
526 def on_logTree_currentItemChanged(self, current, previous): 541 def on_logTree_currentItemChanged(self, current, previous):
729 Private slot to handle the password checkbox toggled. 744 Private slot to handle the password checkbox toggled.
730 745
731 @param isOn flag indicating the status of the check box (boolean) 746 @param isOn flag indicating the status of the check box (boolean)
732 """ 747 """
733 if isOn: 748 if isOn:
734 self.input.setEchoMode(QLineEdit.Password) 749 self.input.setEchoMode(QLineEdit.EchoMode.Password)
735 else: 750 else:
736 self.input.setEchoMode(QLineEdit.Normal) 751 self.input.setEchoMode(QLineEdit.EchoMode.Normal)
737 752
738 @pyqtSlot() 753 @pyqtSlot()
739 def on_sendButton_clicked(self): 754 def on_sendButton_clicked(self):
740 """ 755 """
741 Private slot to send the input to the subversion process. 756 Private slot to send the input to the subversion process.

eric ide

mercurial