def on_draw_cb(self, widget, cr): # This is where the drawing takes place if self.bgpixbuf: pixbuf = self.bgpixbuf if pixbuf.get_width != self.width: pixbuf = theme.scale(pixbuf, self.width) logger.debug('cairo') logger.debug(pixbuf) logger.debug(cr) #widget.window.draw_pixbuf(self.gc, pixbuf, 0, 0, 0, 0, -1, -1, 0, 0) Gdk.cairo_set_source_pixbuf(cr, pixbuf, 0, 0) cr.rectangle(0, 0, -1, -1) cr.paint() if self.fgpixbuf: pixbuf = self.fgpixbuf if pixbuf.get_width != self.width: pixbuf = theme.scale(pixbuf, self.width) logger.debug('cairo1') logger.debug(pixbuf) logger.debug(cr) #widget.window.draw_pixbuf(self.gc, pixbuf, 0, 0, 0, 0, -1, -1, 0, 0) Gdk.cairo_set_source_pixbuf(cr, pixbuf, 0, 0) cr.rectangle(0, 0, -1, -1) cr.paint()
def on_expose_event(self, widget, event): # This is where the drawing takes place if self.bgpixbuf: pixbuf = self.bgpixbuf if pixbuf.get_width != self.width: pixbuf = theme.scale(pixbuf, self.width) widget.window.draw_pixbuf(self.gc, pixbuf, 0, 0, 0, 0, -1, -1, 0, 0) if self.fgpixbuf: pixbuf = self.fgpixbuf if pixbuf.get_width != self.width: pixbuf = theme.scale(pixbuf, self.width) widget.window.draw_pixbuf(self.gc, pixbuf, 0, 0, 0, 0, -1, -1, 0, 0)
def select(self): if self._orig: return True; self.name, self.id, self._orig = chooser.pick( lambda jobject: (jobject.metadata['title'], jobject.object_id, theme.pixbuf(jobject.file_path)), (None, None, None), what=chooser.IMAGE) if self.name: self._thumb = theme.scale(self._orig) return True else: return False
def thumb(self): if not self._thumb: self._thumb = theme.scale(self._orig) return self._thumb
def thumb(self): if self._thumb == None: self._thumb = theme.scale(self.orig()) return self._thumb