GRASS Programmer's Manual  6.4.2(2012)
p.mon.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 ############################################################################
00003 #
00004 # MODULE:       p.mon
00005 # AUTHOR(S):    Jachym Cepicky, Michael Barton, Martin Landa, Markus Neteler,
00006 #               Hamish Bowman
00007 #               Converted to Python by Huidae Cho
00008 # PURPOSE:      To establish and control use of a graphics display monitor.
00009 # COPYRIGHT:    (C) 2009 by The GRASS Development Team
00010 #
00011 #  This program is free software; you can redistribute it and/or modify
00012 #  it under the terms of the GNU General Public License as published by
00013 #  the Free Software Foundation; either version 2 of the License, or
00014 #  (at your option) any later version.
00015 #
00016 #  This program is distributed in the hope that it will be useful,
00017 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019 #  GNU General Public License for more details.
00020 #
00021 ############################################################################
00022 
00023 #%Module
00024 #% description: To establish and control use of a graphics display monitor.
00025 #% keywords: display
00026 #%End
00027 
00028 ##%Flag
00029 ##% key: l
00030 ##% description: List all monitors
00031 ##%End
00032 
00033 ##%Flag
00034 ##% key: L
00035 ##% description: List all monitors (with current status)
00036 ##%End
00037 
00038 ##%Flag
00039 ##% key: p
00040 ##% description: Print name of currently selected monitor
00041 ##%End
00042 
00043 ##%Flag
00044 ##% key: r
00045 ##% description: Release currently selected monitor
00046 ##%End
00047 
00048 ##%Flag
00049 ##% key: s
00050 ##% description: Do not automatically select when starting
00051 ##%End
00052 
00053 #%Option
00054 #% key: start
00055 #% type: string
00056 #% required: no
00057 #% multiple: no
00058 #% description: Name of graphics monitor to start (p0-p9)
00059 #%End
00060 
00061 ##%Option
00062 ##% key: stop
00063 ##% type: string
00064 ##% required: no
00065 ##% multiple: no
00066 ##% description: Name of graphics monitor to stop
00067 ##%End
00068 
00069 ##%Option
00070 ##% key: select
00071 ##% type: string
00072 ##% required: no
00073 ##% multiple: no
00074 ##% description: Name of graphics monitor to select
00075 ##%End
00076 
00077 ##%Option
00078 ##% key: unlock
00079 ##% type: string
00080 ##% required: no
00081 ##% multiple: no
00082 ##% description: Name of graphics monitor to unlock
00083 ##%End
00084 
00085 import os
00086 import grass.script as grass
00087 
00088 def main():
00089     start = options["start"]
00090 #    select = options["select"]
00091 #    stop = options["stop"]
00092 #    unlock = options["unlock"]
00093 
00094     # create the command file
00095     command_file = grass.tempfile()
00096     os.system("g.gisenv set=GRASS_PYCMDFILE=%s" % command_file)
00097 
00098     if start != "":
00099         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)
00100         return
00101 
00102 #    if stop != "" or select != "" or unlock != "":
00103 #        grass.message(_("Not implemented yet"), "w")
00104 
00105 if __name__ == "__main__":
00106     options, flags = grass.parser()
00107     main()
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines