eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesListDialog.py

changeset 8143
2c730d5fd177
parent 7971
ff2971513d6d
child 8218
7c09585bd960
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesListDialog.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesListDialog.py	Tue Mar 02 17:17:09 2021 +0100
@@ -29,15 +29,18 @@
         """
         super(HgQueuesListDialog, self).__init__(parent)
         self.setupUi(self)
-        self.setWindowFlags(Qt.Window)
+        self.setWindowFlags(Qt.WindowType.Window)
         
-        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.vcs = vcs
         self.__hgClient = vcs.getClient()
         
-        self.patchesList.header().setSortIndicator(0, Qt.AscendingOrder)
+        self.patchesList.header().setSortIndicator(
+            0, Qt.SortOrder.AscendingOrder)
         
         self.__statusDict = {
             "A": self.tr("applied"),
@@ -127,11 +130,15 @@
         Private slot called when the process finished or 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.Close).setFocus(
-            Qt.OtherFocusReason)
+        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.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setFocus(
+                Qt.FocusReason.OtherFocusReason)
         
         if self.patchesList.topLevelItemCount() == 0:
             # no patches present
@@ -146,9 +153,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.__mode = ""
             self.__hgClient.cancel()
     
@@ -164,7 +175,8 @@
         """
         Private method to resize the list columns.
         """
-        self.patchesList.header().resizeSections(QHeaderView.ResizeToContents)
+        self.patchesList.header().resizeSections(
+            QHeaderView.ResizeMode.ResizeToContents)
         self.patchesList.header().setStretchLastSection(True)
     
     def __generateItem(self, index, status, name, summary, error=False):
@@ -192,21 +204,21 @@
             except KeyError:
                 statusStr = self.tr("unknown")
             itm = QTreeWidgetItem(self.patchesList)
-            itm.setData(0, Qt.DisplayRole, index)
-            itm.setData(1, Qt.DisplayRole, name)
-            itm.setData(2, Qt.DisplayRole, statusStr)
-            itm.setData(3, Qt.DisplayRole, summary)
+            itm.setData(0, Qt.ItemDataRole.DisplayRole, index)
+            itm.setData(1, Qt.ItemDataRole.DisplayRole, name)
+            itm.setData(2, Qt.ItemDataRole.DisplayRole, statusStr)
+            itm.setData(3, Qt.ItemDataRole.DisplayRole, summary)
             if status == "A":
                 # applied
                 for column in range(itm.columnCount()):
-                    itm.setForeground(column, Qt.blue)
+                    itm.setForeground(column, Qt.GlobalColor.blue)
             elif status == "D":
                 # missing
                 for column in range(itm.columnCount()):
-                    itm.setForeground(column, Qt.red)
+                    itm.setForeground(column, Qt.GlobalColor.red)
         
-        itm.setTextAlignment(0, Qt.AlignRight)
-        itm.setTextAlignment(2, Qt.AlignHCenter)
+        itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight)
+        itm.setTextAlignment(2, Qt.AlignmentFlag.AlignHCenter)
     
     def __markTopItem(self, name):
         """
@@ -214,7 +226,8 @@
         
         @param name name of the patch (string)
         """
-        items = self.patchesList.findItems(name, Qt.MatchCaseSensitive, 1)
+        items = self.patchesList.findItems(
+            name, Qt.MatchFlag.MatchCaseSensitive, 1)
         if items:
             itm = items[0]
             for column in range(itm.columnCount()):

eric ide

mercurial