diff options
author | Simon Schampijer <simon@schampijer.de> | 2009-06-03 21:49:56 (GMT) |
---|---|---|
committer | Simon Schampijer <simon@schampijer.de> | 2009-06-03 21:49:56 (GMT) |
commit | 5b1e1af6912dbc0da7cf85d96cc925151c1d6247 (patch) | |
tree | 08a9dc6786ae10a6b7ba6b104bf31e6d63b27e66 /createcardpanel.py | |
parent | 29351f9d6265c45081f73b63b02c20dfed221f24 (diff) |
Cope for images that are not even sized
Diffstat (limited to 'createcardpanel.py')
-rw-r--r-- | createcardpanel.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/createcardpanel.py b/createcardpanel.py index 851f7da..fd36999 100644 --- a/createcardpanel.py +++ b/createcardpanel.py @@ -306,10 +306,20 @@ class CardEditor(gtk.EventBox): def _load_image(self, index): pixbuf_t = gtk.gdk.pixbuf_new_from_file_at_size( index, theme.PAIR_SIZE - theme.PAD*2, theme.PAIR_SIZE - theme.PAD*2) - self.card.set_pixbuf(pixbuf_t) + if pixbuf_t.get_width() > pixbuf_t.get_height(): + size = pixbuf_t.get_width() + else: + size = pixbuf_t.get_height() + pixbuf_z = gtk.gdk.pixbuf_new_from_file_at_size( + 'images/white.png', size, size) + pixbuf_t.composite(pixbuf_z, 0, 0, pixbuf_t.get_width(), + pixbuf_t.get_height(), 0, 0, 1, 1, + gtk.gdk.INTERP_BILINEAR, 255) + self.card.set_pixbuf(pixbuf_z) _logger.error('Picture Loaded: '+index) self.emit('has-picture', True) del pixbuf_t + del pixbuf_z def _import_audio(self, widget, event): if hasattr(mime, 'GENERIC_TYPE_AUDIO'): |