--- a/eric7/EricWidgets/EricApplication.py Tue Dec 28 15:02:01 2021 +0100 +++ b/eric7/EricWidgets/EricApplication.py Tue Dec 28 15:04:17 2021 +0100 @@ -180,6 +180,25 @@ return self.__pluginObjectRegistry[name][1] + def getStyleIconsPath(self): + """ + Public method to get the path for the style icons. + + @return directory path containing the style icons + @rtype str + """ + import Preferences + from eric7config import getConfig + + styleIconsPath = Preferences.getUI("StyleIconsPath") + if not styleIconsPath: + # default is the 'StyleIcons' sub-directory of the icons + # directory + styleIconsPath = os.path.join( + getConfig('ericIconDir'), "StyleIcons") + + return styleIconsPath + def setStyleSheetFile(self, filename): """ Public method to read a QSS style sheet file and set the application @@ -188,9 +207,6 @@ @param filename name of the QSS style sheet file @type str """ - import Preferences - from eric7config import getConfig - if filename: try: with open(filename, "r", encoding="utf-8") as f: @@ -212,12 +228,7 @@ if styleSheet: # preprocess the style sheet to replace the placeholder for the # path to the icons - styleIconsPath = Preferences.getUI("StyleIconsPath") - if not styleIconsPath: - # default ist the 'StyleIcons' subdirectory of the icons - # directory - styleIconsPath = os.path.join( - getConfig('ericIconDir'), "StyleIcons") + styleIconsPath = self.getStyleIconsPath() styleSheet = styleSheet.replace("${path}", styleIconsPath) if "QPalette {" in styleSheet: