[Sugar-devel] help about the get_preview function of activity.Activity class to take screenshots
sumit.coder at gmail.com
Tue Jul 21 09:51:45 EDT 2009
Thanx a lot for the function. I would be using it as of now while creating
the infrastructure for the activity, would try to provide support to both
the new as well as the previous builds. I would be testing the function on
my 0.82 build soon.
Moreover, I am also planning to move to 0.84 Soas build , but as I am not
having access to a wifi-system and it needs atleast a day to get the
developer key, so it would take some time to setup the environment on my xo,
till then would be using this function. Moving on to the sugar 0.84 would
keep us in a better sync with the latest release of write-63 and further
development of the activity.
> You are asking good questions ;)
> In Sugar < 0.84, the only way to get a screenshot of activities was
> asking the X server for the current contents of the screen. This was
> pretty slow and also required that the activity was covering the whole
> screen during that operation (so the user couldn't invoke the frame,
> nor switch activities, etc.).
> In Sugar 0.84, we upgraded to a newer version of gtk+ that adds API
> for redrawing a window in a pixbuf. This is faster and can be done at
> any moment. But the abiword shipped with 0.84 did things a bit
> differently so that gtk+ API didn't worked properly, then Martin
> Sevior kindly implemented an additional function that did the job in
> the meantime.
> This is the slow method for retrieving previews as was implemented in
> the s.g.w.Window class:
> def get_canvas_screenshot(self):
> if not self.canvas:
> return None
> window = self.canvas.window
> width, height = window.get_size()
> screenshot = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,
> has_alpha=False, bits_per_sample=8, width=width, height=height)
> screenshot.get_from_drawable(window, window.get_colormap(), 0, 0,
> 0, 0, width, height)
> return screenshot
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Devel