--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgBookmarksListDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgBookmarksListDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -34,15 +34,17 @@ """ super(HgBookmarksListDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) 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 bookmarks display")) self.refreshButton.setEnabled(False) - 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.vcs = vcs self.__bookmarksList = None @@ -52,7 +54,8 @@ self.bookmarksList.headerItem().setText( self.bookmarksList.columnCount(), "") - self.bookmarksList.header().setSortIndicator(3, Qt.AscendingOrder) + self.bookmarksList.header().setSortIndicator( + 3, Qt.SortOrder.AscendingOrder) self.show() QCoreApplication.processEvents() @@ -107,11 +110,15 @@ """ self.refreshButton.setEnabled(True) - 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.Close).setFocus( - Qt.OtherFocusReason) + 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.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) if self.bookmarksList.topLevelItemCount() == 0: # no bookmarks defined @@ -127,11 +134,11 @@ # restore current item if self.__currentRevision: items = self.bookmarksList.findItems( - self.__currentRevision, Qt.MatchExactly, 0) + self.__currentRevision, Qt.MatchFlag.MatchExactly, 0) if items: self.bookmarksList.setCurrentItem(items[0]) self.__currentRevision = "" - self.bookmarksList.setFocus(Qt.OtherFocusReason) + self.bookmarksList.setFocus(Qt.FocusReason.OtherFocusReason) def on_buttonBox_clicked(self, button): """ @@ -139,9 +146,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 + ): if self.__hgClient: self.__hgClient.cancel() else: @@ -162,7 +173,7 @@ Private method to resize the list columns. """ self.bookmarksList.header().resizeSections( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents) self.bookmarksList.header().setStretchLastSection(True) def __generateItem(self, revision, changeset, status, name): @@ -177,16 +188,16 @@ itm = QTreeWidgetItem(self.bookmarksList) if revision[0].isdecimal(): # valid bookmark entry - itm.setData(0, Qt.DisplayRole, int(revision)) - itm.setData(1, Qt.DisplayRole, changeset) - itm.setData(2, Qt.DisplayRole, status) - itm.setData(3, Qt.DisplayRole, name) - itm.setTextAlignment(0, Qt.AlignRight) - itm.setTextAlignment(1, Qt.AlignRight) - itm.setTextAlignment(2, Qt.AlignHCenter) + itm.setData(0, Qt.ItemDataRole.DisplayRole, int(revision)) + itm.setData(1, Qt.ItemDataRole.DisplayRole, changeset) + itm.setData(2, Qt.ItemDataRole.DisplayRole, status) + itm.setData(3, Qt.ItemDataRole.DisplayRole, name) + itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight) + itm.setTextAlignment(1, Qt.AlignmentFlag.AlignRight) + itm.setTextAlignment(2, Qt.AlignmentFlag.AlignHCenter) else: # error message - itm.setData(0, Qt.DisplayRole, revision) + itm.setData(0, Qt.ItemDataRole.DisplayRole, revision) def __processOutputLine(self, line): """ @@ -325,7 +336,7 @@ self.tr("Rename Bookmark"), self.tr("<p>Enter the new name for bookmark <b>{0}</b>:</p>") .format(bookmark), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if ok and bool(newName): self.vcs.hgBookmarkRename((bookmark, newName)) self.on_refreshButton_clicked()