[GRASS-SVN] r43339 - in grass/branches/releasebranch_6_4/gui/wxpython: . gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Aug 29 12:35:37 EDT 2010


Author: martinl
Date: 2010-08-29 16:35:37 +0000 (Sun, 29 Aug 2010)
New Revision: 43339

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/utils.py
   grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py
Log:
wxGUI: guess fully qualified map name also when param key is missing

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py	2010-08-29 15:28:18 UTC (rev 43338)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py	2010-08-29 16:35:37 UTC (rev 43339)
@@ -326,10 +326,21 @@
                                   message=_("Command '%s' not yet implemented in the GUI. "
                                             "Try adding it as a command layer instead.") % cmdlist[0])
                     return None
-
+                
                 # add layer into layer tree
+                if cmdlist[0] == 'd.rast':
+                    lname = utils.GetLayerNameFromCmd(cmdlist, fullyQualified = True,
+                                                      layerType = 'raster')
+                elif cmdlist[0] == 'd.vect':
+                    lname = utils.GetLayerNameFromCmd(cmdlist, fullyQualified = True,
+                                                      layerType = 'vector')
+                else:
+                    lname = None
+                                
+                # add layer into layer tree
                 if self.parent.GetName() == "LayerManager":
                     self.parent.curr_page.maptree.AddLayer(ltype=layertype,
+                                                           lname=lname,
                                                            lcmd=cmdlist)
             else:
                 #

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/utils.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/utils.py	2010-08-29 15:28:18 UTC (rev 43338)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/utils.py	2010-08-29 16:35:37 UTC (rev 43339)
@@ -78,7 +78,7 @@
     @return '' if no map name found in command
     """
     mapname = ''
-
+    
     if len(dcmd) < 1:
         return mapname
     
@@ -101,12 +101,15 @@
                         'h_map=' in dcmd[idx] or \
                         'reliefmap' in dcmd[idx]:
                     break
-            
+        
         if idx < len(dcmd):
             try:
                 mapname = dcmd[idx].split('=')[1]
             except IndexError:
-                return ''
+                if idx == 1:
+                    mapname = dcmd[idx]
+                else:
+                    return ''
             
             if fullyQualified and '@' not in mapname:
                 if layerType in ('raster', 'vector', '3d-raster'):
@@ -124,8 +127,11 @@
                         mapname += '@' + grassenv.GetGRASSVariable('MAPSET')
                 else:
                     mapname += '@' + grassenv.GetGRASSVariable('MAPSET')
-                dcmd[idx] = dcmd[idx].split('=')[0] + '=' + mapname
-                
+                if '=' in dcmd[idx]:
+                    dcmd[idx] = dcmd[idx].split('=')[0] + '=' + mapname
+                else:
+                    dcmd[idx] = mapname
+    
     return mapname
 
 def GetValidLayerName(name):

Modified: grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py	2010-08-29 15:28:18 UTC (rev 43338)
+++ grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py	2010-08-29 16:35:37 UTC (rev 43339)
@@ -1511,7 +1511,7 @@
         if UserSettings.Get(group='manager', key='askOnRemoveLayer', subkey='enabled'):
             layerName = ''
             for item in self.curr_page.maptree.GetSelections():
-                name = str(self.curr_page.maptree.GetItemText(item))
+                name = self.curr_page.maptree.GetItemText(item)
                 idx = name.find('(opacity')
                 if idx > -1:
                     layerName += '<' + name[:idx].strip(' ') + '>,\n'



More information about the grass-commit mailing list