Forráskód Böngészése

wxGUI: check for invalid map size

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@54950 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 12 éve
szülő
commit
93a5cf65f4
1 módosított fájl, 6 hozzáadás és 3 törlés
  1. 6 3
      gui/wxpython/core/render.py

+ 6 - 3
gui/wxpython/core/render.py

@@ -14,7 +14,7 @@ Classes:
  - 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 @@ class Map(object):
     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))