def gotScreenshot(self, handle, reply):
for i in self.cstore:
if handle == i[C_SESSION_HANDLE]:
# We want to ask for thumbnails every 5 sec after the last one.
# So if the client is too stressed and needs 7 secs to
# send a thumbnail, we'll ask for one every 12 secs.
gobject.timeout_add(5000, self.askScreenshot, handle)
# print "I got a screenshot from %s." % handle
if not reply:
return
try:
rowstride, size, pixels = reply.split('\n', 2)
except:
return
rowstride = int(rowstride)
width, height = size.split('x')
pxb = gtk.gdk.pixbuf_new_from_data(pixels,
gtk.gdk.COLORSPACE_RGB, False, 8, int(width), int(height),
rowstride)
self.currentScreenshots[handle] = pxb
self.cstore[i.path][C_PIXBUF] = pxb
return
# That handle is no longer in the cstore, remove it
try: del self.currentScreenshots[handle]
except: pass
评论列表
文章目录