eric6/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8176
31965986ecd1
child 8218
7c09585bd960
diff -r 27f636beebad -r 2c730d5fd177 eric6/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.py
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.py	Tue Mar 02 17:17:09 2021 +0100
@@ -41,12 +41,14 @@
         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)
         
         self.searchWidget.attachTextEdit(self.contents)
         
@@ -70,7 +72,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,7 @@
         self.vcs.addArguments(args, self.vcs.options['global'])
         self.vcs.addArguments(args, self.vcs.options['diff'])
         if '--diff-cmd' in self.vcs.options['diff']:
-            self.buttonBox.button(QDialogButtonBox.Save).hide()
+            self.buttonBox.button(QDialogButtonBox.StandardButton.Save).hide()
         
         if versions is not None:
             self.raise_()
@@ -206,14 +208,18 @@
         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.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(self.paras > 0)
+        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)
         
         tc = self.contents.textCursor()
-        tc.movePosition(QTextCursor.Start)
+        tc.movePosition(QTextCursor.MoveOperation.Start)
         self.contents.setTextCursor(tc)
         self.contents.ensureCursorVisible()
         
@@ -233,7 +239,7 @@
         @param txt text to insert (string)
         """
         tc = self.contents.textCursor()
-        tc.movePosition(QTextCursor.End)
+        tc.movePosition(QTextCursor.MoveOperation.End)
         self.contents.setTextCursor(tc)
         self.contents.insertPlainText(txt)
         
@@ -269,7 +275,7 @@
         It reads the output of the process, formats it and inserts it into
         the contents pane.
         """
-        self.process.setReadChannel(QProcess.StandardOutput)
+        self.process.setReadChannel(QProcess.ProcessChannel.StandardOutput)
         
         while self.process.canReadLine():
             line = str(self.process.readLine(),
@@ -305,7 +311,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()
@@ -321,26 +329,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()
     
@@ -408,9 +418,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)
@@ -422,9 +434,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