[GRASS-SVN] r37175 - in grass/branches/develbranch_6/gui: scripts
tcltk/gis.m wxpython/xml
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue May 12 01:25:40 EDT 2009
Author: hamish
Date: 2009-05-12 01:25:40 -0400 (Tue, 12 May 2009)
New Revision: 37175
Added:
grass/branches/develbranch_6/gui/scripts/v.type_wrapper.py
grass/branches/develbranch_6/gui/scripts/v.type_wrapper.sh
Removed:
grass/branches/develbranch_6/gui/scripts/v.type.py
grass/branches/develbranch_6/gui/scripts/v.type.sh
Modified:
grass/branches/develbranch_6/gui/scripts/Makefile
grass/branches/develbranch_6/gui/scripts/g.change.gui.sh
grass/branches/develbranch_6/gui/tcltk/gis.m/gmmenu.tcl
grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml
Log:
rename v.type.py wrapper script to avoid possible namespace collision on MS Windows (merge from trunk), rename v.type.sh as well for consistency; no .bat wrapper for .py
Modified: grass/branches/develbranch_6/gui/scripts/Makefile
===================================================================
--- grass/branches/develbranch_6/gui/scripts/Makefile 2009-05-12 05:22:10 UTC (rev 37174)
+++ grass/branches/develbranch_6/gui/scripts/Makefile 2009-05-12 05:25:40 UTC (rev 37175)
@@ -12,6 +12,6 @@
for file in d.* g.* r.* v.* ; do $(INSTALL) $$file $(ETC)/gui/scripts/ ; done
create.bat:
- for file in d.* g.* r.* v.* ; do \
+ for file in d.* g.*sh r.* v.*sh ; do \
sed -e "s#SCRIPT_NAME#$$file#" $(MODULE_TOPDIR)/gui/scripts/windows_launch.bat \
> $(ETC)/gui/scripts/$$file.bat ; done
Modified: grass/branches/develbranch_6/gui/scripts/g.change.gui.sh
===================================================================
--- grass/branches/develbranch_6/gui/scripts/g.change.gui.sh 2009-05-12 05:22:10 UTC (rev 37174)
+++ grass/branches/develbranch_6/gui/scripts/g.change.gui.sh 2009-05-12 05:25:40 UTC (rev 37175)
@@ -41,6 +41,11 @@
exit 1
fi
+if [ ! -x "`which $(basename "$0")`" ] ; then
+ PATH="$PATH:$GISBASE/etc/gui/scripts"
+ export PATH
+fi
+
if [ "$1" != "@ARGS_PARSED@" ] ; then
exec g.parser "$0" "$@"
fi
Deleted: grass/branches/develbranch_6/gui/scripts/v.type.py
===================================================================
--- grass/branches/develbranch_6/gui/scripts/v.type.py 2009-05-12 05:22:10 UTC (rev 37174)
+++ grass/branches/develbranch_6/gui/scripts/v.type.py 2009-05-12 05:25:40 UTC (rev 37175)
@@ -1,91 +0,0 @@
-#!/usr/bin/env python
-############################################################################
-#
-# MODULE: v.type.py (v.type wrapper script)
-#
-# AUTHOR(S): Hamish Bowman (Otago University, New Zealand)
-# (original contributor, v.type.sh)
-# Pythonized by Martin Landa <landa.martin gmail.com> (2008/08)
-#
-# PURPOSE: Supply v.type options in a GUI compatible way
-#
-# COPYRIGHT: (C) 2007-2008 by Hamish Bowman, and the GRASS Development Team
-#
-# This program is free software under the GNU General Public
-# License (>=v2). Read the file COPYING that comes with GRASS
-# for details.
-#
-#############################################################################
-
-#%module
-#% description: Change the type of geometry elements.
-#% keywords: vector, geometry
-#%end
-
-#%option
-#% key: input
-#% type: string
-#% required: yes
-#% multiple: no
-#% key_desc: name
-#% description: Name of input vector map
-#% gisprompt: old,vector,vector
-#%end
-
-#%option
-#% key: output
-#% type: string
-#% required: yes
-#% multiple: no
-#% key_desc: name
-#% description: Name for output vector map
-#% gisprompt: new,vector,vector
-#%end
-
-#%option
-#% key: type
-#% type: string
-#% required: no
-#% multiple: no
-#% options: point to centroid,point to kernel,centroid to point,centroid to kernel,kernel to point,kernel to centroid,line to boundary,line to face,boundary to line,boundary to face,face to line,face to boundary
-#% description: Conversion
-#% answer: boundary to line
-#%end
-
-import grass
-import sys
-
-def main():
- if options['type'] == "point to centroid":
- type_cnv = "point,centroid"
- elif options['type'] == "point to kernel":
- type_cnv = "point,kernel"
- elif options['type'] == "centroid to point":
- type_cnv = "centroid,point"
- elif options['type'] == "centroid to kernel":
- type_cnv = "centroid,kernel"
- elif options['type'] == "kernel to point":
- type_cnv = "kernel,point"
- elif options['type'] == "kernel to centroid":
- type_cnv = "kernel,centroid"
- elif options['type'] == "line to boundary":
- type_cnv = "line,boundary"
- elif options['type'] == "line to face":
- type_cnv = "line,face"
- elif options['type'] == "boundary to line":
- type_cnv = "boundary,line"
- elif options['type'] == "boundary to face":
- type_cnv = "boundary,face"
- elif options['type'] == "face to line":
- type_cnv = "face,line"
- elif options['type'] == "face to boundary":
- type_cnv = "face,boundary"
-
- options.pop('type')
- grass.exec_command("v.type", type = type_cnv, **options)
-
- return 0
-
-if __name__ == "__main__":
- options, flags = grass.parser()
- sys.exit(main())
Deleted: grass/branches/develbranch_6/gui/scripts/v.type.sh
===================================================================
--- grass/branches/develbranch_6/gui/scripts/v.type.sh 2009-05-12 05:22:10 UTC (rev 37174)
+++ grass/branches/develbranch_6/gui/scripts/v.type.sh 2009-05-12 05:25:40 UTC (rev 37175)
@@ -1,88 +0,0 @@
-#!/bin/sh
-############################################################################
-#
-# MODULE: v.type.sh (v.type wrapper script)
-# AUTHOR(S): Hamish Bowman (Otago University, New Zealand)
-# PURPOSE: Supply v.type options in a GUI compatible way
-# COPYRIGHT: (c) 2007 by Hamish Bowman, and the GRASS Development Team
-#
-# This program is free software under the GNU General Public
-# License (>=v2). Read the file COPYING that comes with GRASS
-# for details.
-#
-#############################################################################
-# Notes:
-# Created with "v.type --script" from GRASS 6.3-CVS 23 May 2007
-
-#%Module
-#% description: Change the type of geometry elements.
-#% keywords: vector, geometry
-#%End
-#%Option
-#% key: input
-#% type: string
-#% required: yes
-#% multiple: no
-#% key_desc: name
-#% description: Name of input vector map
-#% gisprompt: old,vector,vector
-#%End
-#%Option
-#% key: output
-#% type: string
-#% required: yes
-#% multiple: no
-#% key_desc: name
-#% description: Name for output vector map
-#% gisprompt: new,vector,vector
-#%End
-#%Option
-#% key: type
-#% type: string
-#% required: no
-#% multiple: no
-#% options: point to centroid,point to kernel,centroid to point,centroid to kernel,kernel to point,kernel to centroid,line to boundary,line to face,boundary to line,boundary to face,face to line,face to boundary
-#% description: Conversion
-#% answer: boundary to line
-#%End
-
-
-if [ -z "$GISBASE" ] ; then
- echo "You must be in GRASS GIS to run this program." 1>&2
- exit 1
-fi
-
-if [ "$1" != "@ARGS_PARSED@" ] ; then
- exec g.parser "$0" "$@"
-fi
-
-unset TYPE_CNV
-
-case "$GIS_OPT_TYPE" in
- "point to centroid")
- TYPE_CNV="point,centroid" ;;
- "centroid to point")
- TYPE_CNV="centroid,point" ;;
- "line to boundary")
- TYPE_CNV="line,boundary" ;;
- "boundary to line")
- TYPE_CNV="boundary,line" ;;
- "kernel to centroid")
- TYPE_CNV="kernel,centroid" ;;
- "centroid to kernel")
- TYPE_CNV="centroid,kernel" ;;
- "face to boundary")
- TYPE_CNV="face,boundary" ;;
- "boundary to face")
- TYPE_CNV="boundary,face" ;;
- "point to kernel")
- TYPE_CNV="point,kernel" ;;
- "kernel to point")
- TYPE_CNV="kernel,point" ;;
- "line to face")
- TYPE_CNV="line,face" ;;
- "face to line")
- TYPE_CNV="face,line" ;;
-esac
-
-exec v.type input="$GIS_OPT_INPUT" output="$GIS_OPT_OUTPUT" type="$TYPE_CNV"
Copied: grass/branches/develbranch_6/gui/scripts/v.type_wrapper.py (from rev 37173, grass/trunk/gui/scripts/v.type_wrapper.py)
===================================================================
--- grass/branches/develbranch_6/gui/scripts/v.type_wrapper.py (rev 0)
+++ grass/branches/develbranch_6/gui/scripts/v.type_wrapper.py 2009-05-12 05:25:40 UTC (rev 37175)
@@ -0,0 +1,91 @@
+#!/usr/bin/env python
+############################################################################
+#
+# MODULE: v.type_wrapper.py (v.type wrapper script)
+#
+# AUTHOR(S): Hamish Bowman (Otago University, New Zealand)
+# (original contributor, v.type.sh)
+# Pythonized by Martin Landa <landa.martin gmail.com> (2008/08)
+#
+# PURPOSE: Supply v.type options in a GUI compatible way
+#
+# COPYRIGHT: (C) 2007-2008 by Hamish Bowman, and the GRASS Development Team
+#
+# This program is free software under the GNU General Public
+# License (>=v2). Read the file COPYING that comes with GRASS
+# for details.
+#
+#############################################################################
+
+#%module
+#% description: Change the type of geometry elements.
+#% keywords: vector, geometry
+#%end
+
+#%option
+#% key: input
+#% type: string
+#% required: yes
+#% multiple: no
+#% key_desc: name
+#% description: Name of input vector map
+#% gisprompt: old,vector,vector
+#%end
+
+#%option
+#% key: output
+#% type: string
+#% required: yes
+#% multiple: no
+#% key_desc: name
+#% description: Name for output vector map
+#% gisprompt: new,vector,vector
+#%end
+
+#%option
+#% key: type
+#% type: string
+#% required: no
+#% multiple: no
+#% options: point to centroid,point to kernel,centroid to point,centroid to kernel,kernel to point,kernel to centroid,line to boundary,line to face,boundary to line,boundary to face,face to line,face to boundary
+#% description: Conversion
+#% answer: boundary to line
+#%end
+
+import grass
+import sys
+
+def main():
+ if options['type'] == "point to centroid":
+ type_cnv = "point,centroid"
+ elif options['type'] == "point to kernel":
+ type_cnv = "point,kernel"
+ elif options['type'] == "centroid to point":
+ type_cnv = "centroid,point"
+ elif options['type'] == "centroid to kernel":
+ type_cnv = "centroid,kernel"
+ elif options['type'] == "kernel to point":
+ type_cnv = "kernel,point"
+ elif options['type'] == "kernel to centroid":
+ type_cnv = "kernel,centroid"
+ elif options['type'] == "line to boundary":
+ type_cnv = "line,boundary"
+ elif options['type'] == "line to face":
+ type_cnv = "line,face"
+ elif options['type'] == "boundary to line":
+ type_cnv = "boundary,line"
+ elif options['type'] == "boundary to face":
+ type_cnv = "boundary,face"
+ elif options['type'] == "face to line":
+ type_cnv = "face,line"
+ elif options['type'] == "face to boundary":
+ type_cnv = "face,boundary"
+
+ options.pop('type')
+ grass.exec_command("v.type", type = type_cnv, **options)
+
+ return 0
+
+if __name__ == "__main__":
+ options, flags = grass.parser()
+ sys.exit(main())
Copied: grass/branches/develbranch_6/gui/scripts/v.type_wrapper.sh (from rev 37174, grass/branches/releasebranch_6_4/gui/scripts/v.type_wrapper.sh)
===================================================================
--- grass/branches/develbranch_6/gui/scripts/v.type_wrapper.sh (rev 0)
+++ grass/branches/develbranch_6/gui/scripts/v.type_wrapper.sh 2009-05-12 05:25:40 UTC (rev 37175)
@@ -0,0 +1,88 @@
+#!/bin/sh
+############################################################################
+#
+# MODULE: v.type_wrapper.sh (v.type wrapper script)
+# AUTHOR(S): Hamish Bowman (Otago University, New Zealand)
+# PURPOSE: Supply v.type options in a GUI compatible way
+# COPYRIGHT: (c) 2007 by Hamish Bowman, and the GRASS Development Team
+#
+# This program is free software under the GNU General Public
+# License (>=v2). Read the file COPYING that comes with GRASS
+# for details.
+#
+#############################################################################
+# Notes:
+# Created with "v.type --script" from GRASS 6.3-CVS 23 May 2007
+
+#%Module
+#% description: Change the type of geometry elements.
+#% keywords: vector, geometry
+#%End
+#%Option
+#% key: input
+#% type: string
+#% required: yes
+#% multiple: no
+#% key_desc: name
+#% description: Name of input vector map
+#% gisprompt: old,vector,vector
+#%End
+#%Option
+#% key: output
+#% type: string
+#% required: yes
+#% multiple: no
+#% key_desc: name
+#% description: Name for output vector map
+#% gisprompt: new,vector,vector
+#%End
+#%Option
+#% key: type
+#% type: string
+#% required: no
+#% multiple: no
+#% options: point to centroid,point to kernel,centroid to point,centroid to kernel,kernel to point,kernel to centroid,line to boundary,line to face,boundary to line,boundary to face,face to line,face to boundary
+#% description: Conversion
+#% answer: boundary to line
+#%End
+
+
+if [ -z "$GISBASE" ] ; then
+ echo "You must be in GRASS GIS to run this program." 1>&2
+ exit 1
+fi
+
+if [ "$1" != "@ARGS_PARSED@" ] ; then
+ exec g.parser "$0" "$@"
+fi
+
+unset TYPE_CNV
+
+case "$GIS_OPT_TYPE" in
+ "point to centroid")
+ TYPE_CNV="point,centroid" ;;
+ "centroid to point")
+ TYPE_CNV="centroid,point" ;;
+ "line to boundary")
+ TYPE_CNV="line,boundary" ;;
+ "boundary to line")
+ TYPE_CNV="boundary,line" ;;
+ "kernel to centroid")
+ TYPE_CNV="kernel,centroid" ;;
+ "centroid to kernel")
+ TYPE_CNV="centroid,kernel" ;;
+ "face to boundary")
+ TYPE_CNV="face,boundary" ;;
+ "boundary to face")
+ TYPE_CNV="boundary,face" ;;
+ "point to kernel")
+ TYPE_CNV="point,kernel" ;;
+ "kernel to point")
+ TYPE_CNV="kernel,point" ;;
+ "line to face")
+ TYPE_CNV="line,face" ;;
+ "face to line")
+ TYPE_CNV="face,line" ;;
+esac
+
+exec v.type input="$GIS_OPT_INPUT" output="$GIS_OPT_OUTPUT" type="$TYPE_CNV"
Modified: grass/branches/develbranch_6/gui/tcltk/gis.m/gmmenu.tcl
===================================================================
--- grass/branches/develbranch_6/gui/tcltk/gis.m/gmmenu.tcl 2009-05-12 05:22:10 UTC (rev 37174)
+++ grass/branches/develbranch_6/gui/tcltk/gis.m/gmmenu.tcl 2009-05-12 05:25:40 UTC (rev 37175)
@@ -435,7 +435,7 @@
{command {[G_msg "Clean vector"]} {} "v.clean: Clean vector objects" {} -command {execute v.clean }}
{command {[G_msg "Smooth or simplify"]} {} "v.generalize: Smooth or simplify lines and boundaries (reduce vertices)" {} -command {execute v.generalize }}
{separator}
- {command {[G_msg "Convert object types"]} {} "v.type: Convert vector objects from one feature type to another" {} -command {execute $env(GISBASE)/etc/gui/scripts/v.type.sh }}
+ {command {[G_msg "Convert object types"]} {} "v.type: Convert vector objects from one feature type to another" {} -command {execute $env(GISBASE)/etc/gui/scripts/v.type_wrapper.sh }}
{separator}
{command {[G_msg "Add centroids"]} {} "v.centroids: Add centroids to closed boundaries to create areas" {} -command {execute v.centroids }}
{separator}
Modified: grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml 2009-05-12 05:22:10 UTC (rev 37174)
+++ grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml 2009-05-12 05:25:40 UTC (rev 37175)
@@ -1533,7 +1533,7 @@
<label>Convert object types</label>
<help>Change the type of geometry elements.</help>
<handler>self.OnMenuCmd</handler>
- <command>v.type.py</command>
+ <command>v.type_wrapper.py</command>
</menuitem>
<separator/>
<menuitem>
More information about the grass-commit
mailing list