Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/samples/get_options.py
diff options
context:
space:
mode:
authorSayamindu Dasgupta <sayamindu@gmail.com>2009-07-03 12:07:03 (GMT)
committer Sayamindu Dasgupta <sayamindu@gmail.com>2009-07-03 12:07:03 (GMT)
commit4df895df23b3b34f618c9b5f9f61d3f95832ae26 (patch)
treec12f69f471584dc1b899c951dda90a475b0662fd /samples/get_options.py
parent8235cd38bf3d65f1f26db7236bb05568d56605ba (diff)
Add some sample code
Diffstat (limited to 'samples/get_options.py')
-rw-r--r--samples/get_options.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/samples/get_options.py b/samples/get_options.py
new file mode 100644
index 0000000..e072cf3
--- /dev/null
+++ b/samples/get_options.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+
+import xklavier
+import gtk
+
+def print_option(c_reg, item):
+ print ('\t %s (%s)' % (item.get_description(), item.get_name()))
+
+def print_option_group(c_reg, item):
+ print ('\n%s (%s)' % (item.get_description(), item.get_name()))
+ c_reg.foreach_option(item.get_name(), print_option)
+
+display = gtk.gdk.display_get_default()
+engine = xklavier.Engine(display)
+configreg = xklavier.ConfigRegistry(engine)
+
+configreg.load(False)
+configreg.foreach_option_group(print_option_group)