--- a/src/eric7/Plugins/WizardPlugins/DotDesktopWizard/DotDesktopListSelectionDialog.py Wed Jul 13 11:16:20 2022 +0200 +++ b/src/eric7/Plugins/WizardPlugins/DotDesktopWizard/DotDesktopListSelectionDialog.py Wed Jul 13 14:55:47 2022 +0200 @@ -16,11 +16,20 @@ """ Class implementing a dialog to select multiple entries from a list. """ - def __init__(self, entries, selectedEntries, separator, subEntries=None, - allowMultiMain=True, allowMultiSub=True, parent=None): + + def __init__( + self, + entries, + selectedEntries, + separator, + subEntries=None, + allowMultiMain=True, + allowMultiSub=True, + parent=None, + ): """ Constructor - + @param entries list of entries to be shown (list of string) @param selectedEntries list of entries to be selected (list of string or string of entries separated by separator) @@ -34,22 +43,24 @@ """ super().__init__(parent) self.setupUi(self) - + if isinstance(selectedEntries, str): selectedEntries = selectedEntries.split(separator) - + if not allowMultiMain: self.entriesList.setSelectionMode( - QAbstractItemView.SelectionMode.SingleSelection) + QAbstractItemView.SelectionMode.SingleSelection + ) if not allowMultiSub: self.subList.setSelectionMode( - QAbstractItemView.SelectionMode.SingleSelection) - + QAbstractItemView.SelectionMode.SingleSelection + ) + for entry in entries: itm = QListWidgetItem(entry, self.entriesList) if entry in selectedEntries: itm.setSelected(True) - + if subEntries: for entry in subEntries: itm = QListWidgetItem(entry, self.subList) @@ -57,12 +68,12 @@ itm.setSelected(True) else: self.subList.setVisible(False) - + def getData(self, separator=None, separatorAtEnd=False): """ Public method to extract the selected entries as a list or a string. - + @param separator separator string (string) @param separatorAtEnd flag indicating to append the separator (boolean) @return list of selected entries (list of string) if the separator is @@ -73,7 +84,7 @@ entries.append(itm.text()) for itm in self.subList.selectedItems(): entries.append(itm.text()) - + if separator is None: return entries else: