From a7e0e5ae57f63035e50f48fe6f977cfa6c8d4572 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= Date: Mon, 4 Feb 2013 11:47:04 -0300 Subject: [PATCH] Make the size of the preview image a public constant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of hardcoding it. Signed-off-by: Manuel QuiƱones --- src/sugar3/activity/activity.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/sugar3/activity/activity.py b/src/sugar3/activity/activity.py index 3325f476..6a20c03a 100644 --- a/src/sugar3/activity/activity.py +++ b/src/sugar3/activity/activity.py @@ -96,6 +96,8 @@ J_DBUS_INTERFACE = 'org.laptop.Journal' CONN_INTERFACE_ACTIVITY_PROPERTIES = 'org.laptop.Telepathy.ActivityProperties' +PREVIEW_SIZE = style.zoom(300), style.zoom(225) + class _ActivitySession(GObject.GObject): @@ -639,8 +641,7 @@ class Activity(Window, Gtk.Container): 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. + binary content of a png image with a width of PREVIEW_SIZE pixels. The method does create a cairo surface similar to that of the canvas' window and draws on that. Then we create a cairo image surface with @@ -666,7 +667,7 @@ class Activity(Window, Gtk.Container): self.canvas.draw(cr) del cr - preview_width, preview_height = style.zoom(300), style.zoom(225) + preview_width, preview_height = PREVIEW_SIZE preview_surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, preview_width, preview_height) cr = cairo.Context(preview_surface)