eric6/Plugins/VcsPlugins/vcsMercurial/HgStatusDialog.py

changeset 8143
2c730d5fd177
parent 7979
54b73174ab61
child 8151
8c1445825e7b
diff -r 27f636beebad -r 2c730d5fd177 eric6/Plugins/VcsPlugins/vcsMercurial/HgStatusDialog.py
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgStatusDialog.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgStatusDialog.py	Tue Mar 02 17:17:09 2021 +0100
@@ -50,12 +50,14 @@
         self.__lastColumn = self.statusList.columnCount()
         
         self.refreshButton = self.buttonBox.addButton(
-            self.tr("Refresh"), QDialogButtonBox.ActionRole)
+            self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole)
         self.refreshButton.setToolTip(
             self.tr("Press to refresh the status display"))
         self.refreshButton.setEnabled(False)
-        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.diff = None
         self.vcs = vcs
@@ -65,7 +67,7 @@
         
         self.statusList.headerItem().setText(self.__lastColumn, "")
         self.statusList.header().setSortIndicator(
-            self.__pathColumn, Qt.AscendingOrder)
+            self.__pathColumn, Qt.SortOrder.AscendingOrder)
         
         font = Preferences.getEditorOtherFonts("MonospacedFont")
         self.diffEdit.document().setDefaultFont(font)
@@ -257,7 +259,8 @@
         """
         Private method to resize the list columns.
         """
-        self.statusList.header().resizeSections(QHeaderView.ResizeToContents)
+        self.statusList.header().resizeSections(
+            QHeaderView.ResizeMode.ResizeToContents)
         self.statusList.header().setStretchLastSection(True)
     
     def __generateItem(self, status, path):
@@ -274,14 +277,15 @@
             path,
         ])
         
-        itm.setTextAlignment(1, Qt.AlignHCenter)
-        itm.setTextAlignment(2, Qt.AlignLeft)
+        itm.setTextAlignment(1, Qt.AlignmentFlag.AlignHCenter)
+        itm.setTextAlignment(2, Qt.AlignmentFlag.AlignLeft)
     
         if status in "AMR":
-            itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable)
-            itm.setCheckState(self.__toBeCommittedColumn, Qt.Checked)
+            itm.setFlags(itm.flags() | Qt.ItemFlag.ItemIsUserCheckable)
+            itm.setCheckState(self.__toBeCommittedColumn,
+                              Qt.CheckState.Checked)
         else:
-            itm.setFlags(itm.flags() & ~Qt.ItemIsUserCheckable)
+            itm.setFlags(itm.flags() & ~Qt.ItemFlag.ItemIsUserCheckable)
         
         if statusText not in self.__statusFilters:
             self.__statusFilters.append(statusText)
@@ -342,11 +346,15 @@
         """
         self.refreshButton.setEnabled(True)
         
-        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)
         
         self.__statusFilters.sort()
         self.__statusFilters.insert(0, "<{0}>".format(self.tr("all")))
@@ -366,9 +374,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.__hgClient.cancel()
         elif button == self.refreshButton:
             self.on_refreshButton_clicked()
@@ -682,7 +694,10 @@
         commitableItems = []
         for index in range(self.statusList.topLevelItemCount()):
             itm = self.statusList.topLevelItem(index)
-            if itm.checkState(self.__toBeCommittedColumn) == Qt.Checked:
+            if (
+                itm.checkState(self.__toBeCommittedColumn) ==
+                Qt.CheckState.Checked
+            ):
                 commitableItems.append(itm)
         return commitableItems
     
@@ -697,8 +712,9 @@
         for index in range(self.statusList.topLevelItemCount()):
             itm = self.statusList.topLevelItem(index)
             if (
-                itm.flags() & Qt.ItemIsUserCheckable and
-                itm.checkState(self.__toBeCommittedColumn) == Qt.Unchecked
+                itm.flags() & Qt.ItemFlag.ItemIsUserCheckable and
+                itm.checkState(self.__toBeCommittedColumn) ==
+                Qt.CheckState.Unchecked
             ):
                 items.append(itm)
         return items
@@ -748,11 +764,13 @@
         """
         for index in range(self.statusList.topLevelItemCount()):
             itm = self.statusList.topLevelItem(index)
-            if itm.flags() & Qt.ItemIsUserCheckable:
+            if itm.flags() & Qt.ItemFlag.ItemIsUserCheckable:
                 if selected:
-                    itm.setCheckState(self.__toBeCommittedColumn, Qt.Checked)
+                    itm.setCheckState(self.__toBeCommittedColumn,
+                                      Qt.CheckState.Checked)
                 else:
-                    itm.setCheckState(self.__toBeCommittedColumn, Qt.Unchecked)
+                    itm.setCheckState(self.__toBeCommittedColumn,
+                                      Qt.CheckState.Unchecked)
     
     def __commitMerge(self):
         """
@@ -801,7 +819,7 @@
             self.diffEdit.setPlainText("".join(diff))
         
         tc = self.diffEdit.textCursor()
-        tc.movePosition(QTextCursor.Start)
+        tc.movePosition(QTextCursor.MoveOperation.Start)
         self.diffEdit.setTextCursor(tc)
         self.diffEdit.ensureCursorVisible()
     

eric ide

mercurial