[GRASS-SVN] r47035 - grass-addons/grass7/display/d.mon2

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 7 03:26:29 EDT 2011


Author: martinl
Date: 2011-07-07 00:26:28 -0700 (Thu, 07 Jul 2011)
New Revision: 47035

Added:
   grass-addons/grass7/display/d.mon2/d.mon2.html
   grass-addons/grass7/display/d.mon2/d.mon2.py
Removed:
   grass-addons/grass7/display/d.mon2/d.mon.html
   grass-addons/grass7/display/d.mon2/d.mon.py
Modified:
   grass-addons/grass7/display/d.mon2/Makefile
Log:
d.mon->d.mon2 (step2)


Modified: grass-addons/grass7/display/d.mon2/Makefile
===================================================================
--- grass-addons/grass7/display/d.mon2/Makefile	2011-07-07 07:25:13 UTC (rev 47034)
+++ grass-addons/grass7/display/d.mon2/Makefile	2011-07-07 07:26:28 UTC (rev 47035)
@@ -1,6 +1,6 @@
 MODULE_TOPDIR = ../..
 
-PGM = d.mon
+PGM = d.mon2
 
 include $(MODULE_TOPDIR)/include/Make/Script.make
 

Deleted: grass-addons/grass7/display/d.mon2/d.mon.html
===================================================================
--- grass-addons/grass7/display/d.mon2/d.mon.html	2011-07-07 07:25:13 UTC (rev 47034)
+++ grass-addons/grass7/display/d.mon2/d.mon.html	2011-07-07 07:26:28 UTC (rev 47035)
@@ -1,31 +0,0 @@
-<h2>DESCRIPTION</h2>
-
-This is just a little experiment to see if we can make the ximgview,
-wximgview, and wxpyimgview programs a bit simpler to start up.
-<p>
-
-Add this to your ~/.grass.bashrc file:
-<pre>
-  if [ `echo "$GRASS_VERSION" | cut -f1 -d.` -eq 7 ] ; then
-     alias d.mon='eval `d.mon.py -b`'
-  fi
-</pre>
-
-<p>
-By default the temporary file will be stored in $MAPSET/.tmp/ and cleared
-at the end of the session. You can put it somewhere else with the
-<b>tempfile</b> option. For example, when working remotely with
-PuTTY (ssh without tunnelled X) + Apache:
-<pre>
-   alias d.mon='eval `d.mon.py -b handler=none tempfile=/var/www/grassmap.png`'
-</pre>
-then just hit reload in your web browser whenever a refresh is needed.
-
-
-<h2>AUTHOR</h2>
-Hamish Bowman<br>
-Dunedin, New Zealand
-
-<br>
-<p>
-<i>Last changed: $Date$</i></p>

Deleted: grass-addons/grass7/display/d.mon2/d.mon.py
===================================================================
--- grass-addons/grass7/display/d.mon2/d.mon.py	2011-07-07 07:25:13 UTC (rev 47034)
+++ grass-addons/grass7/display/d.mon2/d.mon.py	2011-07-07 07:26:28 UTC (rev 47035)
@@ -1,143 +0,0 @@
-#!/usr/bin/env python
-############################################################################
-#
-# MODULE:       d.mon(.py)
-# AUTHOR:       M. Hamish Bowman, Dunedin, New Zealand
-# PURPOSE:      Front end wrapper to emulate d.mon from earlier GRASSes
-# COPYRIGHT:    (c) 2011 Hamish Bowman, and 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: Starts a graphics display monitor which can be controlled from the command line.
-#% keywords: display
-#% keywords: CLI
-#%End
-#%Option
-#% key: width
-#% type: integer
-#% description: Width for display monitor if not set by GRASS_WIDTH
-#% answer: 800
-#%End
-#%Option
-#% key: height
-#% type: integer
-#% description: Height for display monitor if not set by GRASS_HEIGHT
-#% answer: 600
-#%End
-#%Option
-#% key: handler
-#% type: string
-#% description: Window program to use
-#% options: ximgview,wximgview,wxpyimgview,qiv,none
-#% answer: wximgview
-#%End
-#%option
-#% key: tempfile
-#% type: string
-#% gisprompt: new_file,file,input
-#% description: Name and location of temp file
-#% required : no
-#%end
-#%option
-#% key: percent
-#% type: integer
-#% description: Percentage of CPU time to use
-#% answer: 10
-#%end
-#%option
-#% key: color
-#% type: string
-#% description: Background color, either a standard GRASS color or R:G:B triplet (separated by colons)
-#% answer: white
-#% gisprompt: old_color,color,color
-#%end
-#%Flag
-#% key: c
-#% description: Use the Cario driver to render images
-#%End
-#%Flag
-#% key: b
-#% description: output Bourne shell code to set up display
-#%End
-#%Flag
-#% key: d
-#% description: output DOS code to set up display
-#%End
-
-import sys
-import os
-from grass.script import core as grass
-
-def main():
-    handler = options['handler']
-
-    if options['tempfile']:
-        img_tmp = options['tempfile']
-        #TODO: add option for GRASS_PNG_COMPRESSION=0,1-9
-    else:
-        img_tmp = grass.tempfile()
-        os.remove(img_tmp)
-        img_tmp += ".bmp"
-
-
-    if flags['b']:
-        print('GRASS_PNGFILE="%s"' % img_tmp)
-        if not os.environ.has_key("GRASS_WIDTH"):
-            print('GRASS_WIDTH=%s' % options['width'])
-        if not os.environ.has_key("GRASS_HEIGHT"):
-           print('GRASS_HEIGHT=%s' % options['height'])
-        if flags['c']:
-            print('GRASS_RENDER_IMMEDIATE=cairo')
-	else:
-	    print('GRASS_RENDER_IMMEDIATE=PNG')
-        print('GRASS_PNG_MAPPED=TRUE')
-        print('GRASS_PNG_READ=TRUE')
-        print('export GRASS_PNGFILE GRASS_WIDTH GRASS_HEIGHT GRASS_RENDER_IMMEDIATE GRASS_PNG_MAPPED GRASS_PNG_READ;')
-
-        print('d.erase color=%s;' % options['color'])
-        if handler == "none":
-            grass.message("Image file is '%s'" % img_tmp)
-        elif handler == "qiv":
-            print('qiv -T "%s" &' % img_tmp)  # add --center ?
-        else:
-            print('%s image="%s" percent=%s &' % ( handler, img_tmp, options['percent']) )
-
-        sys.exit(0)
-
-
-
-    ## rest of this won't work, as parent can't inherit from the child..
-    ##  (unless we do some ugly g.gisenv) 
-    ##  ... any ideas? end by running grass.call(['bash'])?
-    if not grass.find_program(handler, ['--help']):
-        grass.fatal(_("'%s' not found.") % handler)
-
-    os.environ['GRASS_PNGFILE'] = img_tmp
-    if not os.environ.has_key("GRASS_WIDTH"):
-        os.environ['GRASS_WIDTH'] = options['width']
-    if not os.environ.has_key("GRASS_HEIGHT"):
-        os.environ['GRASS_HEIGHT'] = options['height']
-    if flags['c']:
-        os.environ['GRASS_RENDER_IMMEDIATE'] = 'cairo'
-    os.environ['GRASS_PNG_MAPPED'] = 'TRUE'
-    os.environ['GRASS_PNG_READ'] = 'TRUE'
-    #? os.environ['GRASS_PNG_AUTO_WRITE'] = 'FALSE'
-
-    grass.run_command('d.erase', color = options['color'])
-
-    if handler == "qiv":
-        ret = grass.call(['qiv', '-T', img_tmp])
-    else:
-        ret = grass.exec_command(handler, image = img_tmp, percent = options['percent'])
-
-    os.remove(img_tmp)
-    sys.exit(ret)
-
-if __name__ == "__main__":
-    options, flags = grass.parser()
-    main()
-po

Copied: grass-addons/grass7/display/d.mon2/d.mon2.html (from rev 47034, grass-addons/grass7/display/d.mon2/d.mon.html)
===================================================================
--- grass-addons/grass7/display/d.mon2/d.mon2.html	                        (rev 0)
+++ grass-addons/grass7/display/d.mon2/d.mon2.html	2011-07-07 07:26:28 UTC (rev 47035)
@@ -0,0 +1,31 @@
+<h2>DESCRIPTION</h2>
+
+This is just a little experiment to see if we can make the ximgview,
+wximgview, and wxpyimgview programs a bit simpler to start up.
+<p>
+
+Add this to your ~/.grass.bashrc file:
+<pre>
+  if [ `echo "$GRASS_VERSION" | cut -f1 -d.` -eq 7 ] ; then
+     alias d.mon='eval `d.mon.py -b`'
+  fi
+</pre>
+
+<p>
+By default the temporary file will be stored in $MAPSET/.tmp/ and cleared
+at the end of the session. You can put it somewhere else with the
+<b>tempfile</b> option. For example, when working remotely with
+PuTTY (ssh without tunnelled X) + Apache:
+<pre>
+   alias d.mon='eval `d.mon.py -b handler=none tempfile=/var/www/grassmap.png`'
+</pre>
+then just hit reload in your web browser whenever a refresh is needed.
+
+
+<h2>AUTHOR</h2>
+Hamish Bowman<br>
+Dunedin, New Zealand
+
+<br>
+<p>
+<i>Last changed: $Date$</i></p>

Copied: grass-addons/grass7/display/d.mon2/d.mon2.py (from rev 47034, grass-addons/grass7/display/d.mon2/d.mon.py)
===================================================================
--- grass-addons/grass7/display/d.mon2/d.mon2.py	                        (rev 0)
+++ grass-addons/grass7/display/d.mon2/d.mon2.py	2011-07-07 07:26:28 UTC (rev 47035)
@@ -0,0 +1,143 @@
+#!/usr/bin/env python
+############################################################################
+#
+# MODULE:       d.mon(.py)
+# AUTHOR:       M. Hamish Bowman, Dunedin, New Zealand
+# PURPOSE:      Front end wrapper to emulate d.mon from earlier GRASSes
+# COPYRIGHT:    (c) 2011 Hamish Bowman, and 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: Starts a graphics display monitor which can be controlled from the command line.
+#% keywords: display
+#% keywords: CLI
+#%End
+#%Option
+#% key: width
+#% type: integer
+#% description: Width for display monitor if not set by GRASS_WIDTH
+#% answer: 800
+#%End
+#%Option
+#% key: height
+#% type: integer
+#% description: Height for display monitor if not set by GRASS_HEIGHT
+#% answer: 600
+#%End
+#%Option
+#% key: handler
+#% type: string
+#% description: Window program to use
+#% options: ximgview,wximgview,wxpyimgview,qiv,none
+#% answer: wximgview
+#%End
+#%option
+#% key: tempfile
+#% type: string
+#% gisprompt: new_file,file,input
+#% description: Name and location of temp file
+#% required : no
+#%end
+#%option
+#% key: percent
+#% type: integer
+#% description: Percentage of CPU time to use
+#% answer: 10
+#%end
+#%option
+#% key: color
+#% type: string
+#% description: Background color, either a standard GRASS color or R:G:B triplet (separated by colons)
+#% answer: white
+#% gisprompt: old_color,color,color
+#%end
+#%Flag
+#% key: c
+#% description: Use the Cario driver to render images
+#%End
+#%Flag
+#% key: b
+#% description: output Bourne shell code to set up display
+#%End
+#%Flag
+#% key: d
+#% description: output DOS code to set up display
+#%End
+
+import sys
+import os
+from grass.script import core as grass
+
+def main():
+    handler = options['handler']
+
+    if options['tempfile']:
+        img_tmp = options['tempfile']
+        #TODO: add option for GRASS_PNG_COMPRESSION=0,1-9
+    else:
+        img_tmp = grass.tempfile()
+        os.remove(img_tmp)
+        img_tmp += ".bmp"
+
+
+    if flags['b']:
+        print('GRASS_PNGFILE="%s"' % img_tmp)
+        if not os.environ.has_key("GRASS_WIDTH"):
+            print('GRASS_WIDTH=%s' % options['width'])
+        if not os.environ.has_key("GRASS_HEIGHT"):
+           print('GRASS_HEIGHT=%s' % options['height'])
+        if flags['c']:
+            print('GRASS_RENDER_IMMEDIATE=cairo')
+	else:
+	    print('GRASS_RENDER_IMMEDIATE=PNG')
+        print('GRASS_PNG_MAPPED=TRUE')
+        print('GRASS_PNG_READ=TRUE')
+        print('export GRASS_PNGFILE GRASS_WIDTH GRASS_HEIGHT GRASS_RENDER_IMMEDIATE GRASS_PNG_MAPPED GRASS_PNG_READ;')
+
+        print('d.erase color=%s;' % options['color'])
+        if handler == "none":
+            grass.message("Image file is '%s'" % img_tmp)
+        elif handler == "qiv":
+            print('qiv -T "%s" &' % img_tmp)  # add --center ?
+        else:
+            print('%s image="%s" percent=%s &' % ( handler, img_tmp, options['percent']) )
+
+        sys.exit(0)
+
+
+
+    ## rest of this won't work, as parent can't inherit from the child..
+    ##  (unless we do some ugly g.gisenv) 
+    ##  ... any ideas? end by running grass.call(['bash'])?
+    if not grass.find_program(handler, ['--help']):
+        grass.fatal(_("'%s' not found.") % handler)
+
+    os.environ['GRASS_PNGFILE'] = img_tmp
+    if not os.environ.has_key("GRASS_WIDTH"):
+        os.environ['GRASS_WIDTH'] = options['width']
+    if not os.environ.has_key("GRASS_HEIGHT"):
+        os.environ['GRASS_HEIGHT'] = options['height']
+    if flags['c']:
+        os.environ['GRASS_RENDER_IMMEDIATE'] = 'cairo'
+    os.environ['GRASS_PNG_MAPPED'] = 'TRUE'
+    os.environ['GRASS_PNG_READ'] = 'TRUE'
+    #? os.environ['GRASS_PNG_AUTO_WRITE'] = 'FALSE'
+
+    grass.run_command('d.erase', color = options['color'])
+
+    if handler == "qiv":
+        ret = grass.call(['qiv', '-T', img_tmp])
+    else:
+        ret = grass.exec_command(handler, image = img_tmp, percent = options['percent'])
+
+    os.remove(img_tmp)
+    sys.exit(ret)
+
+if __name__ == "__main__":
+    options, flags = grass.parser()
+    main()
+po



More information about the grass-commit mailing list