4 @brief Start Map Display as standalone application
10 python mapdisp/main.py monitor-identifier /path/to/map/file /path/to/command/file /path/to/env/file
12 (C) 2006-2011 by the GRASS Development Team
14 This program is free software under the GNU General Public License
15 (>=v2). Read the file COPYING that comes with GRASS for details.
17 @author Michael Barton
18 @author Jachym Cepicky
19 @author Martin Landa <landa.martin gmail.com>
20 @author Vaclav Petras <wenzeslaus gmail.com> (MapFrameBase)
21 @author Anna Kratochvilova <kratochanna gmail.com> (MapFrameBase)
27 if __name__ ==
"__main__":
28 sys.path.append(os.path.join(os.getenv(
'GISBASE'),
'etc',
'gui',
'wxpython'))
29 from core
import globalvar
38 monFile = {
'cmd' :
None,
43 monSize = list(globalvar.MAP_WINDOW_SIZE)
48 wx.InitAllImageHandlers()
49 if __name__ ==
"__main__":
51 self.
Map =
Map(cmdfile = monFile[
'cmd'], mapfile = monFile[
'map'],
52 envfile = monFile[
'env'], monitor = monName)
56 self.
mapFrm = MapFrame(parent =
None, id = wx.ID_ANY, Map = self.
Map,
61 if __name__ ==
"__main__":
66 self.timer.Start(mtime)
71 if __name__ ==
"__main__":
75 for f
in monFile.itervalues():
79 """!Redraw, if new layer appears (check's timestamp of
86 self.mapFrm.OnDraw(
None)
87 self.mapFrm.GetMap().GetLayersFromCmdFile()
88 self.timer.Start(mtime)
90 if __name__ ==
"__main__":
97 monFile = {
'map' : sys.argv[2],
101 if len(sys.argv) >= 6:
103 monSize[0] = int(sys.argv[5])
107 if len(sys.argv) == 7:
109 monSize[1] = int(sys.argv[6])
114 gettext.install(
'grasswxpy', os.path.join(os.getenv(
"GISBASE"),
'locale'), unicode =
True)
116 grass.verbose(_(
"Starting map display <%s>...") % (monName))
119 set =
'MONITOR_%s_PID=%d' % (monName, os.getpid()))
123 gmMap.mapFrm.SetTitle(_(
"GRASS GIS Map Display: " +
125 " - Location: " + grass.gisenv()[
"LOCATION_NAME"]))
129 grass.verbose(_(
"Stopping map display <%s>...") % (monName))
133 env_name =
'MONITOR_%s' % monName
134 for key
in env.keys():
135 if key.find(env_name) == 0:
138 if key ==
'MONITOR' and env[key] == monName: