[GRASS-SVN] r47077 - in grass/trunk: display/d.erase display/d.mon scripts scripts/d.redraw

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jul 9 13:01:15 EDT 2011


Author: martinl
Date: 2011-07-09 10:01:15 -0700 (Sat, 09 Jul 2011)
New Revision: 47077

Added:
   grass/trunk/scripts/d.redraw/
   grass/trunk/scripts/d.redraw/Makefile
   grass/trunk/scripts/d.redraw/d.redraw.html
   grass/trunk/scripts/d.redraw/d.redraw.py
Modified:
   grass/trunk/display/d.erase/d.erase.html
   grass/trunk/display/d.mon/d.mon.html
Log:
d.redraw: new module


Modified: grass/trunk/display/d.erase/d.erase.html
===================================================================
--- grass/trunk/display/d.erase/d.erase.html	2011-07-09 16:28:02 UTC (rev 47076)
+++ grass/trunk/display/d.erase/d.erase.html	2011-07-09 17:01:15 UTC (rev 47077)
@@ -1,17 +1,22 @@
 <h2>DESCRIPTION</h2>
 
-<em>d.erase</em> erases the contents of the active graphics frame, and replaces it with 
-the color black (by default) or by whatever color is specified by the user. 
-<em>d.erase</em> will not alter the assignment of the active frame. 
+<em>d.erase</em> erases the contents of the active graphics frame, and
+replaces it with the color black (by default) or by whatever color is
+specified by the user.
 
 <h2>SEE ALSO</h2>
 
-<em><a HREF="d.mon.html">d.mon</a></em>
+<em>
+  <a href="d.mon.html">d.mon</a>,
+  <a href="d.redraw.html">d.redraw</a>,
+  <a href="d.rast.html">d.rast</a>,
+  <a href="d.vect.html">d.vect</a>
+</em>
 
 <h2>AUTHOR</h2>
 
-James Westervelt, U.S. Army Construction Engineering 
-Research Laboratory
+James Westervelt, U.S. Army Construction Engineering Research
+Laboratory
 
-
-<p><i>Last changed: $Date$</i>
+<p>
+<i>Last changed: $Date$</i>

Modified: grass/trunk/display/d.mon/d.mon.html
===================================================================
--- grass/trunk/display/d.mon/d.mon.html	2011-07-09 16:28:02 UTC (rev 47076)
+++ grass/trunk/display/d.mon/d.mon.html	2011-07-09 17:01:15 UTC (rev 47077)
@@ -102,8 +102,10 @@
 <h2>SEE ALSO</h2>
 
 <em>
+  <a href="d.erase.html">d.erase</a>,
+  <a href="d.redraw.html">d.redraw</a>,
   <a href="d.rast.html">d.rast</a>,
-  <a href="d.vect.html">d.vect</a>,
+  <a href="d.vect.html">d.vect</a>
 </em>
 
 <p>

Added: grass/trunk/scripts/d.redraw/Makefile
===================================================================
--- grass/trunk/scripts/d.redraw/Makefile	                        (rev 0)
+++ grass/trunk/scripts/d.redraw/Makefile	2011-07-09 17:01:15 UTC (rev 47077)
@@ -0,0 +1,7 @@
+MODULE_TOPDIR = ../..
+
+PGM = d.redraw
+
+include $(MODULE_TOPDIR)/include/Make/Script.make
+
+default: script


Property changes on: grass/trunk/scripts/d.redraw/Makefile
___________________________________________________________________
Added: svn:mime-type
   + text/x-makefile
Added: svn:eol-style
   + native

Added: grass/trunk/scripts/d.redraw/d.redraw.html
===================================================================
--- grass/trunk/scripts/d.redraw/d.redraw.html	                        (rev 0)
+++ grass/trunk/scripts/d.redraw/d.redraw.html	2011-07-09 17:01:15 UTC (rev 47077)
@@ -0,0 +1,21 @@
+<h2>DESCRIPTION</h2>
+
+<em>d.redraw</em> redraws the content of currently selected
+monitor. Active monitor can be selected
+by <em><a href="d.mon.html">d.mon</a></em>.
+
+<h2>SEE ALSO</h2>
+ 
+<em>
+  <a href="d.erase.html">d.erase</a>,
+  <a href="d.rast.html">d.rast</a>,
+  <a href="d.vect.html">d.vect</a>,
+  <a href="d.mon.html">d.mon</a>
+</em>
+
+<h2>AUTHOR</h2>
+
+Martin Landa, Czech Republic
+
+<p>
+<i>Last changed: $Date$</i>


Property changes on: grass/trunk/scripts/d.redraw/d.redraw.html
___________________________________________________________________
Added: svn:mime-type
   + text/html
Added: svn:keywords
   + Author Date Id
Added: svn:eol-style
   + native

Added: grass/trunk/scripts/d.redraw/d.redraw.py
===================================================================
--- grass/trunk/scripts/d.redraw/d.redraw.py	                        (rev 0)
+++ grass/trunk/scripts/d.redraw/d.redraw.py	2011-07-09 17:01:15 UTC (rev 47077)
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+############################################################################
+#
+# MODULE:	d.redraw
+# AUTHOR(S):	Martin Landa <landa.martin gmail.com>
+# PURPOSE:	Redraws the content of currently selected monitor
+# COPYRIGHT:	(C) 2011 by the GRASS Development Team
+#
+#		This program is free software under the GNU General
+#		Public License (>=v2). Read the file COPYING that
+#		comes with GRASS for details.
+#
+#############################################################################
+
+#%module
+#% description: Redraws the content of currently selected monitor.
+#% keywords: display
+#% keywords: graphics
+#% keywords: monitors
+#% keywords: CLI
+#%end
+
+import sys
+import shlex
+
+from grass.script import core as grass
+
+def split(s):
+    """!Platform spefic shlex.split"""
+    if sys.version_info >= (2, 6):
+        return shlex.split(s, posix = (sys.platform != "win32"))
+    elif sys.platform == "win32":
+        return shlex.split(s.replace('\\', r'\\'))
+    else:
+        return shlex.split(s)
+
+def main():
+    env = grass.gisenv()
+    mon = env.get('MONITOR', None)
+    if not mon:
+        grass.fatal(_("No monitor selected. Run `d.mon` to select monitor."))
+    
+    monCmd = env.get('MONITOR_%s_CMDFILE' % mon)
+    if not monCmd:
+        grass.fatal(_("No cmd file found for monitor <%s>") % mon)
+
+    try:
+        fd = open(monCmd, 'r')
+        cmdList = fd.readlines()
+        
+        grass.run_command('d.erase')
+        
+        for cmd in cmdList:
+            grass.call(split(cmd))
+    except IOError, e:
+        grass.fatal(_("Unable to open file '%s' for reading. Details: %s") % \
+                        (monCmd, e))
+    
+    fd.close()
+    
+    # restore cmd file
+    try:
+        fd = open(monCmd, "w")
+        fd.writelines(cmdList)
+    except IOError, e:
+        grass.fatal(_("Unable to open file '%s' for writing. Details: %s") % \
+                        (monCmd, e))
+    
+    return 0
+
+if __name__ == "__main__":
+    options, flags = grass.parser()
+    sys.exit(main())


Property changes on: grass/trunk/scripts/d.redraw/d.redraw.py
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:mime-type
   + text/x-python
Added: svn:eol-style
   + native



More information about the grass-commit mailing list