From a7dbc53a6657ad1e115f096e3072dc927847d853 Mon Sep 17 00:00:00 2001 From: Aleksey Lim Date: Tue, 03 Feb 2009 00:01:01 +0000 Subject: Mix in Char with OOP --- (limited to 'ground.py') diff --git a/ground.py b/ground.py index 99611d2..ab5d07c 100644 --- a/ground.py +++ b/ground.py @@ -14,12 +14,12 @@ import os import gtk -import cStringIO from gettext import gettext as _ from sugar.graphics.objectchooser import ObjectChooser import theme +from utils import pixbuf, pixbuf2str def load(): from document import Document @@ -36,7 +36,7 @@ class Ground: if type == theme.RESTORED: tmpfile = os.path.join(theme.SESSION_PATH, '.tmp.png') file(tmpfile, 'w').write(image) - self._orig = gtk.gdk.pixbuf_new_from_file(tmpfile) + self._orig = theme.pixbuf(tmpfile) os.unlink(tmpfile) self._filename = 'ground.png' else: @@ -47,12 +47,7 @@ class Ground: return self._type != theme.PREINSTALLED def read(self): - def push(data, buffer): - buffer.write(data) - - buffer = cStringIO.StringIO() - self._orig.save_to_callback(push, 'png', user_data=buffer) - return buffer.getvalue() + pixbuf2str(self._orig) def filename(self): return self._filename @@ -65,7 +60,7 @@ class Ground: def orig(self): return self._orig - def change(self): + def select(self): if self._type != theme.CUSTOM: return self return theme.choose( -- cgit v0.9.1