Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Theme.py
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-01-30 02:18:20 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-01-30 02:18:20 (GMT)
commit56cea3b5c6361c7958e1c27182fcf117470a1861 (patch)
tree409b64b30ded33f31984bda642a7732e4b239afe /Theme.py
parent89c8d62f20aa0b72b1acc432a135d709b2bd096d (diff)
Implement character frames panel
Diffstat (limited to 'Theme.py')
-rw-r--r--Theme.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/Theme.py b/Theme.py
index 110ee63..6aa5fc8 100644
--- a/Theme.py
+++ b/Theme.py
@@ -90,6 +90,29 @@ def pixbuf(file, size = None):
out = gtk.gdk.pixbuf_new_from_file(path(file))
return out
+EMPTY_PIXBUF = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, 1, 1)
+
+
+def choose_pixbuf(out_fun):
+ from sugar.graphics.objectchooser import ObjectChooser
+
+ chooser = ObjectChooser()
+ jobject = None
+
+ try:
+ result = chooser.run()
+
+ if result == gtk.RESPONSE_ACCEPT:
+ jobject = chooser.get_selected_object()
+ if jobject and jobject.file_path:
+ return out_fun(jobject.metadata['title'], jobject.file_path)
+ finally:
+ if jobject: jobject.destroy()
+ chooser.destroy()
+ del chooser
+
+ return None
+
# customize theme
gtkrc = os.path.join(get_bundle_path(), 'gtkrc')
gtk.rc_add_default_file(gtkrc)