Startup: added some forgotten code to apply the user selected default icon set.

Sun, 12 Apr 2020 14:58:36 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 12 Apr 2020 14:58:36 +0200
changeset 7527
b2ae47eaf0ae
parent 7526
92ef4bd9d2c5
child 7528
0345f54d3959

Startup: added some forgotten code to apply the user selected default icon set.

eric6/Toolbox/Startup.py file | annotate | diff | comparison | revisions
--- a/eric6/Toolbox/Startup.py	Sun Apr 12 14:45:14 2020 +0200
+++ b/eric6/Toolbox/Startup.py	Sun Apr 12 14:58:36 2020 +0200
@@ -19,6 +19,7 @@
 import Globals
 
 import UI.PixmapCache
+import Preferences
 
 from eric6config import getConfig
 
@@ -123,22 +124,7 @@
     """
     import Preferences
     
-    # TODO: make default icon set configurable
-    #   - automatic (w.r.t. lightness)
-    #   - breeze-light
-    #   - breeze-dark
-    #   - oxygen (formerly default)
-    if application.usesDarkPalette():
-        # dark desktop
-        iconPath = "breeze-dark"
-    else:
-        # light desktop
-        iconPath = "breeze-light"
-    defaultIconPaths = [
-        # add paths for vector graphics
-        os.path.join(getConfig('ericIconDir'), iconPath),
-        os.path.join(getConfig('ericIconDir'), iconPath, "languages"),
-    ]
+    defaultIconPaths = getDefaultIconPaths(application)
     iconPaths = Preferences.getIcons("Path")
     for iconPath in iconPaths:
         if iconPath:
@@ -148,6 +134,30 @@
             UI.PixmapCache.addSearchPath(defaultIconPath)
 
 
+def getDefaultIconPaths(application):
+    """
+    Module function to determine the default icon paths.
+    
+    @param application reference to the application object
+    @type E5Application
+    @return list of default icon paths
+    @rtype list of str
+    """
+    defaultIconsPath = Preferences.getIcons("DefaultIconsPath")
+    if defaultIconsPath == "automatic":
+        if application.usesDarkPalette():
+            # dark desktop
+            defaultIconsPath = "breeze-dark"
+        else:
+            # light desktop
+            defaultIconsPath = "breeze-light"
+    
+    return [
+        os.path.join(getConfig('ericIconDir'), defaultIconsPath),
+        os.path.join(getConfig('ericIconDir'), defaultIconsPath, "languages"),
+    ]
+
+
 def setLibraryPaths():
     """
     Module function to set the Qt library paths correctly for windows systems.

eric ide

mercurial