eric6/Plugins/VcsPlugins/vcsSubversion/SvnLogBrowserDialog.py

branch
maintenance
changeset 8176
31965986ecd1
parent 8043
0acf98cd089a
parent 8151
8c1445825e7b
child 8273
698ae46f40a4
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnLogBrowserDialog.py	Sat Mar 06 10:00:52 2021 +0100
+++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnLogBrowserDialog.py	Sun Mar 28 15:00:11 2021 +0200
@@ -42,14 +42,17 @@
         
         self.__position = QPoint()
         
-        self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
-        self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setEnabled(False)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Cancel).setDefault(True)
         
         self.upButton.setIcon(UI.PixmapCache.getIcon("1uparrow"))
         self.downButton.setIcon(UI.PixmapCache.getIcon("1downarrow"))
         
         self.filesTree.headerItem().setText(self.filesTree.columnCount(), "")
-        self.filesTree.header().setSortIndicator(0, Qt.AscendingOrder)
+        self.filesTree.header().setSortIndicator(
+            0, Qt.SortOrder.AscendingOrder)
         
         self.vcs = vcs
         
@@ -59,8 +62,8 @@
         self.toDate.setDisplayFormat("yyyy-MM-dd")
         self.__resetUI()
         
-        self.__messageRole = Qt.UserRole
-        self.__changesRole = Qt.UserRole + 1
+        self.__messageRole = Qt.ItemDataRole.UserRole
+        self.__changesRole = Qt.ItemDataRole.UserRole + 1
         
         self.__process = E5OverrideCursorProcess()
         self.__process.finished.connect(self.__procFinished)
@@ -135,7 +138,7 @@
         """
         if (
             self.__process is not None and
-            self.__process.state() != QProcess.NotRunning
+            self.__process.state() != QProcess.ProcessState.NotRunning
         ):
             self.__process.terminate()
             QTimer.singleShot(2000, self.__process.kill)
@@ -177,7 +180,8 @@
         """
         Private method to resize the log tree columns.
         """
-        self.logTree.header().resizeSections(QHeaderView.ResizeToContents)
+        self.logTree.header().resizeSections(
+            QHeaderView.ResizeMode.ResizeToContents)
         self.logTree.header().setStretchLastSection(True)
     
     def __resortLog(self):
@@ -192,7 +196,8 @@
         """
         Private method to resize the changed files tree columns.
         """
-        self.filesTree.header().resizeSections(QHeaderView.ResizeToContents)
+        self.filesTree.header().resizeSections(
+            QHeaderView.ResizeMode.ResizeToContents)
         self.filesTree.header().setStretchLastSection(True)
     
     def __resortFiles(self):
@@ -222,19 +227,19 @@
             msg.append(line.strip())
         
         itm = QTreeWidgetItem(self.logTree)
-        itm.setData(0, Qt.DisplayRole, int(revision))
-        itm.setData(1, Qt.DisplayRole, author)
-        itm.setData(2, Qt.DisplayRole, date)
-        itm.setData(3, Qt.DisplayRole, " ".join(msg))
+        itm.setData(0, Qt.ItemDataRole.DisplayRole, int(revision))
+        itm.setData(1, Qt.ItemDataRole.DisplayRole, author)
+        itm.setData(2, Qt.ItemDataRole.DisplayRole, date)
+        itm.setData(3, Qt.ItemDataRole.DisplayRole, " ".join(msg))
         
         itm.setData(0, self.__messageRole, message)
         itm.setData(0, self.__changesRole, changedPaths)
         
-        itm.setTextAlignment(0, Qt.AlignRight)
-        itm.setTextAlignment(1, Qt.AlignLeft)
-        itm.setTextAlignment(2, Qt.AlignLeft)
-        itm.setTextAlignment(3, Qt.AlignLeft)
-        itm.setTextAlignment(4, Qt.AlignLeft)
+        itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight)
+        itm.setTextAlignment(1, Qt.AlignmentFlag.AlignLeft)
+        itm.setTextAlignment(2, Qt.AlignmentFlag.AlignLeft)
+        itm.setTextAlignment(3, Qt.AlignmentFlag.AlignLeft)
+        itm.setTextAlignment(4, Qt.AlignmentFlag.AlignLeft)
         
         try:
             self.__lastRev = int(revision)
@@ -260,7 +265,7 @@
             copyRev,
         ])
         
-        itm.setTextAlignment(3, Qt.AlignRight)
+        itm.setTextAlignment(3, Qt.AlignmentFlag.AlignRight)
         
         return itm
     
@@ -270,9 +275,12 @@
         
         @param startRev revision number to start from (integer, string)
         """
-        self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
-        self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True)
-        self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setEnabled(False)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Cancel).setEnabled(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Cancel).setDefault(True)
         QApplication.processEvents()
         
         self.intercept = False
@@ -357,15 +365,18 @@
         """
         if (
             self.__process is not None and
-            self.__process.state() != QProcess.NotRunning
+            self.__process.state() != QProcess.ProcessState.NotRunning
         ):
             self.__process.terminate()
             QTimer.singleShot(2000, self.__process.kill)
             self.__process.waitForFinished(3000)
         
-        self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True)
-        self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False)
-        self.buttonBox.button(QDialogButtonBox.Close).setDefault(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setEnabled(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Cancel).setEnabled(False)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setDefault(True)
         
         self.inputGroup.setEnabled(False)
         self.inputGroup.hide()
@@ -426,7 +437,7 @@
                     self.__generateLogItem(
                         log["author"], log["date"], log["message"],
                         log["revision"], changedPaths)
-                    dt = QDate.fromString(log["date"], Qt.ISODate)
+                    dt = QDate.fromString(log["date"], Qt.DateFormat.ISODate)
                     if (
                         not self.__maxDate.isValid() and
                         not self.__minDate.isValid()
@@ -469,7 +480,7 @@
         
         It reads the output of the process and inserts it into a buffer.
         """
-        self.__process.setReadChannel(QProcess.StandardOutput)
+        self.__process.setReadChannel(QProcess.ProcessChannel.StandardOutput)
         
         while self.__process.canReadLine():
             line = str(self.__process.readLine(),
@@ -516,9 +527,13 @@
         
         @param button button that was clicked (QAbstractButton)
         """
-        if button == self.buttonBox.button(QDialogButtonBox.Close):
+        if button == self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close
+        ):
             self.close()
-        elif button == self.buttonBox.button(QDialogButtonBox.Cancel):
+        elif button == self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Cancel
+        ):
             self.cancelled = True
             self.__finish()
     
@@ -632,12 +647,13 @@
         """
         self.__filterLogs()
     
-    @pyqtSlot(str)
-    def on_fieldCombo_activated(self, txt):
+    @pyqtSlot(int)
+    def on_fieldCombo_activated(self, index):
         """
         Private slot called, when a new filter field is selected.
         
-        @param txt text of the selected field (string)
+        @param index index of the selected entry
+        @type int
         """
         self.__filterLogs()
     
@@ -731,9 +747,9 @@
         @param isOn flag indicating the status of the check box (boolean)
         """
         if isOn:
-            self.input.setEchoMode(QLineEdit.Password)
+            self.input.setEchoMode(QLineEdit.EchoMode.Password)
         else:
-            self.input.setEchoMode(QLineEdit.Normal)
+            self.input.setEchoMode(QLineEdit.EchoMode.Normal)
     
     @pyqtSlot()
     def on_sendButton_clicked(self):

eric ide

mercurial