diff options
author | Aleksey Lim <alsroot@member.fsf.org> | 2009-02-07 09:05:07 (GMT) |
---|---|---|
committer | Aleksey Lim <alsroot@member.fsf.org> | 2009-02-07 09:05:07 (GMT) |
commit | 7671f904c967dfe561ebb8f3ce08389963784ea9 (patch) | |
tree | 247bba7834a17fccf00450fa1ee32634652f1d9a /theme.py | |
parent | 4b06f75c99d96fdc84706e798f54001bb1cd99a9 (diff) |
Mix in Char/Ground with more OOP
Diffstat (limited to 'theme.py')
-rw-r--r-- | theme.py | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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) |