[GRASS-SVN] r50508 - grass/branches/releasebranch_6_4/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jan 28 04:20:40 EST 2012


Author: annakrat
Date: 2012-01-28 01:20:40 -0800 (Sat, 28 Jan 2012)
New Revision: 50508

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/psmap.py
Log:
wxGUI/wxpsmap: reopened bug #1547 hopefully fixed

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/psmap.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/psmap.py	2012-01-28 08:53:46 UTC (rev 50507)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/psmap.py	2012-01-28 09:20:40 UTC (rev 50508)
@@ -1418,20 +1418,24 @@
 
 
             if self.mouse['use'] == 'zoomout':
-                zoomFactor = min(rW/cW, rH/cH) 
-            if rW/rH > cW/cH:
-                yView = rect.GetY() - (rW*(cH/cW) - rH)/2
-                xView = rect.GetX()
+                zoomFactor = min(rW/cW, rH/cH)
+            try:
+                if rW/rH > cW/cH:
+                    yView = rect.GetY() - (rW*(cH/cW) - rH)/2
+                    xView = rect.GetX()
+                    
+                    if self.mouse['use'] == 'zoomout':
+                        x,y = rect.GetX() + (rW-(cW/cH)*rH)/2, rect.GetY()
+                        xView, yView = -x, -y
+                else:
+                    xView = rect.GetX() - (rH*(cW/cH) - rW)/2
+                    yView = rect.GetY()
+                    if self.mouse['use'] == 'zoomout':
+                        x,y = rect.GetX(), rect.GetY() + (rH-(cH/cW)*rW)/2
+                        xView, yView = -x, -y
+            except ZeroDivisionError:
+                xView, yView = rect.GetX(), rect.GetY()
                 
-                if self.mouse['use'] == 'zoomout':
-                    x,y = rect.GetX() + (rW-(cW/cH)*rH)/2, rect.GetY()
-                    xView, yView = -x, -y
-            else:
-                xView = rect.GetX() - (rH*(cW/cH) - rW)/2
-                yView = rect.GetY()
-                if self.mouse['use'] == 'zoomout':
-                    x,y = rect.GetX(), rect.GetY() + (rH-(cH/cW)*rW)/2
-                    xView, yView = -x, -y
         return zoomFactor, (int(xView), int(yView))
     
     



More information about the grass-commit mailing list