[GRASS-SVN] r53775 - grass/trunk/lib/python/pygrass/modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Nov 12 07:26:50 PST 2012
Author: zarch
Date: 2012-11-12 07:26:50 -0800 (Mon, 12 Nov 2012)
New Revision: 53775
Modified:
grass/trunk/lib/python/pygrass/modules/__init__.py
Log:
Add modules shortcuts for pygrass
Modified: grass/trunk/lib/python/pygrass/modules/__init__.py
===================================================================
--- grass/trunk/lib/python/pygrass/modules/__init__.py 2012-11-12 15:26:41 UTC (rev 53774)
+++ grass/trunk/lib/python/pygrass/modules/__init__.py 2012-11-12 15:26:50 UTC (rev 53775)
@@ -506,4 +506,38 @@
stderr=self.stderr_)
if self.finish_:
self.popen.wait()
- self.stdout, self.stderr = self.popen.communicate()
\ No newline at end of file
+ self.stdout, self.stderr = self.popen.communicate()
+
+
+class MetaModule(object):
+ def __init__(self, prefix):
+ self.prefix = prefix
+
+ def __getattr__(self, name):
+ return Module('%s.%s' % (self.prefix, name.replace('_', '.')))
+
+
+# http://grass.osgeo.org/grass70/manuals/html70_user/full_index.html
+#[ d.* | db.* | g.* | i.* | m.* | ps.* | r.* | r3.* | t.* | v.* ]
+#
+# d.* display commands
+# db.* database commands
+# g.* general commands
+# i.* imagery commands
+# m.* miscellaneous commands
+# ps.* postscript commands
+# r.* raster commands
+# r3.* raster3D commands
+# t.* temporal commands
+# v.* vector commands
+
+display = MetaModule('d')
+database = MetaModule('db')
+general = MetaModule('g')
+imagery = MetaModule('i')
+miscellaneous = MetaModule('m')
+postscript = MetaModule('ps')
+raster = MetaModule('r')
+raster3D = MetaModule('r3')
+temporal = MetaModule('t')
+vector = MetaModule('v')
\ No newline at end of file
More information about the grass-commit
mailing list