Esempio n. 1
0
 def paint(self):
     if self.bitmap is None:
         w = h = 0
     else:
         w, h = wal.get_bitmap_size(self.bitmap)
     self.set_virtual_size((max(SIZE - self.sb_width - 2,
                                w), max(SIZE - self.sb_width - 2, h)))
     self.prepare_dc(self.pdc)
     if self.bitmap is None:
         self.set_gc_stroke(wal.UI_COLORS['pressed_border'][:3])
         self.gc_draw_line(0, 0, SIZE, SIZE)
         self.gc_draw_line(SIZE, 0, 0, SIZE)
     else:
         x = (SIZE - w) / 2 if SIZE > w else 0
         y = (SIZE - h) / 2 if SIZE > h else 0
         self.draw_bitmap(self.bitmap, x, y)
         if self.show_border:
             self.set_stroke(wal.UI_COLORS['pressed_border'][:3], 1.0,
                             [2, 2])
             shift = 10
             items = [
                 (x - shift, y - 1, x + w + shift, y - 1),
                 (x - shift, y + h, x + w + shift, y + h),
                 (x - 1, y - shift, x - 1, y + h + shift),
                 (x + w, y - shift, x + w, y + h + shift),
             ]
             for item in items:
                 self.draw_line(*item)
Esempio n. 2
0
 def paint(self):
     if self.bitmap is None:
         w = h = 0
     else:
         w, h = wal.get_bitmap_size(self.bitmap)
     self.set_virtual_size((max(SIZE - self.sb_width - 2, w), max(SIZE - self.sb_width - 2, h)))
     self.prepare_dc(self.pdc)
     if self.bitmap is None:
         self.set_gc_stroke(wal.UI_COLORS["pressed_border"][:3])
         self.gc_draw_line(0, 0, SIZE, SIZE)
         self.gc_draw_line(SIZE, 0, 0, SIZE)
     else:
         x = y = 0
         if SIZE > w:
             x = (SIZE - w) / 2
         if SIZE > h:
             y = (SIZE - h) / 2
         self.draw_bitmap(self.bitmap, x, y)
         if self.show_border:
             self.set_stroke(wal.UI_COLORS["pressed_border"][:3], 1.0, [2, 2])
             shift = 10
             items = [
                 (x - shift, y - 1, x + w + shift, y - 1),
                 (x - shift, y + h, x + w + shift, y + h),
                 (x - 1, y - shift, x - 1, y + h + shift),
                 (x + w, y - shift, x + w, y + h + shift),
             ]
             for item in items:
                 self.draw_line(*item)
Esempio n. 3
0
 def set_picture(self, picture):
     if picture is not None:
         picture = wal.stream_to_bitmap(picture)
         w, h = wal.get_bitmap_size(picture)
         self.info.set_text(_('Size:') + ' %d x %d px' % (w, h))
     else:
         self.info.set_text('---')
     self.canvas.bitmap = picture
     self.canvas.refresh()
     self.layout()
Esempio n. 4
0
 def set_picture(self, picture):
     if not picture is None:
         picture = wal.stream_to_bitmap(picture)
         w, h = wal.get_bitmap_size(picture)
         self.info.set_text(_("Size:") + " %d x %d px" % (w, h))
     else:
         self.info.set_text("---")
     self.canvas.bitmap = picture
     self.canvas.refresh()
     self.layout()