home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / doc / python-gnome2 / examples / gconf / simple-controller.py < prev    next >
Encoding:
Python Source  |  2002-01-19  |  683 b   |  32 lines

  1. #!/usr/bin/env python
  2. #
  3. # A very simple program that sets a single key value when you type
  4. # it in an entry and press return
  5. #
  6.  
  7. import gtk
  8. import gconf
  9.    
  10. def entry_activated_callback(entry, client):
  11.     s = entry.get_chars (0, -1)
  12.     client.set_string ("/testing/directory/key", s)
  13.  
  14. window = gtk.Window()
  15. entry = gtk.Entry ()
  16. window.add (entry)
  17.  
  18. client = gconf.client_get_default ()
  19.  
  20. client.add_dir ("/testing/directory",
  21.                 gconf.CLIENT_PRELOAD_NONE)
  22. entry.connect ('activate', entry_activated_callback, client)
  23.  
  24. # If key isn't writable, then set insensitive
  25. entry.set_sensitive (client.key_is_writable ("/testing/directory/key"))
  26. window.show_all ()
  27.  
  28. gtk.main ()
  29.  
  30.  
  31.  
  32.