home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / pycentral / deskbar-applet / site-packages / deskbar / DeskbarAppletPreferences.py < prev    next >
Encoding:
Python Source  |  2006-08-29  |  1.2 KB  |  36 lines

  1. """
  2. Stores the Preferences per-applet or shared across applets
  3. """
  4. import gconf
  5. import deskbar
  6.  
  7. class DeskbarAppletPreferences:
  8.     def __init__(self, applet):
  9.         # Default values
  10.         self.GCONF_APPLET_DIR = deskbar.GCONF_DIR
  11.         self.GCONF_WIDTH = deskbar.GCONF_WIDTH
  12.         self.GCONF_EXPAND = deskbar.GCONF_EXPAND
  13.         self.GCONF_UI_NAME = deskbar.GCONF_UI_NAME
  14.         
  15.         # These preferences are shared across all applet instances
  16.         # unlike width, which is per-instance.
  17.         self.GCONF_KEYBINDING = deskbar.GCONF_KEYBINDING
  18.         self.GCONF_MINCHARS = deskbar.GCONF_MINCHARS
  19.         self.GCONF_TYPINGDELAY = deskbar.GCONF_TYPINGDELAY
  20.         self.GCONF_USE_SELECTION = deskbar.GCONF_USE_SELECTION
  21.         self.GCONF_CLEAR_ENTRY = deskbar.GCONF_CLEAR_ENTRY
  22.         
  23.         # Retreive this applet's pref folder
  24.         path = applet.get_preferences_key()
  25.         if path != None:
  26.             self.GCONF_APPLET_DIR = path
  27.             self.GCONF_WIDTH =  self.GCONF_APPLET_DIR + "/width"
  28.             self.GCONF_EXPAND = self.GCONF_APPLET_DIR + "/expand"
  29.             self.GCONF_UI_NAME = self.GCONF_APPLET_DIR + "/ui_name"
  30.             
  31.             applet.add_preferences("/schemas" + deskbar.GCONF_DIR)
  32.             deskbar.GCONF_CLIENT.add_dir(self.GCONF_APPLET_DIR, gconf.CLIENT_PRELOAD_RECURSIVE)
  33.             
  34.             print 'Using per-applet gconf key:', self.GCONF_APPLET_DIR
  35.         
  36.