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-2014 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)
49 wx.InitAllImageHandlers()
50 if __name__ ==
"__main__":
52 self.
Map =
Map(cmdfile = monFile[
'cmd'], mapfile = monFile[
'map'],
53 envfile = monFile[
'env'], monitor = monName)
57 self.
mapFrm = MapFrame(parent =
None, id = wx.ID_ANY, Map = self.
Map,
62 if __name__ ==
"__main__":
67 self.timer.Start(mtime)
72 if __name__ ==
"__main__":
76 for f
in monFile.itervalues():
80 """!Redraw, if new layer appears (check's timestamp of
87 self.mapFrm.OnDraw(
None)
88 self.mapFrm.GetMap().GetLayersFromCmdFile()
89 self.timer.Start(mtime)
91 if __name__ ==
"__main__":
98 monFile = {
'map' : sys.argv[2],
102 if len(sys.argv) >= 6:
104 monSize[0] = int(sys.argv[5])
108 if len(sys.argv) == 7:
110 monSize[1] = int(sys.argv[6])
115 gettext.install(
'grasswxpy', os.path.join(os.getenv(
"GISBASE"),
'locale'), unicode =
True)
117 grass.verbose(_(
"Starting map display <%s>...") % (monName))
120 set =
'MONITOR_%s_PID=%d' % (monName, os.getpid()))
124 gmMap.mapFrm.SetTitle(_(
"GRASS GIS %(version)s Map Display: %(name)s - Location: %(location)s") % \
125 {
'version' : grass.version()[
'version'],
127 'location' : grass.gisenv()[
"LOCATION_NAME"] })
131 grass.verbose(_(
"Stopping map display <%s>...") % (monName))
135 env_name =
'MONITOR_%s' % monName
136 for key
in env.keys():
137 if key.find(env_name) == 0:
140 if key ==
'MONITOR' and env[key] == monName:
Map display with toolbar for various display management functions, and additional toolbars (vector di...
Rendering map layers and overlays into map composition image.
def CheckWxVersion(version=[2)
Check wx version.
def watcher(self)
Redraw, if new layer appears (check's timestamp of cmdfile)
def RunCommand(prog, flags="", overwrite=False, quiet=False, verbose=False, parent=None, read=False, stdin=None, getErrorMsg=False, kwargs)
Run GRASS command.