--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.py Sat Mar 06 10:00:52 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.py Sun Mar 28 15:00:11 2021 +0200 @@ -38,12 +38,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) @@ -123,14 +125,18 @@ self.errors.setPlainText("".join(errors)) self.errors.ensureCursorVisible() - self.buttonBox.button(QDialogButtonBox.Save).setEnabled(bool(diff)) - 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(diff)) + 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() @@ -151,7 +157,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() @@ -167,25 +175,26 @@ 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, + tc.movePosition(QTextCursor.MoveOperation.PreviousBlock, + QTextCursor.MoveMode.MoveAnchor, delta) self.contents.setTextCursor(tc) self.contents.ensureCursorVisible() @@ -254,9 +263,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)