Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Ground.py
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-01-30 23:32:43 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-01-30 23:32:43 (GMT)
commitf3f438af59c69b584d84b27f103f9392fc8185f8 (patch)
tree808556779f0d70312625b6d50277371bbf19b880 /Ground.py
parent56cea3b5c6361c7958e1c27182fcf117470a1861 (diff)
...
Diffstat (limited to 'Ground.py')
-rw-r--r--Ground.py29
1 files changed, 10 insertions, 19 deletions
diff --git a/Ground.py b/Ground.py
index 6a62e30..512f2ad 100644
--- a/Ground.py
+++ b/Ground.py
@@ -19,17 +19,22 @@ from sugar.graphics.objectchooser import ObjectChooser
import Theme
+def load():
+ ground = Document.ground()
+ custom = Ground(ground[0], None, False)
+ custom._pixbuf = ground[1]
+ THEMES.insert(-1, custom)
+
class Ground:
def __init__(self, name, file, custom):
self.name = name
- self._pixbuf = Theme.pixbuf(file)
+ if file: self._pixbuf = Theme.pixbuf(file)
self._custom = custom
self._thumb = None
def thumb(self):
if not self._thumb:
- self._thumb = self._pixbuf.scale_simple(Theme.THUMB_SIZE,
- Theme.THUMB_SIZE, gtk.gdk.INTERP_BILINEAR)
+ self._thumb = Theme.scale(self._pixbuf)
return self._thumb
def orig(self):
@@ -38,22 +43,8 @@ class Ground:
def change(self):
if self._custom in (None, False):
return self
-
- chooser = ObjectChooser(_('Choose background image'), None,
- gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
- try:
- result = chooser.run()
-
- if result == gtk.RESPONSE_ACCEPT:
- jobject = chooser.get_selected_object()
- if jobject and jobject.file_path:
- return Ground(jobject.metadata['title'],
- jobject.file_path, False)
- finally:
- chooser.destroy()
- del chooser
-
- return None
+ else:
+ return Theme.choose(lambda title, file: Ground(title, file, False))
THEMES = (
Ground(_('Saturn'), 'images/backpics/bigbg01.gif', None),