[GRASS-SVN] r42151 - grass/branches/develbranch_6/lib/python
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat May 8 07:38:06 EDT 2010
Author: martinl
Date: 2010-05-08 07:38:06 -0400 (Sat, 08 May 2010)
New Revision: 42151
Modified:
grass/branches/develbranch_6/lib/python/core.py
Log:
pythonlib: implement percent() as wrapper for g.message -p
(merge r42148 from trunk)
Modified: grass/branches/develbranch_6/lib/python/core.py
===================================================================
--- grass/branches/develbranch_6/lib/python/core.py 2010-05-08 11:34:28 UTC (rev 42150)
+++ grass/branches/develbranch_6/lib/python/core.py 2010-05-08 11:38:06 UTC (rev 42151)
@@ -311,6 +311,25 @@
"""
message(msg, flag = 'i')
+def percent(i, n, s):
+ """!Display a progress info message using g.message -p
+
+ @code
+ message(_("Percent complete..."))
+ n = 100
+ for i in range(n):
+ percent(i, n, 1)
+ percent(1, 1, 1)
+ @endcode
+
+ @param i current item
+ @param n total number of items
+ @param s increment size
+
+ @return g.message's exit code
+ """
+ message("%d %d %d" % (i, n, s), flag = 'p')
+
def warning(msg):
"""!Display a warning message using g.message -w
More information about the grass-commit
mailing list