eric6/Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8176
31965986ecd1
child 8218
7c09585bd960
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.py	Tue Mar 02 17:17:09 2021 +0100
@@ -46,13 +46,16 @@
         SvnDialogMixin.__init__(self)
         
         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 display"))
         self.refreshButton.setEnabled(False)
-        self.buttonBox.button(QDialogButtonBox.Save).setEnabled(False)
-        self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
-        self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Save).setEnabled(False)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setEnabled(False)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Cancel).setDefault(True)
         
         self.searchWidget.attachTextEdit(self.contents)
         
@@ -82,7 +85,8 @@
             return pysvn.Revision(pysvn.opt_revision_kind.number, version)
         elif version.startswith("{"):
             dateStr = version[1:-1]
-            secs = QDateTime.fromString(dateStr, Qt.ISODate).toTime_t()
+            secs = QDateTime.fromString(
+                dateStr, Qt.DateFormat.ISODate).toTime_t()
             return pysvn.Revision(pysvn.opt_revision_kind.date, secs)
         elif version == "HEAD":
             return pysvn.Revision(pysvn.opt_revision_kind.head)
@@ -131,10 +135,14 @@
         """
         self.refreshButton.setVisible(refreshable)
         
-        self.buttonBox.button(QDialogButtonBox.Save).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.Save).setEnabled(False)
+        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._reset()
         self.errorGroup.hide()
@@ -270,7 +278,8 @@
         if self.paras == 0:
             self.contents.setPlainText(self.tr('There is no difference.'))
         
-        self.buttonBox.button(QDialogButtonBox.Save).setEnabled(self.paras > 0)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Save).setEnabled(self.paras > 0)
         
     def __appendText(self, line):
         """
@@ -279,7 +288,7 @@
         @param line line of text to insert (string)
         """
         tc = self.contents.textCursor()
-        tc.movePosition(QTextCursor.End)
+        tc.movePosition(QTextCursor.MoveOperation.End)
         self.contents.setTextCursor(tc)
         self.contents.insertPlainText(line)
         self.paras += 1
@@ -314,13 +323,17 @@
         Private slot called when the user pressed the button.
         """
         self.refreshButton.setEnabled(True)
-        self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False)
-        self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True)
-        self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True)
-        self.buttonBox.button(QDialogButtonBox.Close).setDefault(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Cancel).setEnabled(False)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setEnabled(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setEnabled(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setDefault(True)
         
         tc = self.contents.textCursor()
-        tc.movePosition(QTextCursor.Start)
+        tc.movePosition(QTextCursor.MoveOperation.Start)
         self.contents.setTextCursor(tc)
         self.contents.ensureCursorVisible()
         
@@ -341,11 +354,17 @@
         
         @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.__finish()
-        elif button == self.buttonBox.button(QDialogButtonBox.Save):
+        elif button == self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Save
+        ):
             self.on_saveButton_clicked()
         elif button == self.refreshButton:
             self.on_refreshButton_clicked()
@@ -361,26 +380,28 @@
         
         if para == 0:
             tc = self.contents.textCursor()
-            tc.movePosition(QTextCursor.Start)
+            tc.movePosition(QTextCursor.MoveOperation.Start)
             self.contents.setTextCursor(tc)
             self.contents.ensureCursorVisible()
         elif para == -1:
             tc = self.contents.textCursor()
-            tc.movePosition(QTextCursor.End)
+            tc.movePosition(QTextCursor.MoveOperation.End)
             self.contents.setTextCursor(tc)
             self.contents.ensureCursorVisible()
         else:
             # step 1: move cursor to end
             tc = self.contents.textCursor()
-            tc.movePosition(QTextCursor.End)
+            tc.movePosition(QTextCursor.MoveOperation.End)
             self.contents.setTextCursor(tc)
             self.contents.ensureCursorVisible()
             
             # step 2: move cursor to desired line
             tc = self.contents.textCursor()
             delta = tc.blockNumber() - para
-            tc.movePosition(QTextCursor.PreviousBlock, QTextCursor.MoveAnchor,
-                            delta)
+            tc.movePosition(
+                QTextCursor.MoveOperation.PreviousBlock,
+                QTextCursor.MoveMode.MoveAnchor,
+                delta)
             self.contents.setTextCursor(tc)
             self.contents.ensureCursorVisible()
     
@@ -448,9 +469,11 @@
         """
         Private slot to refresh the display.
         """
-        self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setEnabled(False)
         
-        self.buttonBox.button(QDialogButtonBox.Save).setEnabled(False)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Save).setEnabled(False)
         self.refreshButton.setEnabled(False)
         
         self.start(self.filename, refreshable=True)

eric ide

mercurial