[GRASS-SVN] r47991 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Aug 31 03:10:09 EDT 2011
Author: cmbarton
Date: 2011-08-31 00:10:09 -0700 (Wed, 31 Aug 2011)
New Revision: 47991
Modified:
grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
Log:
Added some error traps for KeyErrors when unloading or loading maps in wxnviz
Modified: grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py 2011-08-30 21:03:51 UTC (rev 47990)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py 2011-08-31 07:10:09 UTC (rev 47991)
@@ -1215,7 +1215,10 @@
errorMsg = _("Unable to unload 3d raster map")
successMsg = _("3d raster map")
- id = data[nvizType]['object']['id']
+ if 'object' not in data[nvizType]:
+ return
+ else:
+ id = data[nvizType]['object']['id']
if unloadFn(id) == 0:
self.log.WriteError("%s <%s>" % (errorMsg, layer.name))
@@ -1323,7 +1326,7 @@
for vecType in vecTypes:
if 'object' not in data[vecType]:
continue
-
+
id = data[vecType]['object']['id']
if vecType == 'lines':
@@ -1339,7 +1342,7 @@
data[vecType].pop('object')
- if remove:
+ if remove and item in self.layers:
self.layers.remove(item)
def OnZoomToMap(self, event):
@@ -1775,6 +1778,13 @@
data = self.tree.GetPyData(item)[0]['nviz']
+ for datatype in ['surface', 'volume']:
+ if 'object' not in data[datatype]:
+ return -1
+ for datatype in ['points', 'lines']:
+ if 'object' not in data['vector'][datatype]:
+ return -1
+
if type == 'raster':
return data['surface']['object']['id']
elif type == 'vector':
More information about the grass-commit
mailing list