diff options
author | Daniel Drake <dsd@laptop.org> | 2011-05-06 17:32:54 (GMT) |
---|---|---|
committer | Daniel Drake <dsd@laptop.org> | 2011-05-06 19:04:03 (GMT) |
commit | ecc8ede82ef594a7186e7e597ee9ded823616e59 (patch) | |
tree | 02d8fbb6881b6945e67a845778324faf991342fb /mediaview.py | |
parent | bb0772a2e8f1e4bccf80a44e8f4afc4f2045c576 (diff) |
Fix audio recording when no camera present (SL#2691)
Introduce the relevant code catches to allow audio recording
when no camera is present. Still has some rough edges but is
now usable at least.
Diffstat (limited to 'mediaview.py')
-rw-r--r-- | mediaview.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/mediaview.py b/mediaview.py index 670a0fa..01567ff 100644 --- a/mediaview.py +++ b/mediaview.py @@ -215,12 +215,14 @@ class ImageBox(gtk.EventBox): self._pixbuf = pixbuf def set_size(self, width, height): - if width == self._pixbuf.get_width() and height == self._pixbuf.get_height(): - pixbuf = self._pixbuf - else: - pixbuf = self._pixbuf.scale_simple(width, height, gdk.INTERP_BILINEAR) + if self._pixbuf: + if width == self._pixbuf.get_width() and height == self._pixbuf.get_height(): + pixbuf = self._pixbuf + else: + pixbuf = self._pixbuf.scale_simple(width, height, gdk.INTERP_BILINEAR) + + self._image.set_from_pixbuf(pixbuf) - self._image.set_from_pixbuf(pixbuf) self._image.set_size_request(width, height) self.set_size_request(width, height) @@ -492,8 +494,9 @@ class MediaView(gtk.EventBox): self._switch_mode(MediaView.MODE_STILL) def show_photo(self, path): - pixbuf = gdk.pixbuf_new_from_file(path) - self._image_box.set_pixbuf(pixbuf) + if path: + pixbuf = gdk.pixbuf_new_from_file(path) + self._image_box.set_pixbuf(pixbuf) self._switch_mode(MediaView.MODE_PHOTO) def show_video(self): |