diff options
author | Ignacio Rodriguez <ignacio@sugarlabs.org> | 2013-12-13 14:31:58 (GMT) |
---|---|---|
committer | Ignacio Rodriguez <ignacio@sugarlabs.org> | 2013-12-13 14:31:58 (GMT) |
commit | f91603503bbbc93a24a756c8756b6230c178af19 (patch) | |
tree | 7256b6006ffd52141cc8724d9eecec9c43a807bf | |
parent | 0e32582e9b798041652a9d58e46ca17d740d3f3d (diff) |
Preview pixbuf, try 1
-rw-r--r-- | activity.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/activity.py b/activity.py index 0d905ba..b973f82 100644 --- a/activity.py +++ b/activity.py @@ -45,6 +45,7 @@ from sugar3.graphics.toolbarbox import ToolbarBox from sugar3.graphics.toolbarbox import ToolbarButton from sugar3.graphics.style import GRID_CELL_SIZE from sugar3.datastore import datastore +from sugar3.graphics.objectchooser import get_preview_pixbuf import tools import physics @@ -94,14 +95,10 @@ class PhysicsActivity(activity.Activity): """ Custom preview code to get image from pygame. """ if self.preview: return self.preview + surface = pygame.display.get_surface() - width, height = surface.get_width(), surface.get_height() string_surface = pygame.image.tostring(surface, "RGB") - pixbuf = GdkPixbuf.Pixbuf.new_from_data(string_surface, - GdkPixbuf.Colorspace.RGB, 0, 8, - width, height, - 3 * width) - pixbuf = pixbuf.scale_simple(300, 225, GdkPixbuf.InterpType.BILINEAR) + pixbuf = get_preview_pixbuf(string_surface) preview_data = [] |