Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@sugarlabs.org>2009-02-25 15:09:06 (GMT)
committer Tomeu Vizoso <tomeu@sugarlabs.org>2009-02-25 15:09:06 (GMT)
commit29cc73ae18d467a9fb2534db430f12a6cf0ad05b (patch)
tree6f668663c1dc21390cc0a2cb1dc5daae0d4f5fea /src
parent607c2a9610c6bbf87b8d9c680d5737af755c3040 (diff)
Let activities provide their own implementation of get_preview() #152
Diffstat (limited to 'src')
-rw-r--r--src/sugar/activity/activity.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py
index 66dcbd1..deca79d 100644
--- a/src/sugar/activity/activity.py
+++ b/src/sugar/activity/activity.py
@@ -713,8 +713,14 @@ class Activity(Window, gtk.Container):
self._jobject.destroy()
self._jobject = None
- def _get_preview(self):
+ def get_preview(self):
+ """Returns an image representing the state of the activity. Generally
+ this is what the user is seeing in this moment.
+ Activities can override this method, which should return a str with the
+ binary content of a png image with a width of 300 and a height of 225
+ pixels.
+ """
if self.canvas is None or not hasattr(self.canvas, 'get_snapshot'):
return None
pixmap = self.canvas.get_snapshot((-1, -1, 0, 0))
@@ -770,7 +776,7 @@ class Activity(Window, gtk.Container):
self.metadata['buddies_id'] = cjson.encode(buddies_dict.keys())
self.metadata['buddies'] = cjson.encode(self._get_buddies())
- preview = self._get_preview()
+ preview = self.get_preview()
if preview is not None:
self.metadata['preview'] = dbus.ByteArray(preview)