[GRASS-SVN] r37173 - in grass/trunk/gui: scripts wxpython/xml

svn_grass at osgeo.org svn_grass at osgeo.org
Tue May 12 01:00:55 EDT 2009


Author: hamish
Date: 2009-05-12 01:00:55 -0400 (Tue, 12 May 2009)
New Revision: 37173

Added:
   grass/trunk/gui/scripts/v.type_wrapper.py
Removed:
   grass/trunk/gui/scripts/v.type.py
Modified:
   grass/trunk/gui/wxpython/xml/menudata.xml
Log:
rename v.type wrapper script to avoid possible namespace collision on MS Windows

Deleted: grass/trunk/gui/scripts/v.type.py
===================================================================
--- grass/trunk/gui/scripts/v.type.py	2009-05-11 21:56:48 UTC (rev 37172)
+++ grass/trunk/gui/scripts/v.type.py	2009-05-12 05:00:55 UTC (rev 37173)
@@ -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())

Copied: grass/trunk/gui/scripts/v.type_wrapper.py (from rev 37165, grass/trunk/gui/scripts/v.type.py)
===================================================================
--- grass/trunk/gui/scripts/v.type_wrapper.py	                        (rev 0)
+++ grass/trunk/gui/scripts/v.type_wrapper.py	2009-05-12 05:00:55 UTC (rev 37173)
@@ -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())

Modified: grass/trunk/gui/wxpython/xml/menudata.xml
===================================================================
--- grass/trunk/gui/wxpython/xml/menudata.xml	2009-05-11 21:56:48 UTC (rev 37172)
+++ grass/trunk/gui/wxpython/xml/menudata.xml	2009-05-12 05:00:55 UTC (rev 37173)
@@ -1552,7 +1552,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