[GRASS-SVN] r46893 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jul 1 04:04:30 EDT 2011
Author: annakrat
Date: 2011-07-01 01:04:30 -0700 (Fri, 01 Jul 2011)
New Revision: 46893
Modified:
grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
Log:
wxNviz: show only active layers in GSelect popup
Modified: grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_tools.py 2011-07-01 08:01:02 UTC (rev 46892)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_tools.py 2011-07-01 08:04:30 UTC (rev 46893)
@@ -168,18 +168,21 @@
def SetInitialMaps(self):
"""!Set initial raster and vector map"""
- try:
- selectedRaster = self.mapWindow.Map.GetListOfLayers(l_type = 'raster')[0].GetName()
- self.FindWindowById(self.win['surface']['map']).SetValue(selectedRaster)
- self.FindWindowById(self.win['fringe']['map']).SetValue(selectedRaster)
- except IndexError:
- pass
-
- try:
- selectedVector = self.mapWindow.Map.GetListOfLayers(l_type = 'vector')[0].GetName()
- self.FindWindowById(self.win['vector']['map']).SetValue(selectedVector)
- except IndexError:
- pass
+ for l_type in ('raster', 'vector'):
+ selectedLayer = self.mapWindow.GetSelectedLayer()
+ layers = self.mapWindow.Map.GetListOfLayers(l_type = l_type, l_active = True)
+ if selectedLayer in layers:
+ selection = selectedLayer.GetName()
+ else:
+ try:
+ selection = layers[0].GetName()
+ except:
+ return
+ if l_type == 'raster':
+ self.FindWindowById(self.win['surface']['map']).SetValue(selection)
+ self.FindWindowById(self.win['fringe']['map']).SetValue(selection)
+ elif l_type == 'vector':
+ self.FindWindowById(self.win['vector']['map']).SetValue(selection)
def UpdateState(self, **kwargs):
if 'view' in kwargs:
@@ -1230,7 +1233,7 @@
def GselectOnPopup(self, ltype, exclude = False):
"""Update gselect.Select() items"""
maps = list()
- for layer in self.mapWindow.Map.GetListOfLayers(l_type = ltype):
+ for layer in self.mapWindow.Map.GetListOfLayers(l_type = ltype, l_active = True):
maps.append(layer.GetName())
return maps, exclude
More information about the grass-commit
mailing list