[GRASS-SVN] r57452 - grass/trunk/gui/wxpython/vdigit
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Aug 13 14:26:24 PDT 2013
Author: martinl
Date: 2013-08-13 14:26:24 -0700 (Tue, 13 Aug 2013)
New Revision: 57452
Modified:
grass/trunk/gui/wxpython/vdigit/g.gui.vdigit.py
Log:
g.gui.vdigit: add new flag to create new vector map if doesn't exist
Modified: grass/trunk/gui/wxpython/vdigit/g.gui.vdigit.py
===================================================================
--- grass/trunk/gui/wxpython/vdigit/g.gui.vdigit.py 2013-08-13 21:14:53 UTC (rev 57451)
+++ grass/trunk/gui/wxpython/vdigit/g.gui.vdigit.py 2013-08-13 21:26:24 UTC (rev 57452)
@@ -26,8 +26,12 @@
#% keywords: editing
#% keywords: digitization
#%end
+#%flag
+#% key: c
+#% description: Create new vector map if doesn't exist
+#%end
#%option G_OPT_V_MAP
-#%label: Name of vector map to load
+#% label: Name of vector map to edit
#%end
import os
@@ -92,6 +96,12 @@
if not grass.find_file(name = options['map'], element = 'vector',
mapset = grass.gisenv()['MAPSET'])['fullname']:
- grass.fatal(_("Vector map <%s> not found in current mapset") % options['map'])
+ if not flags['c']:
+ grass.fatal(_("Vector map <%s> not found in current mapset. "
+ "New vector map can be created by providing '-c' flag.") % options['map'])
+ else:
+ grass.message(_("New vector map <%s> created") % options['map'])
+ if 0 != grass.run_command('v.edit', map = options['map'], tool = 'create'):
+ grass.fatal(_("Unable to create new vector map <%s>") % options['map'])
GuiModuleMain(main)
More information about the grass-commit
mailing list