def bufjpeg2pixbuf(data, length): """Decompress to a Pixbuf. Decompress the jpeg held in the memory area indicated by(data, length), construct a gtk.gdk.Pixbuf, and return it. """ logging.debug('decompress: starting ...') image = Image() retval = decompress.decompress(data, length, ctypes.byref(image)) if retval != 0: logging.error('decompress failed') finalize_image(image) return logging.debug('decompress: done') logging.debug('decompress: read %d x %d pixel image', image.width, image.height) string = ctypes.string_at(image.pixels, image.width * image.height * 3) pixbuf = gtk.gdk.pixbuf_new_from_data(string, gtk.gdk.COLORSPACE_RGB, False, 8, image.width, image.height, image.width * 3) finalize.track(pixbuf, image, finalize_image) return pixbuf
def bufjpeg2pixbuf(data, length): """Decompress to a Pixbuf. Decompress the jpeg held in the memory area indicated by(data, length), construct a gtk.gdk.Pixbuf, and return it. """ logging.debug("decompress: starting ...") image = Image() retval = decompress.decompress(data, length, ctypes.byref(image)) if retval != 0: logging.error("decompress failed") finalize_image(image) return logging.debug("decompress: done") logging.debug("decompress: read %d x %d pixel image", image.width, image.height) string = ctypes.string_at(image.pixels, image.width * image.height * 3) pixbuf = gtk.gdk.pixbuf_new_from_data( string, gtk.gdk.COLORSPACE_RGB, False, 8, image.width, image.height, image.width * 3 ) finalize.track(pixbuf, image, finalize_image) return pixbuf
def __init__(self, camera): """Make a Config for a camera. See Camera.""" self.camera = camera self.root_widget = None finalize.track(self, self, self.free_config) self.refresh()