Browse Source

g.gisenv: change unset option to be multiple
wxGUI: reflect https://trac.osgeo.org/grass/changeset/63745 in standalone monitors
(merge 63745-6 from trunk)


git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@63916 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 10 years ago
parent
commit
193abbb5aa
2 changed files with 20 additions and 14 deletions
  1. 13 8
      general/g.gisenv/main.c
  2. 7 6
      gui/wxpython/mapdisp/main.py

+ 13 - 8
general/g.gisenv/main.c

@@ -9,7 +9,7 @@
  *               Markus Neteler <neteler itc.it>
  *               Martin Landa <landa.martin gmail.com>
  * PURPOSE:      
- * COPYRIGHT:    (C) 2003-2006, 2011-2013 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2003-2014 by the GRASS Development Team
  *
  *               This program is free software under the GNU General Public
  *               License (>=v2). Read the file COPYING that comes with GRASS
@@ -72,7 +72,8 @@ int main(int argc, char *argv[])
     unset_opt->key_desc = "variable";
     unset_opt->required = NO;
     unset_opt->guisection = _("Set");
-
+    unset_opt->multiple = YES;
+    
     store_opt = G_define_option();
     store_opt->key = "store";
     store_opt->type = TYPE_STRING;
@@ -161,13 +162,17 @@ int main(int argc, char *argv[])
     }
     
     if (unset_opt->answer) {
-        u_name = parse_variable(unset_opt->answer, &value);
-        if (value)
-            G_warning(_("Value '%s' ignored when unsetting the GRASS variable"),
-                      value);
+        n = 0;
+        while (unset_opt->answers[n]) {
+            u_name = parse_variable(unset_opt->answers[n], &value);
+            if (value)
+                G_warning(_("Value '%s' ignored when unsetting the GRASS variable"),
+                          value);
         
-	G_getenv2(u_name, store); /* G_fatal_error() if not defined */
-	G_unsetenv2(u_name, store);
+            G_getenv2(u_name, store); /* G_fatal_error() if not defined */
+            G_unsetenv2(u_name, store);
+            n++;
+        }
     }
 
     if (u_name)

+ 7 - 6
gui/wxpython/mapdisp/main.py

@@ -461,12 +461,13 @@ if __name__ == "__main__":
     # clean up GRASS env variables
     env = grass.gisenv()
     env_name = 'MONITOR_%s' % monName.upper()
+    unset = list()
     for key in env.keys():
-        if key.find(env_name) == 0:
-            RunCommand('g.gisenv',
-                       unset = '%s' % key)
-        if key == 'MONITOR' and env[key] == monName:
-            RunCommand('g.gisenv',
-                       unset = '%s' % key)
+        if key.find(env_name) == 0 or \
+           (key == 'MONITOR' and env[key] == monName):
+            unset.append(key)
+    if unset:
+        RunCommand('g.gisenv',
+                   unset = '%s' % ','.join(unset))
     
     sys.exit(0)