--- a/eric6/E5Gui/E5ListSelectionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5ListSelectionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -20,7 +20,8 @@ Class implementing a dialog to select from a list of strings. """ def __init__(self, entries, - selectionMode=QAbstractItemView.ExtendedSelection, + selectionMode=QAbstractItemView.SelectionMode + .ExtendedSelection, title="", message="", checkBoxSelection=False, parent=None): """ Constructor @@ -50,17 +51,20 @@ self.__checkCount = 0 self.__isCheckBoxSelection = checkBoxSelection if self.__isCheckBoxSelection: - self.selectionList.setSelectionMode(QAbstractItemView.NoSelection) + self.selectionList.setSelectionMode( + QAbstractItemView.SelectionMode.NoSelection) for entry in entries: itm = QListWidgetItem(entry) - itm.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled) - itm.setCheckState(Qt.Unchecked) + itm.setFlags(Qt.ItemFlag.ItemIsUserCheckable | + Qt.ItemFlag.ItemIsEnabled) + itm.setCheckState(Qt.CheckState.Unchecked) self.selectionList.addItem(itm) else: self.selectionList.setSelectionMode(selectionMode) self.selectionList.addItems(entries) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) @pyqtSlot() def on_selectionList_itemSelectionChanged(self): @@ -68,8 +72,9 @@ Private slot handling a change of the selection. """ if not self.__isCheckBoxSelection: - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( - len(self.selectionList.selectedItems()) > 0) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled( + len(self.selectionList.selectedItems()) > 0) def on_selectionList_itemChanged(self, itm): """ @@ -79,11 +84,12 @@ @type QListWidgetItem """ if self.__isCheckBoxSelection: - if itm.checkState() == Qt.Checked: + if itm.checkState() == Qt.CheckState.Checked: self.__checkCount += 1 else: self.__checkCount -= 1 - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled( self.__checkCount > 0) def getSelection(self): @@ -97,7 +103,7 @@ if self.__isCheckBoxSelection: for row in range(self.selectionList.count()): item = self.selectionList.item(row) - if item.checkState() == Qt.Checked: + if item.checkState() == Qt.CheckState.Checked: entries.append(item.text()) else: for item in self.selectionList.selectedItems():