eric6/Plugins/VcsPlugins/vcsGit/GitDiffDialog.py

changeset 8143
2c730d5fd177
parent 7960
e8fc383322f7
child 8218
7c09585bd960
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitDiffDialog.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/Plugins/VcsPlugins/vcsGit/GitDiffDialog.py	Tue Mar 02 17:17:09 2021 +0100
@@ -40,24 +40,26 @@
         self.setupUi(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).setDefault(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Save).setEnabled(False)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setDefault(True)
         
         try:
             # insert the search widget if it is available
             from E5Gui.E5TextEditSearchWidget import E5TextEditSearchWidget
             self.searchWidget = E5TextEditSearchWidget(self.contentsGroup)
-            self.searchWidget.setFocusPolicy(Qt.WheelFocus)
+            self.searchWidget.setFocusPolicy(Qt.FocusPolicy.WheelFocus)
             self.searchWidget.setObjectName("searchWidget")
             self.contentsGroup.layout().insertWidget(1, self.searchWidget)
             self.searchWidget.attachTextEdit(self.contents)
             
             self.searchWidget2 = E5TextEditSearchWidget(self.contentsGroup)
-            self.searchWidget2.setFocusPolicy(Qt.WheelFocus)
+            self.searchWidget2.setFocusPolicy(Qt.FocusPolicy.WheelFocus)
             self.searchWidget2.setObjectName("searchWidget2")
             self.contentsGroup.layout().addWidget(self.searchWidget2)
             self.searchWidget2.attachTextEdit(self.contents2)
@@ -203,15 +205,19 @@
             self.errors.setPlainText(errors)
             self.errors.ensureCursorVisible()
         
-        self.buttonBox.button(QDialogButtonBox.Save).setEnabled(bool(diff2))
-        self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True)
-        self.buttonBox.button(QDialogButtonBox.Close).setDefault(True)
-        self.buttonBox.button(QDialogButtonBox.Close).setFocus(
-            Qt.OtherFocusReason)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Save).setEnabled(bool(diff2))
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setEnabled(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setDefault(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setFocus(
+                Qt.FocusReason.OtherFocusReason)
         
         for contents in [self.contents, self.contents2]:
             tc = contents.textCursor()
-            tc.movePosition(QTextCursor.Start)
+            tc.movePosition(QTextCursor.MoveOperation.Start)
             contents.setTextCursor(tc)
             contents.ensureCursorVisible()
         
@@ -249,7 +255,9 @@
         
         @param button button that was clicked (QAbstractButton)
         """
-        if button == self.buttonBox.button(QDialogButtonBox.Save):
+        if button == self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Save
+        ):
             self.on_saveButton_clicked()
         elif button == self.refreshButton:
             self.on_refreshButton_clicked()
@@ -267,26 +275,26 @@
                                (para2, self.contents2)]:
             if para == 0:
                 tc = contents.textCursor()
-                tc.movePosition(QTextCursor.Start)
+                tc.movePosition(QTextCursor.MoveOperation.Start)
                 contents.setTextCursor(tc)
                 contents.ensureCursorVisible()
             elif para == -1:
                 tc = contents.textCursor()
-                tc.movePosition(QTextCursor.End)
+                tc.movePosition(QTextCursor.MoveOperation.End)
                 contents.setTextCursor(tc)
                 contents.ensureCursorVisible()
             else:
                 # step 1: move cursor to end
                 tc = contents.textCursor()
-                tc.movePosition(QTextCursor.End)
+                tc.movePosition(QTextCursor.MoveOperation.End)
                 contents.setTextCursor(tc)
                 contents.ensureCursorVisible()
                 
                 # step 2: move cursor to desired line
                 tc = contents.textCursor()
                 delta = tc.blockNumber() - para
-                tc.movePosition(QTextCursor.PreviousBlock,
-                                QTextCursor.MoveAnchor,
+                tc.movePosition(QTextCursor.MoveOperation.PreviousBlock,
+                                QTextCursor.MoveMode.MoveAnchor,
                                 delta)
                 contents.setTextCursor(tc)
                 contents.ensureCursorVisible()
@@ -356,9 +364,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, diffMode=self.__diffMode, refreshable=True)

eric ide

mercurial