""" @package mapdisp.py @brief Command line useg of GIS map display canvas.view). Classes: - Command (C) 2006-2009 by the GRASS Development Team This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details. @author Jachym Cepicky """ import sys import time from threading import Thread class Command(Thread): """ Creates thread which will observe the command file and see, if there is new command to be executed """ def __init__ (self, parent, Map, cmdfile): Thread.__init__(self) global cmdfilename self.parent = parent self.map = Map self.cmdfile = open(cmdfile, "r") def run(self): """ Run this in thread """ dispcmd = [] while 1: self.parent.redraw = False line = self.cmdfile.readline().strip() if line == "quit": break if line: try: Debug.msg (3, "Command.run(): cmd=%s" % (line)) self.map.AddLayer(item=None, type="raster", name='', command=line, l_opacity=1) self.parent.redraw =True except Exception, e: print "Command Thread: ",e time.sleep(0.1) sys.exit()