[GRASS-SVN] r54951 - grass/branches/develbranch_6/gui/wxpython/core
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Feb 6 02:48:33 PST 2013
Author: martinl
Date: 2013-02-06 02:48:33 -0800 (Wed, 06 Feb 2013)
New Revision: 54951
Modified:
grass/branches/develbranch_6/gui/wxpython/core/render.py
Log:
wxGUI: check for invalid map size
Modified: grass/branches/develbranch_6/gui/wxpython/core/render.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/core/render.py 2013-02-06 10:41:14 UTC (rev 54950)
+++ grass/branches/develbranch_6/gui/wxpython/core/render.py 2013-02-06 10:48:33 UTC (rev 54951)
@@ -9,7 +9,7 @@
- render::Overlay
- render::Map
-(C) 2006-2011 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.
@@ -557,7 +557,7 @@
def ChangeMapSize(self, (width, height)):
"""!Change size of rendered map.
- @param width,height map size
+ @param width,height map size given as tuple
@return True on success
@return False on failure
@@ -565,14 +565,17 @@
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