eric6/Plugins/VcsPlugins/vcsMercurial/ShelveExtension/HgShelveBrowserDialog.py

changeset 8143
2c730d5fd177
parent 7971
ff2971513d6d
child 8218
7c09585bd960
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/ShelveExtension/HgShelveBrowserDialog.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/Plugins/VcsPlugins/vcsMercurial/ShelveExtension/HgShelveBrowserDialog.py	Tue Mar 02 17:17:09 2021 +0100
@@ -36,18 +36,21 @@
         super(HgShelveBrowserDialog, self).__init__(parent)
         self.setupUi(self)
         
-        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.__position = QPoint()
         
-        self.__fileStatisticsRole = Qt.UserRole
-        self.__totalStatisticsRole = Qt.UserRole + 1
+        self.__fileStatisticsRole = Qt.ItemDataRole.UserRole
+        self.__totalStatisticsRole = Qt.ItemDataRole.UserRole + 1
         
-        self.shelveList.header().setSortIndicator(0, Qt.AscendingOrder)
+        self.shelveList.header().setSortIndicator(
+            0, Qt.SortOrder.AscendingOrder)
         
         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 list of shelves"))
         self.refreshButton.setEnabled(False)
@@ -97,7 +100,8 @@
         """
         Private method to resize the shelve list columns.
         """
-        self.shelveList.header().resizeSections(QHeaderView.ResizeToContents)
+        self.shelveList.header().resizeSections(
+            QHeaderView.ResizeMode.ResizeToContents)
         self.shelveList.header().setStretchLastSection(True)
     
     def __generateShelveEntry(self, name, age, message, fileStatistics,
@@ -123,9 +127,12 @@
         """
         Private method to retrieve the list of shelves.
         """
-        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.buf = []
@@ -163,9 +170,12 @@
         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.StandardButton.Close).setEnabled(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Cancel).setEnabled(False)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setDefault(True)
         
         self.refreshButton.setEnabled(True)
     
@@ -238,9 +248,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.__hgClient.cancel()
         elif button == self.refreshButton:
@@ -259,7 +273,7 @@
             for dataSet in current.data(0, self.__fileStatisticsRole):
                 QTreeWidgetItem(self.statisticsList, list(dataSet))
             self.statisticsList.header().resizeSections(
-                QHeaderView.ResizeToContents)
+                QHeaderView.ResizeMode.ResizeToContents)
             self.statisticsList.header().setStretchLastSection(True)
             
             totals = current.data(0, self.__totalStatisticsRole)
@@ -292,9 +306,12 @@
         """
         Private slot to refresh the list of shelves.
         """
-        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)
         
         self.refreshButton.setEnabled(False)
         

eric ide

mercurial