[GRASS-SVN] r54950 - grass/trunk/gui/wxpython/core

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Feb 6 02:41:14 PST 2013


Author: martinl
Date: 2013-02-06 02:41:14 -0800 (Wed, 06 Feb 2013)
New Revision: 54950

Modified:
   grass/trunk/gui/wxpython/core/render.py
Log:
wxGUI: check for invalid map size


Modified: grass/trunk/gui/wxpython/core/render.py
===================================================================
--- grass/trunk/gui/wxpython/core/render.py	2013-02-06 10:15:59 UTC (rev 54949)
+++ grass/trunk/gui/wxpython/core/render.py	2013-02-06 10:41:14 UTC (rev 54950)
@@ -14,7 +14,7 @@
  - render::Overlay
  - render::Map
 
-(C) 2006-2012 by the GRASS Development Team
+(C) 2006-2013 by the GRASS Development Team
 
 This program is free software under the GNU General Public License
 (>=v2). Read the file COPYING that comes with GRASS for details.
@@ -578,15 +578,18 @@
     def ChangeMapSize(self, (width, height)):
         """!Change size of rendered map.
         
-        @param width,height map size
+        @param width,height map size given as tuple
         """
         try:
             self.width  = int(width)
             self.height = int(height)
+            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
-
+        
         Debug.msg(2, "Map.ChangeMapSize(): width=%d, height=%d" % \
                       (self.width, self.height))
         



More information about the grass-commit mailing list