diff options
author | Manuel QuiƱones <manuq@laptop.org> | 2013-05-15 03:48:53 (GMT) |
---|---|---|
committer | Agustin Zubiaga <aguz@localhost.localdomain> | 2013-06-03 19:07:00 (GMT) |
commit | e080cd8d3a45ceafe23067307373127b0a24081c (patch) | |
tree | 5356fa32c3fd51c83a367a5dd5f9e0330acca2cd /ImageView.py | |
parent | 55632ae4a8c4c420677c78648159b527822516e3 (diff) |
Make zoom buttons sensitivity work
Diffstat (limited to 'ImageView.py')
-rw-r--r-- | ImageView.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/ImageView.py b/ImageView.py index 23105f4..e74f3e9 100644 --- a/ImageView.py +++ b/ImageView.py @@ -54,20 +54,28 @@ class ImageViewer(Gtk.DrawingArea): self.queue_draw() def set_zoom(self, zoom): + if zoom < ZOOM_MIN or zoom > ZOOM_MAX: + return self._zoom = zoom self.queue_draw() def get_zoom(self): return self._zoom + def can_zoom_in(self): + return self._zoom + ZOOM_STEP < ZOOM_MAX + + def can_zoom_out(self): + return self._zoom - ZOOM_STEP > ZOOM_MIN + def zoom_in(self): - if self._zoom + ZOOM_STEP > ZOOM_MAX: + if not self.can_zoom_in(): return self._zoom += ZOOM_STEP self.queue_draw() def zoom_out(self): - if self._zoom - ZOOM_STEP < ZOOM_MIN: + if not self.can_zoom_out(): return self._zoom -= ZOOM_MIN self.queue_draw() @@ -90,7 +98,7 @@ class ImageViewer(Gtk.DrawingArea): self._zoom = 1.0 self.queue_draw() - def zoom_equal(self): + def zoom_original(self): self._zoom = 1 self.queue_draw() |