File: simple-controller.py

package info (click to toggle)
gnome-python 2.28.1%2Bdfsg-1.1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,288 kB
  • ctags: 1,032
  • sloc: sh: 10,219; ansic: 7,997; xml: 2,464; python: 1,886; makefile: 394
file content (31 lines) | stat: -rwxr-xr-x 683 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python
#
# A very simple program that sets a single key value when you type
# it in an entry and press return
#

import gtk
import gconf
   
def entry_activated_callback(entry, client):
    s = entry.get_chars (0, -1)
    client.set_string ("/testing/directory/key", s)

window = gtk.Window()
entry = gtk.Entry ()
window.add (entry)

client = gconf.client_get_default ()

client.add_dir ("/testing/directory",
                gconf.CLIENT_PRELOAD_NONE)
entry.connect ('activate', entry_activated_callback, client)

# If key isn't writable, then set insensitive
entry.set_sensitive (client.key_is_writable ("/testing/directory/key"))
window.show_all ()

gtk.main ()