[GRASS-SVN] r58751 - grass/branches/releasebranch_6_4/gui/wxpython/core

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jan 20 13:40:55 PST 2014


Author: annakrat
Date: 2014-01-20 13:40:54 -0800 (Mon, 20 Jan 2014)
New Revision: 58751

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/core/render.py
Log:
wxGUI: check for invalid map size (merge from develbranch, r54951)

Modified: grass/branches/releasebranch_6_4/gui/wxpython/core/render.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/core/render.py	2014-01-20 18:23:09 UTC (rev 58750)
+++ grass/branches/releasebranch_6_4/gui/wxpython/core/render.py	2014-01-20 21:40:54 UTC (rev 58751)
@@ -557,22 +557,21 @@
     def ChangeMapSize(self, (width, height)):
         """!Change size of rendered map.
         
-        @param width,height map size
-
-        @return True on success
-        @return False on failure
+        @param width,height map size given as tuple
         """
         try:
             self.width  = int(width)
             self.height = int(height)
-            Debug.msg(2, "Map.ChangeMapSize(): width=%d, height=%d" % \
-                          (self.width, self.height))
-            return True
-        except:
+            if self.width < 1 or self.height < 1:
+                sys.stderr.write(_("Invalid map size %d,%d\n") % (self.width, self.height))
+                raise ValueError
+        except ValueError:
             self.width  = 640
             self.height = 480
-            return False
-        
+
+        Debug.msg(2, "Map.ChangeMapSize(): width=%d, height=%d" % \
+                      (self.width, self.height))
+
     def GetRegion(self, rast = [], zoom = False, vect = [], regionName = None,
                   n = None, s = None, e = None, w = None, default = False,
                   update = False):



More information about the grass-commit mailing list