[GRASS-SVN] r53092 - grass/branches/develbranch_6/gui/wxpython/core

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Sep 5 02:42:41 PDT 2012


Author: annakrat
Date: 2012-09-05 02:42:39 -0700 (Wed, 05 Sep 2012)
New Revision: 53092

Modified:
   grass/branches/develbranch_6/gui/wxpython/core/utils.py
Log:
wxGUI: utils.GetLayerNameFromCmd: fixed case when flags go first (merge from releasebranch, r53091)

Modified: grass/branches/develbranch_6/gui/wxpython/core/utils.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/core/utils.py	2012-09-05 09:29:34 UTC (rev 53091)
+++ grass/branches/develbranch_6/gui/wxpython/core/utils.py	2012-09-05 09:42:39 UTC (rev 53092)
@@ -116,15 +116,24 @@
                      'h_map', 's_map', 'i_map',
                      'reliefmap', 'labels'):
                 params.append((idx, p, v))
-        
+
         if len(params) < 1:
-            if len(dcmd) > 1 and '=' not in dcmd[1]:
-                task = gtask.parse_interface(dcmd[0])
-                p = task.get_options()['params'][0].get('name', '')
-                params.append((1, p, dcmd[1]))
+            if len(dcmd) > 1:
+                i = 1
+                while i < len(dcmd):
+                    if '=' not in dcmd[i] and not dcmd[i].startswith('-'):
+                        task = gtask.parse_interface(dcmd[0])
+                        # this expects the first parameter to be the right one
+                        p = task.get_options()['params'][0].get('name', '')
+                        params.append((i, p, dcmd[i]))
+                        break
+                    i += 1
             else:
                 return mapname, False
-        
+
+        if len(params) < 1:
+            return mapname, False
+
         mapname = params[0][2]
         mapset = ''
         if fullyQualified and '@' not in mapname:
@@ -142,15 +151,15 @@
             else:
                 mapset = grass.gisenv()['MAPSET']
             
-            # update dcmd
-            for i, p, v in params:
-                if p:
-                    dcmd[i] = p + '=' + v
-                else:
-                    dcmd[i] = v
-                if mapset:
-                    dcmd[i] += '@' + mapset
-        
+        # update dcmd
+        for i, p, v in params:
+            if p:
+                dcmd[i] = p + '=' + v
+            else:
+                dcmd[i] = v
+            if mapset:
+                dcmd[i] += '@' + mapset
+
         maps = list()
         for i, p, v in params:
             if not p:



More information about the grass-commit mailing list