diff options
author | Ted Gould <ted@gould.cx> | 2011-02-24 12:30:42 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-02-24 12:30:42 -0600 |
commit | 1153cfedbbc67c667e117d18d5bf15a3a5a31a2a (patch) | |
tree | 7ce4d4d883112f9e8725fbcfebe7250832c3d581 /tests/test-glib-simple-items.py | |
parent | 5c94d5556de25dea4033364d72b526f2bf678728 (diff) | |
parent | 5d4e1c63e3e0fc2bcce9e1217e6565b8d16a83b4 (diff) | |
download | libdbusmenu-1153cfedbbc67c667e117d18d5bf15a3a5a31a2a.tar.gz libdbusmenu-1153cfedbbc67c667e117d18d5bf15a3a5a31a2a.tar.bz2 libdbusmenu-1153cfedbbc67c667e117d18d5bf15a3a5a31a2a.zip |
Merging with Ubuntu Desktop
Diffstat (limited to 'tests/test-glib-simple-items.py')
-rwxr-xr-x | tests/test-glib-simple-items.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/test-glib-simple-items.py b/tests/test-glib-simple-items.py new file mode 100755 index 0000000..d7ad7d7 --- /dev/null +++ b/tests/test-glib-simple-items.py @@ -0,0 +1,35 @@ +#!/usr/bin/python +# This is the Python GI version of test-glib-simple-items.c + +import gobject +from gi.repository import Dbusmenu + +dummies = ['Bob', 'Jim', 'Alvin', 'Mary'] + +def dummy_users(root): + count = 0 + for user in dummies: + mi = Dbusmenu.Menuitem() + print 'Creating item: %d %s' % (mi.get_id(), user) + print '\tRoot ID:', root.get_id() + mi.property_set('label', user) + root.child_add_position(mi, count) + assert mi.property_get('label') == user + count += 1 + +def quititall(mainloop): + mainloop.quit() + return False + +# main + +server = Dbusmenu.Server.new('/test/object') +root_menuitem = Dbusmenu.Menuitem() +server.set_root(root_menuitem) +print 'Root ID:', root_menuitem.get_id() + +dummy_users(root_menuitem) + +mainloop = gobject.MainLoop() +gobject.timeout_add_seconds(1, quititall, mainloop) +mainloop.run() |