--- a/src/eric7/Preferences/ConfigurationPages/IconsPreviewDialog.py Wed Jul 13 11:16:20 2022 +0200 +++ b/src/eric7/Preferences/ConfigurationPages/IconsPreviewDialog.py Wed Jul 13 14:55:47 2022 +0200 @@ -20,10 +20,11 @@ """ Class implementing a dialog to preview the contents of an icon directory. """ + def __init__(self, directories, parent=None): """ Constructor - + @param directories list of directories to be shown @type list of str @param parent parent widget @@ -31,19 +32,19 @@ """ super().__init__(parent) self.setupUi(self) - + palette = self.iconView.palette() self.__backgroundColor = palette.color(QPalette.ColorRole.Window) self.__foregroundColor = palette.color(QPalette.ColorRole.WindowText) self.__inverted = False - + self.directoryCombo.addItems(sorted(directories)) - + @pyqtSlot(str) def on_directoryCombo_currentTextChanged(self, dirName): """ Private slot to show the icons of the selected icon directory. - + @param dirName selected icon directory @type str """ @@ -51,34 +52,34 @@ directory = QDir(dirName) for icon in directory.entryList(["*.svg", "*.svgz", "*.png"]): itm = QListWidgetItem( - QIcon(os.path.join(dirName, icon)), - icon, self.iconView) + QIcon(os.path.join(dirName, icon)), icon, self.iconView + ) if self.__inverted: itm.setForeground(self.__backgroundColor) else: itm.setForeground(self.__foregroundColor) - + @pyqtSlot(bool) def on_invertButton_toggled(self, checked): """ Private slot to show the icons on an inverted background. - + @param checked state of the button @type bool """ self.__inverted = checked - + styleSheet = ( f"color: {self.__backgroundColor.name()};" f"background-color: {self.__foregroundColor.name()}" - if self.__inverted else - f"color: {self.__foregroundColor.name()};" + if self.__inverted + else f"color: {self.__foregroundColor.name()};" f"background-color: {self.__backgroundColor.name()}" ) self.iconView.viewport().setStyleSheet(styleSheet) - + self.on_refreshButton_clicked() - + @pyqtSlot() def on_refreshButton_clicked(self): """