eric6/Plugins/VcsPlugins/vcsGit/GitReflogBrowserDialog.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitReflogBrowserDialog.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/Plugins/VcsPlugins/vcsGit/GitReflogBrowserDialog.py	Tue Mar 02 17:17:09 2021 +0100
@@ -46,13 +46,15 @@
         
         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.logTree.headerItem().setText(self.logTree.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 list of commits"))
         self.refreshButton.setEnabled(False)
@@ -95,7 +97,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 +130,8 @@
         """
         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 __generateReflogItem(self, commitId, selector, name, subject):
@@ -159,9 +162,12 @@
         @param skip number of reflog entries to skip (integer)
         """
         self.refreshButton.setEnabled(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()
         
         self.buf = []
@@ -239,15 +245,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()
@@ -296,7 +305,8 @@
         # restore current item
         if self.__currentCommitId:
             items = self.logTree.findItems(
-                self.__currentCommitId, Qt.MatchExactly, self.CommitIdColumn)
+                self.__currentCommitId, Qt.MatchFlag.MatchExactly,
+                self.CommitIdColumn)
             if items:
                 self.logTree.setCurrentItem(items[0])
                 self.__currentCommitId = ""
@@ -307,7 +317,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(),
@@ -344,9 +354,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:
@@ -373,9 +387,9 @@
         @param isOn flag indicating the status of the check box (boolean)
         """
         if isOn:
-            self.input.setEchoMode(QLineEdit.Password)
+            self.input.setEchoMode(QLineEdit.EchoMode.Password)
         else:
-            self.input.setEchoMode(QLineEdit.Normal)
+            self.input.setEchoMode(QLineEdit.EchoMode.Normal)
     
     @pyqtSlot()
     def on_sendButton_clicked(self):

eric ide

mercurial