Commits

Anonymous committed 5141696

Added loading the list of items from a config file (~/.pyradrc).

Comments (0)

Files changed (2)

+[("kreversi", None), # the center item
+                 ("kate","kate"), ("kword","kword"), ("kmix","kmix"), ("wesnoth","wesnoth"), # normal items
+                 ("krita","[('kreversi', None), ('gimp','gimp')]") # a folder with the center icon and only one real item
+                 ]
+
 from math import sin, cos, pi
 # And for starting programs
 from subprocess import Popen
+# Finally some path tools for loading a config file
+from os.path import join, isfile
+# and system independent home folder location
+from user import home
 
 ### Constants ###
 
 CIRCLE_RADIUS = 80
 PROGRAM_ICON = "kreversi"
 CENTER_ICON = "kreversi"
+CONFIG_FILE_NAME = ".pyradrc"
 
-#: The items the menu should show in top-level (via folders this contains the whole of the wheel menu). 
-ITEMS = [(CENTER_ICON, None), # the center item
+# If there's no config, we use standard items
+if not isfile(join(home, CONFIG_FILE_NAME)): 
+    #: The items the menu should show in top-level (via folders this contains the whole of the wheel menu). 
+    ITEMS = [(CENTER_ICON, None), # the center item
                  ("kate","kate"), ("kmail","kmail"), ("kmix","kmix"), ("wesnoth","wesnoth"), # normal items
                  ("krita","[('" + CENTER_ICON + "', None), ('gimp','gimp')]") # a folder with the center icon and only one real item
                  ]
+else:
+    # if a config file is present, we load the items from there.
+    f = open(join(home, CONFIG_FILE_NAME))
+    config = f.read()
+    f.close()
+    ITEMS = eval(config)
+    del f
+    del config
 
 
 ### About the Program ###