178 raise KeyError( |
178 raise KeyError( |
179 'Pluginobject "{0}" is not registered.'.format(name)) |
179 'Pluginobject "{0}" is not registered.'.format(name)) |
180 |
180 |
181 return self.__pluginObjectRegistry[name][1] |
181 return self.__pluginObjectRegistry[name][1] |
182 |
182 |
183 def getStyleIconsPath(self): |
183 def getStyleIconsPath(self, universal=False): |
184 """ |
184 """ |
185 Public method to get the path for the style icons. |
185 Public method to get the path for the style icons. |
186 |
186 |
|
187 @param universal flag indicating a universal file path (defaults to |
|
188 False) |
|
189 @type bool (optional) |
187 @return directory path containing the style icons |
190 @return directory path containing the style icons |
188 @rtype str |
191 @rtype str |
189 """ |
192 """ |
190 import Preferences |
193 import Preferences |
|
194 import Utilities |
191 from eric7config import getConfig |
195 from eric7config import getConfig |
192 |
196 |
193 styleIconsPath = Preferences.getUI("StyleIconsPath") |
197 styleIconsPath = Preferences.getUI("StyleIconsPath") |
194 if not styleIconsPath: |
198 if not styleIconsPath: |
195 # default is the 'StyleIcons' sub-directory of the icons |
199 # default is the 'StyleIcons' sub-directory of the icons |
196 # directory |
200 # directory |
197 styleIconsPath = os.path.join( |
201 styleIconsPath = os.path.join( |
198 getConfig('ericIconDir'), "StyleIcons") |
202 getConfig('ericIconDir'), "StyleIcons") |
199 |
203 |
200 return styleIconsPath |
204 if universal: |
|
205 return Utilities.fromNativeSeparators(styleIconsPath) |
|
206 else: |
|
207 return styleIconsPath |
201 |
208 |
202 def setStyleSheetFile(self, filename): |
209 def setStyleSheetFile(self, filename): |
203 """ |
210 """ |
204 Public method to read a QSS style sheet file and set the application |
211 Public method to read a QSS style sheet file and set the application |
205 style sheet based on its contents. |
212 style sheet based on its contents. |
224 return |
231 return |
225 else: |
232 else: |
226 styleSheet = "" |
233 styleSheet = "" |
227 |
234 |
228 if styleSheet: |
235 if styleSheet: |
229 # preprocess the style sheet to replace the placeholder for the |
236 # pre-process the style sheet to replace the placeholder for the |
230 # path to the icons |
237 # path to the icons |
231 styleIconsPath = self.getStyleIconsPath() |
238 styleIconsPath = self.getStyleIconsPath(universal=True) |
232 styleSheet = styleSheet.replace("${path}", styleIconsPath) |
239 styleSheet = styleSheet.replace("${path}", styleIconsPath) |
233 |
240 |
234 if "QPalette {" in styleSheet: |
241 if "QPalette {" in styleSheet: |
235 self.__setPaletteFromStyleSheet(styleSheet) |
242 self.__setPaletteFromStyleSheet(styleSheet) |
236 |
243 |