3
############################################################################
6
# AUTHOR(S): Anna Petrasova <kratochanna gmail.com>
7
# PURPOSE: Script for exporting content of monitor to graphic file
8
# COPYRIGHT: (C) 2014 by the GRASS Development Team
10
# This program is free software under the GNU General
11
# Public License (>=v2). Read the file COPYING that
12
# comes with GRASS for details.
14
#############################################################################
17
#% description: Saves the contents of the active display monitor to a graphics file.
21
#%option G_OPT_F_OUTPUT
22
#% description: Name for output file
27
#% description: Graphics file format
29
#% options: png,jpg,bmp,gif,tif
35
#% key_desc: width,height
36
#% description: Width and height of output image
41
from grass.script import core as gcore
45
options, flags = gcore.parser()
46
gisenv = gcore.gisenv()
47
if 'MONITOR' in gisenv:
48
cmd_file = gisenv['MONITOR_{monitor}_CMDFILE'.format(monitor=gisenv['MONITOR'].upper())]
49
dout_cmd = 'd.out.file'
50
for param, val in options.iteritems():
52
dout_cmd += " {param}={val}".format(param=param, val=val)
53
with open(cmd_file, "a") as file_:
56
gcore.fatal(_("No graphics device selected. Use d.mon to select graphics device."))
59
if __name__ == "__main__":