From 7671f904c967dfe561ebb8f3ce08389963784ea9 Mon Sep 17 00:00:00 2001 From: Aleksey Lim Date: Sat, 07 Feb 2009 09:05:07 +0000 Subject: Mix in Char/Ground with more OOP --- (limited to 'theme.py') diff --git a/theme.py b/theme.py index fe440ff..a43e58b 100644 --- a/theme.py +++ b/theme.py @@ -132,6 +132,22 @@ def choose(out_fun): return None +def pixbuf2str(pixbuf): + def push(data, buffer): + buffer.write(data) + + import cStringIO + buffer = cStringIO.StringIO() + pixbuf.save_to_callback(push, 'png', user_data=buffer) + return buffer.getvalue() + +def str2pixbuf(data): + tmpfile = os.path.join(SESSION_PATH, '.tmp.png') + file(tmpfile, 'w').write(data) + out = theme.pixbuf(tmpfile) + os.unlink(tmpfile) + return out + # customize theme gtkrc = os.path.join(get_bundle_path(), 'gtkrc') gtk.rc_add_default_file(gtkrc) -- cgit v0.9.1