[GRASS-SVN] r61629 - in grass-addons/grass7/gui/wxpython/wx.metadata: mdlib r.info.iso v.info.iso

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Aug 14 08:16:17 PDT 2014


Author: krejcmat
Date: 2014-08-14 08:16:17 -0700 (Thu, 14 Aug 2014)
New Revision: 61629

Modified:
   grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/mdgrass.py
   grass-addons/grass7/gui/wxpython/wx.metadata/r.info.iso/r.info.iso.py
   grass-addons/grass7/gui/wxpython/wx.metadata/v.info.iso/v.info.iso.py
Log:
insert path, output changes

Modified: grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/mdgrass.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/mdgrass.py	2014-08-14 14:20:55 UTC (rev 61628)
+++ grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/mdgrass.py	2014-08-14 15:16:17 UTC (rev 61629)
@@ -27,7 +27,6 @@
 import uuid
 import mdutil  # metadata lib
 import getpass  # whoami for linux and  ms-win
-sys.path.insert(1, os.path.join(os.path.dirname(sys.path[0]), 'etc', 'wx.metadata'))
 
 from grass.pygrass.modules.shortcuts import general as g
 from grass.pygrass.gis import Mapset
@@ -169,7 +168,8 @@
         n = '$NULL'
         # jinja templates
         if template is None:
-            self.template = os.path.join('templates', 'basicTemplate.xml')
+            parentDir=os.path.abspath(os.path.join(os.getcwd(), os.path.pardir))
+            self.template = os.path.join(parentDir,'templates', 'basicTemplate.xml')
         else:
             self.template = template
 
@@ -272,7 +272,8 @@
         self.createGrassBasicISO()
 
         if template is None:
-            self.template = os.path.join('templates', 'inspireTemplate.xml')
+            parentDir=os.path.abspath(os.path.join(os.getcwd(), os.path.pardir))
+            self.template = os.path.join(parentDir,'templates', 'inspireTemplate.xml')
         else:
             self.template = template
 

Modified: grass-addons/grass7/gui/wxpython/wx.metadata/r.info.iso/r.info.iso.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.metadata/r.info.iso/r.info.iso.py	2014-08-14 14:20:55 UTC (rev 61628)
+++ grass-addons/grass7/gui/wxpython/wx.metadata/r.info.iso/r.info.iso.py	2014-08-14 15:16:17 UTC (rev 61629)
@@ -2,7 +2,7 @@
 # -*- coding: utf-8
 """
 @module  r.info.iso
- at brief   Module for creating metadata based on ISO from raster maps
+ at brief   Module for creating metadata based on ISO for raster maps
 
 (C) 2014 by the GRASS Development Team
 This program is free software under the GNU General Public License
@@ -20,19 +20,19 @@
 #%end
 
 #%option
-#% key: profil
-#% label: Metadata profil based on ISO
+#% key: profile
+#% label: Metadata profile based on ISO
 #% description: INSPIRE profile is not filled properly (unknown values are filled with '$NULL')
 #% options: basic, inspire
 #% answer: basic
 #%end
 
 #%option G_OPT_F_OUTPUT
-#% key: output
-#% label: File output 
+#% key: out
 #% required: no
 #%end
 
+
 import os
 import sys
 sys.path.insert(1, os.path.join(os.path.dirname(sys.path[0]), 'etc', 'wx.metadata'))
@@ -40,24 +40,20 @@
 from grass.script import parser
 from mdgrass import *
 
-
 def main():
-    if not options['destination']:
+    if not options['out']:
         destination = None
+        name = None
     else:
-        destination = options['destination']
+        destination, name = os.path.split(options['out'])
 
-    if not options['mdout']:
-        mdout = None
-    else:
-        mdout = options['mdout']
-
     md = GrassMD(options['map'], 'cell')
-    if options['profil'] == 'inspire':
+    if options['profile'] == 'inspire':
         md.createGrassInspireISO()
         xml_file = md.saveXML(path=destination,
-                              xml_out_name=mdout,
+                              xml_out_name=name,
                               overwrite=os.getenv('GRASS_OVERWRITE', False))
+        
         if xml_file is not False:
             md.readXML(xml_file)
             print md.validate_inspire()
@@ -65,8 +61,9 @@
     else:
         md.createGrassBasicISO()
         xml_file = md.saveXML(path=destination,
-                              xml_out_name=mdout,
+                              xml_out_name=name,
                               overwrite=os.getenv('GRASS_OVERWRITE', False))
+        
         if xml_file is not False:
             md.readXML(xml_file)
             print md.validate_basic()

Modified: grass-addons/grass7/gui/wxpython/wx.metadata/v.info.iso/v.info.iso.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.metadata/v.info.iso/v.info.iso.py	2014-08-14 14:20:55 UTC (rev 61628)
+++ grass-addons/grass7/gui/wxpython/wx.metadata/v.info.iso/v.info.iso.py	2014-08-14 15:16:17 UTC (rev 61629)
@@ -2,7 +2,7 @@
 # -*- coding: utf-8
 """
 @module  v.info.iso
- at brief   Module for creating metadata based on ISO from vector maps
+ at brief   Module for creating metadata based on ISO for vector maps
 
 (C) 2014 by the GRASS Development Team
 This program is free software under the GNU General Public License
@@ -20,20 +20,18 @@
 #%end
 
 #%option
-#% key: profil
-#% label: Metadata profil based on ISO
+#% key: profile
+#% label: Metadata profile based on ISO
 #% description: INSPIRE profile is not filled properly (unknown values are filled with '$NULL')
 #% options: basic, inspire
 #% answer: basic
 #%end
 
 #%option G_OPT_F_OUTPUT
-#% key: output
-#% label: File output 
+#% key: out
 #% required: no
 #%end
 
-
 import os
 import sys
 sys.path.insert(1, os.path.join(os.path.dirname(sys.path[0]), 'etc', 'wx.metadata'))
@@ -41,24 +39,20 @@
 from grass.script import parser
 from mdgrass import *
 
-
 def main():
-    if not options['destination']:
+    if not options['out']:
         destination = None
+        name = None
     else:
-        destination = options['destination']
+        destination, name = os.path.split(options['out'])
 
-    if not options['mdout']:
-        mdout = None
-    else:
-        mdout = options['mdout']
-
     md = GrassMD(options['map'], 'vector')
-    if options['profil'] == 'inspire':
+    if options['profile'] == 'inspire':
         md.createGrassInspireISO()
         xml_file = md.saveXML(path=destination,
-                              xml_out_name=mdout,
+                              xml_out_name=name,
                               overwrite=os.getenv('GRASS_OVERWRITE', False))
+        
         if xml_file is not False:
             md.readXML(xml_file)
             print md.validate_inspire()
@@ -66,8 +60,9 @@
     else:
         md.createGrassBasicISO()
         xml_file = md.saveXML(path=destination,
-                              xml_out_name=mdout,
+                              xml_out_name=name,
                               overwrite=os.getenv('GRASS_OVERWRITE', False))
+        
         if xml_file is not False:
             md.readXML(xml_file)
             print md.validate_basic()



More information about the grass-commit mailing list