Patchwork [02/14] pybootchartgui: Make the horizontal scaling stay within bounds

login
register
mail settings
Submitter Peter Kjellerstedt
Date Nov. 15, 2013, 5:08 p.m.
Message ID <0134656d08b8bdb51127a36836edaddba561b8fa.1384535211.git.pkj@axis.com>
Download mbox | patch
Permalink /patch/61799/
State New
Headers show

Comments

Peter Kjellerstedt - Nov. 15, 2013, 5:08 p.m.
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 scripts/pybootchartgui/pybootchartgui/gui.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/scripts/pybootchartgui/pybootchartgui/gui.py b/scripts/pybootchartgui/pybootchartgui/gui.py
index ddeb88c..164bdfb 100644
--- a/scripts/pybootchartgui/pybootchartgui/gui.py
+++ b/scripts/pybootchartgui/pybootchartgui/gui.py
@@ -101,10 +101,10 @@  class PyBootchartWidget(gtk.DrawingArea):
         self.zoom_image (self.zoom_ratio)
 
     def on_expand(self, action):
-        self.set_xscale (self.xscale * 1.5)
+        self.set_xscale (int(self.xscale * 1.5 + 0.5))
 
     def on_contract(self, action):
-        self.set_xscale (self.xscale / 1.5)
+        self.set_xscale (max(int(self.xscale / 1.5), 1))
 
     def on_zoom_in(self, action):
         self.zoom_image(self.zoom_ratio * self.ZOOM_INCREMENT)