[GRASS-SVN] r38291 - grass-addons/vector/v.krige

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jul 6 11:20:13 EDT 2009


Author: aghisla
Date: 2009-07-06 11:20:12 -0400 (Mon, 06 Jul 2009)
New Revision: 38291

Modified:
   grass-addons/vector/v.krige/v.krige.py
Log:
started CLI implementation - huge refactoring coming soon!


Modified: grass-addons/vector/v.krige/v.krige.py
===================================================================
--- grass-addons/vector/v.krige/v.krige.py	2009-07-06 13:41:07 UTC (rev 38290)
+++ grass-addons/vector/v.krige/v.krige.py	2009-07-06 15:20:12 UTC (rev 38291)
@@ -15,11 +15,33 @@
 for details.
 """
 
+## g.parser informations
+
 #%module
 #% description: Performs ordinary kriging.
 #% keywords: kriging
 #%end
 
+#%option
+#% key: map
+#% type: string
+#% gisprompt: old,vector,vector
+#% key_desc: name
+#% description: Name of point vector map containing sample data.
+#% required: yes
+#%end
+
+#
+##%option
+##% key: 
+##% type: 
+##% gisprompt: 
+##% key_desc: 
+##% description: 
+##% required: 
+##%end
+
+
 import os, sys
 
 try:
@@ -349,40 +371,30 @@
         pass
     
 def main(argv=None):
+    #@TODO(anne):add here all dependency checking
+    if not haveRpy2:
+        sys.exit(1)
     
     if argv is None:
         # is this check needed? I won't call the module in other way than last line.
         argv = sys.argv[1:] #stripping first item, the full name of this script
-        print argv
-        #@TODO(anne): add command line arguments acceptance.
-        #@TIP: from optparse import OptionParser
-        
-    #@FIXME: is this code still useful? 
-    """if len(argv) != 2:
-        print >> sys.stderr, __doc__
-        sys.exit()"""
+        # wxGUI call.
+        app = wx.App()
+        k = KrigingModule(parent=None)
+        k.Centre()
+        k.Show()
+        app.MainLoop()
+    else:
+        #@TODO: call here the different steps of kriging. Essentially, OnRunButton stuff.
+        print "I'm calculating the square root of nothing."
 
-    # Command line arguments of the script to be run are preserved by the
-    # hotswap.py wrapper but hotswap.py and its options are removed that
-    # sys.argv looks as if no wrapper was present.
-    #print "argv:", `argv`
-
     # commmented, as I don't know if the module will need it.
     ##some applications might require image handlers
-    #wx.InitAllImageHandlers()
-
-    #@TODO(anne):add here all dependency checking
-    if not haveRpy2:
-        sys.exit(1)
-
-    app = wx.App()
-    k = KrigingModule(parent=None)
-    k.Centre()
-    k.Show()
-    app.MainLoop()
+    #wx.InitAllImageHandlers()    
     
 if __name__ == '__main__':
     if len(sys.argv) > 1:
-        grass.parser()
+        args = grass.parser()
+        sys.exit(main(argv=args))
     else:
         main()



More information about the grass-commit mailing list