Selaa lähdekoodia

Replace script.core.gisenv with pygrass.gis.Mapset

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@54786 15284696-431f-4ddb-bdfa-cd5b030d7da7
Pietro Zambelli 12 vuotta sitten
vanhempi
commit
c20380343d
2 muutettua tiedostoa jossa 6 lisäystä ja 8 poistoa
  1. 1 3
      lib/python/pygrass/vector/__init__.py
  2. 5 5
      lib/python/pygrass/vector/table.py

+ 1 - 3
lib/python/pygrass/vector/__init__.py

@@ -18,8 +18,6 @@ import geometry
 from abstract import Info
 from basic import Bbox
 
-import grass.script.core as core
-_GRASSENV = core.gisenv()
 
 _NUMOF = {"areas": libvect.Vect_get_num_areas,
           "dblinks": libvect.Vect_get_num_dblinks,
@@ -68,7 +66,7 @@ class Vector(Info):
         False
 
     ..
-    """ % _GRASSENV['MAPSET']
+    """
     def __init__(self, name, mapset=''):
         # Set map name and mapset
         super(Vector, self).__init__(name, mapset)

+ 5 - 5
lib/python/pygrass/vector/table.py

@@ -15,7 +15,7 @@ except:
     from pygrass.orderdict import OrderedDict
 
 import grass.lib.vector as libvect
-import grass.script.core as core
+from pygrass.gis import Mapset
 
 import sql
 
@@ -35,10 +35,10 @@ def get_path(path):
     if "$" not in path:
         return path
     else:
-        grassenv = core.gisenv()
-        path = path.replace('$GISDBASE', grassenv['GISDBASE'])
-        path = path.replace('$LOCATION_NAME', grassenv['LOCATION_NAME'])
-        path = path.replace('$MAPSET', grassenv['MAPSET'])
+        mapset = Mapset()
+        path = path.replace('$GISDBASE', mapset.gisdbase)
+        path = path.replace('$LOCATION_NAME', mapset.location)
+        path = path.replace('$MAPSET', mapset.name)
         return path