eric6/Plugins/VcsPlugins/vcsPySvn/SvnLogBrowserDialog.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8151
8c1445825e7b
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnLogBrowserDialog.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnLogBrowserDialog.py	Tue Mar 02 17:17:09 2021 +0100
@@ -47,14 +47,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
         
@@ -64,8 +67,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.flags = {
             'A': self.tr('Added'),
@@ -143,16 +146,20 @@
         
         self.cancelled = False
         
-        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()
     
     def __resizeColumnsLog(self):
         """
         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):
@@ -167,7 +174,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):
@@ -204,10 +212,11 @@
             dt = formatTime(date)
         
         itm = QTreeWidgetItem(self.logTree)
-        itm.setData(0, Qt.DisplayRole, rev)
-        itm.setData(1, Qt.DisplayRole, author)
-        itm.setData(2, Qt.DisplayRole, dt)
-        itm.setData(3, Qt.DisplayRole, " ".join(message.splitlines()))
+        itm.setData(0, Qt.ItemDataRole.DisplayRole, rev)
+        itm.setData(1, Qt.ItemDataRole.DisplayRole, author)
+        itm.setData(2, Qt.ItemDataRole.DisplayRole, dt)
+        itm.setData(3, Qt.ItemDataRole.DisplayRole,
+                    " ".join(message.splitlines()))
         
         changes = []
         for changedPath in changedPaths:
@@ -230,11 +239,11 @@
         itm.setData(0, self.__messageRole, message)
         itm.setData(0, self.__changesRole, changes)
         
-        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)
         
         return itm
     
@@ -253,7 +262,7 @@
             [self.flags[action], path, copyFrom, copyRev]
         )
         
-        itm.setTextAlignment(3, Qt.AlignRight)
+        itm.setTextAlignment(3, Qt.AlignmentFlag.AlignRight)
         
         return itm
     
@@ -371,9 +380,12 @@
         """
         Private slot called when the user pressed the button.
         """
-        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._cancel()
     
@@ -403,9 +415,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()
     

eric ide

mercurial