pybootchartgui: Make the horizontal scaling stay within bounds
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>
Fri, 15 Nov 2013 17:08:51 +0000 (18:08 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 18 Nov 2013 12:44:06 +0000 (12:44 +0000)
(From OE-Core rev: 50c2c3435915ef1ecbde395c71c5c9581c83fb2e)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/pybootchartgui/pybootchartgui/gui.py

index ddeb88c..164bdfb 100644 (file)
@@ -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)