GRASS Programmer's Manual  6.4.2(2012)
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
p.mon.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 ############################################################################
3 #
4 # MODULE: p.mon
5 # AUTHOR(S): Jachym Cepicky, Michael Barton, Martin Landa, Markus Neteler,
6 # Hamish Bowman
7 # Converted to Python by Huidae Cho
8 # PURPOSE: To establish and control use of a graphics display monitor.
9 # COPYRIGHT: (C) 2009 by The GRASS Development Team
10 #
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
15 #
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
20 #
21 ############################################################################
22 
23 #%Module
24 #% description: To establish and control use of a graphics display monitor.
25 #% keywords: display
26 #%End
27 
28 ##%Flag
29 ##% key: l
30 ##% description: List all monitors
31 ##%End
32 
33 ##%Flag
34 ##% key: L
35 ##% description: List all monitors (with current status)
36 ##%End
37 
38 ##%Flag
39 ##% key: p
40 ##% description: Print name of currently selected monitor
41 ##%End
42 
43 ##%Flag
44 ##% key: r
45 ##% description: Release currently selected monitor
46 ##%End
47 
48 ##%Flag
49 ##% key: s
50 ##% description: Do not automatically select when starting
51 ##%End
52 
53 #%Option
54 #% key: start
55 #% type: string
56 #% required: no
57 #% multiple: no
58 #% description: Name of graphics monitor to start (p0-p9)
59 #%End
60 
61 ##%Option
62 ##% key: stop
63 ##% type: string
64 ##% required: no
65 ##% multiple: no
66 ##% description: Name of graphics monitor to stop
67 ##%End
68 
69 ##%Option
70 ##% key: select
71 ##% type: string
72 ##% required: no
73 ##% multiple: no
74 ##% description: Name of graphics monitor to select
75 ##%End
76 
77 ##%Option
78 ##% key: unlock
79 ##% type: string
80 ##% required: no
81 ##% multiple: no
82 ##% description: Name of graphics monitor to unlock
83 ##%End
84 
85 import os
86 import grass.script as grass
87 
88 def main():
89  start = options["start"]
90 # select = options["select"]
91 # stop = options["stop"]
92 # unlock = options["unlock"]
93 
94  # create the command file
95  command_file = grass.tempfile()
96  os.system("g.gisenv set=GRASS_PYCMDFILE=%s" % command_file)
97 
98  if start != "":
99  os.spawnlp(os.P_NOWAIT, os.environ["GRASS_PYTHON"], os.environ["GRASS_PYTHON"], "%s/etc/wxpython/gui_modules/mapdisp.py" % os.environ["GISBASE"], start, command_file)
100  return
101 
102 # if stop != "" or select != "" or unlock != "":
103 # grass.message(_("Not implemented yet"), "w")
104 
105 if __name__ == "__main__":
106  options, flags = grass.parser()
107  main()