eric6/Plugins/VcsPlugins/vcsGit/GitStashBrowserDialog.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
diff -r 27f636beebad -r 2c730d5fd177 eric6/Plugins/VcsPlugins/vcsGit/GitStashBrowserDialog.py
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitStashBrowserDialog.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/Plugins/VcsPlugins/vcsGit/GitStashBrowserDialog.py	Tue Mar 02 17:17:09 2021 +0100
@@ -34,8 +34,8 @@
     
     Separator = "@@||@@"
     
-    TotalStatisticsRole = Qt.UserRole
-    FileStatisticsRole = Qt.UserRole + 1
+    TotalStatisticsRole = Qt.ItemDataRole.UserRole
+    FileStatisticsRole = Qt.ItemDataRole.UserRole + 1
     
     def __init__(self, vcs, parent=None):
         """
@@ -47,18 +47,21 @@
         super(GitStashBrowserDialog, 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.stashList.header().setSortIndicator(0, Qt.AscendingOrder)
+        self.stashList.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 stashes"))
         self.refreshButton.setEnabled(False)
@@ -98,7 +101,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)
@@ -128,7 +131,8 @@
         """
         Private method to resize the shelve list columns.
         """
-        self.stashList.header().resizeSections(QHeaderView.ResizeToContents)
+        self.stashList.header().resizeSections(
+            QHeaderView.ResizeMode.ResizeToContents)
         self.stashList.header().setStretchLastSection(True)
     
     def __generateStashEntry(self, name, date, message):
@@ -145,9 +149,12 @@
         """
         Private method to retrieve the list of stashes.
         """
-        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.inputGroup.setEnabled(True)
         self.inputGroup.show()
@@ -223,15 +230,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()
@@ -258,7 +268,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(), self.__ioEncoding,
@@ -287,9 +297,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()
         elif button == self.refreshButton:
@@ -356,7 +370,7 @@
                     dataDict["file"], dataDict["total"],
                     dataDict["added"], dataDict["deleted"]])
             self.statisticsList.header().resizeSections(
-                QHeaderView.ResizeToContents)
+                QHeaderView.ResizeMode.ResizeToContents)
             self.statisticsList.header().setStretchLastSection(True)
             
             totals = current.data(0, self.TotalStatisticsRole)
@@ -428,9 +442,9 @@
         @param checked flag indicating the status of the check box (boolean)
         """
         if checked:
-            self.input.setEchoMode(QLineEdit.Password)
+            self.input.setEchoMode(QLineEdit.EchoMode.Password)
         else:
-            self.input.setEchoMode(QLineEdit.Normal)
+            self.input.setEchoMode(QLineEdit.EchoMode.Normal)
     
     def keyPressEvent(self, evt):
         """

eric ide

mercurial