[GRASS-SVN] r42090 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Mon May 3 11:59:13 EDT 2010


Author: martinl
Date: 2010-05-03 11:59:12 -0400 (Mon, 03 May 2010)
New Revision: 42090

Modified:
   grass/trunk/gui/wxpython/gui_modules/goutput.py
   grass/trunk/gui/wxpython/gui_modules/menuform.py
Log:
wxGUI: fix adding multiple maps into layer tree
(merge r42089 from devbr6)


Modified: grass/trunk/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/goutput.py	2010-05-03 15:48:53 UTC (rev 42089)
+++ grass/trunk/gui/wxpython/gui_modules/goutput.py	2010-05-03 15:59:12 UTC (rev 42090)
@@ -734,27 +734,34 @@
             if event.returncode == 0 and \
                     not event.aborted and hasattr(dialog, "addbox") and \
                     dialog.addbox.IsChecked():
-                # add new map into layer tree
-                if dialog.outputType in ('raster', 'vector'):
-                    # add layer into layer tree
-                    cmd = dialog.notebookpanel.createCmd(ignoreErrors = True)
-                    name = utils.GetLayerNameFromCmd(cmd, fullyQualified=True, param='output')
-                    winName = self.parent.parent.parent.GetName()
-                    if winName == 'LayerManager':
-                        mapTree = self.parent.parent.parent.curr_page.maptree
-                    else: # GMConsole
-                        mapTree = self.parent.parent.parent.parent.curr_page.maptree
-                    if not mapTree.GetMap().GetListOfLayers(l_name = name):
-                        if dialog.outputType == 'raster':
+                # add created maps into layer tree
+                winName = self.parent.parent.parent.GetName()
+                if winName == 'LayerManager':
+                    mapTree = self.parent.parent.parent.curr_page.maptree
+                else: # GMConsole
+                    mapTree = self.parent.parent.parent.parent.curr_page.maptree
+                
+                cmd = dialog.notebookpanel.createCmd(ignoreErrors = True)
+                for p in dialog.task.get_options()['params']:
+                    prompt = p.get('prompt', '')
+                    if prompt in ('raster', 'vector', '3d-raster') and \
+                       p.get('age', 'old') == 'new' and \
+                       p.get('value', None):
+                        name = utils.GetLayerNameFromCmd(cmd, fullyQualified=True, param = p.get('name', ''))
+                        
+                        if mapTree.GetMap().GetListOfLayers(l_name = name):
+                            continue
+                        
+                        if prompt == 'raster':
                             lcmd = ['d.rast',
                                     'map=%s' % name]
                         else:
                             lcmd = ['d.vect',
                                     'map=%s' % name]
-                        mapTree.AddLayer(ltype=dialog.outputType,
-                                         lcmd=lcmd,
-                                         lname=name)
-                    
+                        mapTree.AddLayer(ltype = prompt,
+                                         lcmd = lcmd,
+                                         lname = name)
+                
             if hasattr(dialog, "get_dcmd") and \
                     dialog.get_dcmd is None and \
                     dialog.closebox.IsChecked():

Modified: grass/trunk/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menuform.py	2010-05-03 15:48:53 UTC (rev 42089)
+++ grass/trunk/gui/wxpython/gui_modules/menuform.py	2010-05-03 15:59:12 UTC (rev 42090)
@@ -835,15 +835,16 @@
                      border = 30)
 
         if self.parent and self.parent.GetName() != 'Modeler':
-            self.outputType = None
+            addLayer = False
             for p in self.task.params:
-                if p.get('name', '') == 'output':
-                    self.outputType = p.get('prompt', None)
-                    break
-            if self.outputType in ('raster', 'vector', '3d-raster'):
+                if p.get('age', 'old') == 'new' and \
+                   p.get('prompt', '') in ('raster', 'vector', '3d-raster'):
+                    addLayer = True
+            
+            if addLayer:
                 # add newly created map into layer tree
                 self.addbox = wx.CheckBox(parent=self.panel,
-                                          label=_('Add created map into layer tree'), style = wx.NO_BORDER)
+                                          label=_('Add created map(s) into layer tree'), style = wx.NO_BORDER)
                 self.addbox.SetValue(UserSettings.Get(group='cmd', key='addNewLayer', subkey='enabled'))
                 guisizer.Add(item=self.addbox, proportion=0,
                              flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM,



More information about the grass-commit mailing list