From da22028f22a2df0aa0152c77cb8902696b4b2519 Mon Sep 17 00:00:00 2001 From: Martin Baeuml Date: Thu, 9 Dec 2010 11:24:48 +0100 Subject: [PATCH] avoid "division by zero" exception --- frameviewer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frameviewer.py b/frameviewer.py index 7176689..e626300 100644 --- a/frameviewer.py +++ b/frameviewer.py @@ -48,8 +48,8 @@ class GraphicsView(QGraphicsView): self.update() def getMinScale(self): - min_scale_w = float(self.width() - 2*self.frameWidth()) / self.scene().width() - min_scale_h = float(self.height() - 2*self.frameWidth()) / self.scene().height() + min_scale_w = float(self.width() - 2*self.frameWidth()) / (self.scene().width()+1) + min_scale_h = float(self.height() - 2*self.frameWidth()) / (self.scene().height()+1) min_scale = min(min_scale_w, min_scale_h) return min_scale