[GRASS-SVN] r35167 - in grass/trunk/gui/wxpython: . gui_modules xml
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jan 2 16:17:38 EST 2009
Author: martinl
Date: 2009-01-02 16:17:38 -0500 (Fri, 02 Jan 2009)
New Revision: 35167
Modified:
grass/trunk/gui/wxpython/gui_modules/colorrules.py
grass/trunk/gui/wxpython/gui_modules/dbm.py
grass/trunk/gui/wxpython/gui_modules/debug.py
grass/trunk/gui/wxpython/gui_modules/gcmd.py
grass/trunk/gui/wxpython/gui_modules/gdialogs.py
grass/trunk/gui/wxpython/gui_modules/georect.py
grass/trunk/gui/wxpython/gui_modules/gselect.py
grass/trunk/gui/wxpython/gui_modules/location_wizard.py
grass/trunk/gui/wxpython/gui_modules/mapdisp.py
grass/trunk/gui/wxpython/gui_modules/mcalc_builder.py
grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
grass/trunk/gui/wxpython/gui_modules/preferences.py
grass/trunk/gui/wxpython/gui_modules/profile.py
grass/trunk/gui/wxpython/gui_modules/render.py
grass/trunk/gui/wxpython/gui_modules/rules.py
grass/trunk/gui/wxpython/gui_modules/sqlbuilder.py
grass/trunk/gui/wxpython/gui_modules/utils.py
grass/trunk/gui/wxpython/gui_modules/vdigit.py
grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
grass/trunk/gui/wxpython/wxgui.py
grass/trunk/gui/wxpython/xml/menudata.xml
Log:
wxGUI: use grass.run_command() instead of gcmd.Command(), remove OnXTerm
Modified: grass/trunk/gui/wxpython/gui_modules/colorrules.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/colorrules.py 2009-01-02 16:17:20 UTC (rev 35166)
+++ grass/trunk/gui/wxpython/gui_modules/colorrules.py 2009-01-02 21:17:38 UTC (rev 35167)
@@ -367,19 +367,19 @@
return
if self.elem == 'cell':
- cmdlist = ['r.info',
- '-r',
- 'map=%s' % self.inmap]
+ info = gcmd.RunCommand('r.info',
+ parent = self,
+ read = True,
+ flags = 'r',
+ map = self.inmap)
- try:
- p = gcmd.Command(cmdlist)
-
- for line in p.ReadStdOutput():
+ if info:
+ for line in info.split('\n'):
if 'min' in line:
self.rast['min'] = float(line.split('=')[1])
elif 'max' in line:
self.rast['max'] = float(line.split('=')[1])
- except gcmd.CmdError:
+ else:
self.inmap = ''
self.rast['min'] = self.rast['max'] = None
self.btnPreview.Enable(False)
@@ -556,16 +556,18 @@
shutil.copyfile(colrtemp, old_colrtable)
os.remove(colrtemp)
else:
- gcmd.Command(['r.colors',
- '-r',
- 'map=%s' % self.inmap])
+ gcmd.RunCommand('r.colors',
+ parent = self,
+ flags = 'r',
+ map = self.inmap)
def OnHelp(self, event):
"""Show GRASS manual page"""
- gcmd.Command(['g.manual',
- '--quiet',
- '%s' % self.cmd])
-
+ gcmd.RunCommand('g.manual',
+ quiet = True,
+ parent = self,
+ entry = self.cmd)
+
def CreateColorTable(self, force=False):
"""Creates color table"""
rulestxt = ''
@@ -592,20 +594,23 @@
output.close()
if self.elem == 'cell':
- cmdlist = ['r.colors',
- 'map=%s' % self.inmap,
- 'rules=%s' % gtemp]
-
if not force and \
not self.ovrwrtcheck.IsChecked():
- cmdlist.append('-w')
+ flags = 'w'
+ else:
+ flags = ''
+ gcmd.RunCommand('r.colors',
+ parent = self,
+ flags = flags,
+ map = self.inmap,
+ rules = gtemp)
+
elif self.elem == 'vector':
- cmdlist = ['db.execute',
- 'input=%s' % gtemp]
+ gcmd.RunCommand('db.execute',
+ parent = self,
+ input = gtemp)
- p = gcmd.Command(cmdlist)
-
class BufferedWindow(wx.Window):
"""A Buffered window class"""
def __init__(self, parent, id,
Modified: grass/trunk/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/dbm.py 2009-01-02 16:17:20 UTC (rev 35166)
+++ grass/trunk/gui/wxpython/gui_modules/dbm.py 2009-01-02 21:17:38 UTC (rev 35167)
@@ -1126,16 +1126,21 @@
where += '%s = %d or ' % (keyColumn, int(range))
where = where.rstrip('or ')
- cmd = gcmd.Command(["v.db.select",
- "-r", "--q",
- "map=%s" % self.mapDBInfo.map,
- "layer=%d" % self.layer,
- "where=%s" % where])
+ select = gcmd.RunCommand('v.db.select',
+ parent = self,
+ read = True,
+ quiet = True,
+ flags = 'r',
+ map = self.mapDBInfo.map,
+ layer = int(self.layer),
+ where = where)
region = {}
- for line in cmd.ReadStdOutput():
+ for line in select.split('\n'):
+ if '=' not in line:
+ continue
key, value = line.split('=')
- region[key] = float(value)
+ region[key.strip()] = float(value.strip())
self.mapdisplay.Map.GetRegion(n=region['n'], s=region['s'],
w=region['w'], e=region['e'],
@@ -1162,7 +1167,7 @@
list = self.FindWindowById(self.layerPage[self.layer]['data'])
table = self.mapDBInfo.layers[self.layer]['table']
keyColumn = self.mapDBInfo.layers[self.layer]['key']
-
+
# (column name, value)
data = []
@@ -1695,16 +1700,15 @@
driver = self.mapDBInfo.layers[self.layer]["driver"]
database = self.mapDBInfo.layers[self.layer]["database"]
- cmd = ['db.execute',
- 'input=%s' % sqlFile.name,
- 'driver=%s' % driver,
- 'database=%s' % database]
-
Debug.msg(3, 'AttributeManger.ApplyCommands(): %s' %
';'.join(["%s" % s for s in self.listOfSQLStatements]))
- gcmd.Command(cmd)
-
+ gcmd.RunCommand('db.execute',
+ parent = self,
+ input = sqlFile.name,
+ driver = driver,
+ database = database)
+
# reset list of statements
self.listOfSQLStatements = []
@@ -1918,12 +1922,13 @@
self.mapdisplay.digit.driver.SetSelected(map(int, cats), field=self.layer)
self.mapdisplay.digit.DeleteSelectedLines()
else:
- gcmd.Command(['v.edit',
- '--q',
- 'map=%s' % self.vectorName,
- 'tool=delete',
- 'cats=%s' % utils.ListOfCatsToRange(cats)])
-
+ gcmd.RunCommand('v.edit',
+ parent = self,
+ quiet = True,
+ map = self.vectorName,
+ tool = 'delete',
+ cats = utils.ListOfCatsToRange(cats))
+
self.mapdisplay.MapWindow.UpdateMap(render=True, renderVector=True)
def AddQueryMapLayer(self):
@@ -2135,24 +2140,30 @@
#
# drivers
#
- cmdDriver = gcmd.Command(['db.drivers',
- '-p',
- '--q'])
+ drivers = gcmd.RunCommand('db.drivers',
+ quiet = True,
+ read = True,
+ flags = 'p')
+
self.listOfDrivers = []
- for drv in cmdDriver.ReadStdOutput():
+ for drv in drivers.split('\n'):
self.listOfDrivers.append(drv.strip())
-
+
#
# get default values
#
self.defaultConnect = {}
- cmdConnect = gcmd.Command(['db.connect',
- '-p',
- '--q'])
- for line in cmdConnect.ReadStdOutput():
+ connect = gcmd.RunCommand('db.connect',
+ flags = 'p',
+ read = True,
+ quiet = True)
+
+ for line in connect.split('\n'):
+ if ':' not in line:
+ continue
item, value = line.split(':')
self.defaultConnect[item.strip()] = value.strip()
-
+
if len(self.defaultConnect['driver']) == 0 or \
len(self.defaultConnect['database']) == 0:
raise gcmd.DBMError(_('Unable to determine default DB connection settings. '
@@ -2547,37 +2558,45 @@
"""Get list of tables for given driver and database"""
tables = []
- cmdTable = gcmd.Command(['db.tables',
- '-p', '--q',
- 'driver=%s' % driver,
- 'database=%s' % database], rerr=None)
-
- if cmdTable.returncode != 0:
+ ret = gcmd.RunCommand('db.tables',
+ parent = self,
+ read = True,
+ flags = 'p',
+ driver = driver,
+ database = database)
+
+ if ret is None:
wx.MessageBox(parent=self,
message=_("Unable to get list of tables.\n"
"Please use db.connect to set database parameters."),
caption=_("Error"), style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
-
+
return tables
- for table in cmdTable.ReadStdOutput():
- tables.append(table)
-
+ for table in ret.split('\n'):
+ if len(table) > 0:
+ tables.append(table)
+
return tables
def __getColumns(self, driver, database, table):
"""Get list of column of given table"""
columns = []
- cmdColumn = gcmd.Command(['db.columns',
- '--q',
- 'driver=%s' % driver,
- 'database=%s' % database,
- 'table=%s' % table])
+ ret = gcmd.RunCommand('db.columns',
+ parent = self,
+ quiet = True,
+ driver = driver,
+ database = database,
+ table = table)
+
+ if ret == None:
+ return columns
- for column in cmdColumn.ReadStdOutput():
- columns.append(column)
-
+ for column in ret.split('\n'):
+ if len(column) > 0:
+ columns.append(column)
+
return columns
def OnDriverChanged(self, event):
@@ -2662,12 +2681,13 @@
# create table
sql = 'CREATE TABLE %s (%s INTEGER)' % (table, key)
- gcmd.Command(['db.execute',
- '--q',
- 'driver=%s' % driver,
- 'database=%s' % database],
- stdin=sql)
-
+ gcmd.RunCommand('db.execute',
+ quiet = True,
+ parent = self,
+ stdin = sql,
+ driver = driver,
+ database = database)
+
# update list of tables
tableList = self.addLayerWidgets['table'][1]
tableList.SetItems(self.__getTables(driver, database))
@@ -2698,26 +2718,28 @@
return
# add new layer
- connectCmd = gcmd.Command(['v.db.connect',
- '--q',
- 'map=%s' % self.mapDBInfo.map,
- 'driver=%s' % driver,
- 'database=%s' % database,
- 'table=%s' % table,
- 'key=%s' % key,
- 'layer=%d' % layer])
+ ret = gcmd.RunCommand('v.db.connect',
+ parent = self,
+ quiet = True,
+ map = self.mapDBInfo.map,
+ driver = driver,
+ database = database,
+ table = table,
+ key = key,
+ layer = layer)
# insert records into table if required
if self.addLayerWidgets['addCat'][0].IsChecked():
- gcmd.Command(['v.to.db',
- '--q',
- 'map=%s' % self.mapDBInfo.map,
- 'layer=%d' % layer,
- 'qlayer=%d' % layer,
- 'option=cat',
- 'columns=%s' % key])
+ gcmd.RunCommand('v.to.db',
+ parent = self,
+ quiet = True,
+ map = self.mapDBInfo.map,
+ layer = layer,
+ qlayer = layer,
+ option = 'cat',
+ columns = key)
- if connectCmd.returncode == 0:
+ if ret == 0:
# update dialog (only for new layer)
self.parentDialog.UpdateDialog(layer=layer)
# update db info
@@ -2739,10 +2761,11 @@
except:
return
- gcmd.Command(['v.db.connect',
- '-d', '--q',
- 'map=%s' % self.mapDBInfo.map,
- 'layer=%d' % layer])
+ gcmd.RunCommand('v.db.connect',
+ parent = self,
+ flags = 'd',
+ map = self.mapDBInfo.map,
+ layer = layer)
# drop also table linked to layer which is deleted
if self.deleteTable.IsChecked():
@@ -2751,12 +2774,13 @@
table = self.mapDBInfo.layers[layer]['table']
sql = 'DROP TABLE %s' % (table)
- gcmd.Command(['db.execute',
- '--q',
- 'driver=%s' % driver,
- 'database=%s' % database],
- stdin=sql)
-
+ gcmd.RunCommand('db.execute',
+ parent = self,
+ stdin = sql,
+ quiet = True,
+ driver = driver,
+ database = database)
+
# update list of tables
tableList = self.addLayerWidgets['table'][1]
tableList.SetItems(self.__getTables(driver, database))
@@ -2820,25 +2844,23 @@
if modify:
# delete layer
- gcmd.Command(['v.db.connect',
- '-d', '--q',
- 'map=%s' % self.mapDBInfo.map,
- 'layer=%d' % layer])
+ gcmd.RunCommand('v.db.connect',
+ parent = self,
+ quiet = True,
+ flag = 'd',
+ map = self.mapDBInfo.map,
+ layer = layer)
# add modified layer
- gcmd.Command(['v.db.connect',
- '--q',
- 'map=%s' % self.mapDBInfo.map,
- 'driver=%s' % \
- self.modifyLayerWidgets['driver'][1].GetStringSelection(),
- 'database=%s' % \
- self.modifyLayerWidgets['database'][1].GetValue(),
- 'table=%s' % \
- self.modifyLayerWidgets['table'][1].GetStringSelection(),
- 'key=%s' % \
- self.modifyLayerWidgets['key'][1].GetStringSelection(),
- 'layer=%d' % layer])
-
+ gcmd.RunCommand('v.db.connect',
+ quiet = True,
+ map = self.mapDBInfo.map,
+ driver = self.modifyLayerWidgets['driver'][1].GetStringSelection(),
+ database = self.modifyLayerWidgets['database'][1].GetValue(),
+ table = self.modifyLayerWidgets['table'][1].GetStringSelection(),
+ key = self.modifyLayerWidgets['key'][1].GetStringSelection(),
+ layer = int(layer))
+
# update dialog (only for new layer)
self.parentDialog.UpdateDialog(layer=layer)
# update db info
@@ -3108,9 +3130,9 @@
sqlFile.file.write(sql)
sqlFile.file.write(os.linesep)
sqlFile.file.flush()
- gcmd.Command(cmd=["db.execute",
- "--q",
- "input=%s" % sqlFile.name])
+ gcmd.RunCommand('db.execute',
+ quiet = True,
+ input = sqlFile.name)
if self.closeDialog.IsChecked():
self.OnCancel(event)
@@ -3326,17 +3348,19 @@
Return line id or None if no line is found"""
line = None
nselected = 0
- cmdWhat = gcmd.Command(cmd=['v.what',
- '-a', '--q',
- 'map=%s' % self.map,
- 'east_north=%f,%f' % \
- (float(queryCoords[0]), float(queryCoords[1])),
- 'distance=%f' % qdist], stderr=None)
-
+ ret = gcmd.RunCommand('v.what',
+ quiet = True,
+ read = True,
+ flags = 'a',
+ map = self.map,
+ east_north = '%f,%f' % \
+ (float(queryCoords[0]), float(queryCoords[1])),
+ distance = float(qdist))
+
data = {}
- if cmdWhat.returncode == 0:
+ if ret:
readAttrb = False
- for item in cmdWhat.ReadStdOutput():
+ for item in ret.split('\n'):
if len(item) < 1:
continue
@@ -3387,14 +3411,18 @@
else:
sql="SELECT %s FROM %s WHERE %s" % (cols, table, where)
- selectCommand = gcmd.Command(["db.select", "-v", "--q",
- "sql=%s" % sql,
- "database=%s" % self.layers[layer]["database"],
- "driver=%s" % self.layers[layer]["driver"]])
-
+ ret = gcmd.RunCommand('db.select',
+ parent = self,
+ read = True,
+ quiet = True,
+ flags = 'v',
+ sql= sql,
+ database = self.layers[layer]["database"],
+ driver = self.layers[layer]["driver"])
+
# self.tables[table][key][1] = str(cat)
- if selectCommand.returncode == 0:
- for line in selectCommand.ReadStdOutput():
+ if ret:
+ for line in ret.split('\n'):
name, value = line.split('|')
# casting ...
if value:
Modified: grass/trunk/gui/wxpython/gui_modules/debug.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/debug.py 2009-01-02 16:17:20 UTC (rev 35166)
+++ grass/trunk/gui/wxpython/gui_modules/debug.py 2009-01-02 21:17:38 UTC (rev 35167)
@@ -62,7 +62,8 @@
# testing
if __name__ == "__main__":
import gcmd
- gcmd.Command (cmd=["g.gisenv", "set=DEBUG=3"])
+ gcmd.RunCommand('g.gisenv',
+ set = 'DEBUG=3')
for level in range (4):
Debug.msg (level, "message level=%d" % level)
Modified: grass/trunk/gui/wxpython/gui_modules/gcmd.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gcmd.py 2009-01-02 16:17:20 UTC (rev 35166)
+++ grass/trunk/gui/wxpython/gui_modules/gcmd.py 2009-01-02 21:17:38 UTC (rev 35167)
@@ -15,6 +15,10 @@
- Command
- CommandThread
+Functions:
+
+ - RunCommand
+
(C) 2007-2008 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
@@ -64,7 +68,7 @@
self.parent = parent
self.title = title
- def __str__(self):
+ def Show(self):
dlg = wx.MessageDialog(parent=self.parent,
caption=self.title,
message=self.message,
@@ -77,6 +81,9 @@
dlg.ShowModal()
+ def __str__(self):
+ self.Show()
+
return ''
class GStdError(GException):
@@ -91,9 +98,8 @@
See Command class (command exits with EXIT_FAILURE,
G_fatal_error() is called)."""
def __init__(self, cmd, message, parent=None):
- self.cmd = cmd
GException.__init__(self, message,
- title=_("Error in command execution %s" % self.cmd[0]),
+ title=_("Error in command execution '%s'" % cmd),
parent=parent)
class SettingsError(GException):
@@ -582,3 +588,31 @@
"""Abort running process, used by main thread to signal an abort"""
self._want_abort = True
+def RunCommand(prog, flags = "", overwrite = False, quiet = False, verbose = False,
+ parent = None, read = False, stdin = None, **kwargs):
+ """Run GRASS command"""
+ kwargs['stderr'] = subprocess.PIPE
+
+ if read:
+ kwargs['stdout'] = subprocess.PIPE
+
+ if stdin:
+ kwargs['stdin'] = stdin
+
+ ps = grass.start_command(prog, flags, overwrite, quiet, verbose, **kwargs)
+
+ ret = ps.wait()
+
+ stdout, stderr = ps.communicate()
+
+ if ret != 0 and parent:
+ e = CmdError(cmd = prog,
+ message = stderr,
+ parent = parent)
+ e.Show()
+
+ if not read:
+ return ret
+
+ return stdout
+
Modified: grass/trunk/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gdialogs.py 2009-01-02 16:17:20 UTC (rev 35166)
+++ grass/trunk/gui/wxpython/gui_modules/gdialogs.py 2009-01-02 21:17:38 UTC (rev 35167)
@@ -184,17 +184,19 @@
key = UserSettings.Get(group='atm', key='keycolumn', subkey='value')
sql = 'CREATE TABLE %s (%s INTEGER)' % (outmap, key)
- gcmd.Command(['db.execute',
- '--q'],
- stdin=sql)
+ gcmd.RunCommand('db.execute',
+ quiet = True,
+ parent = self,
+ stdin = sql)
- gcmd.Command(['v.db.connect',
- '--q',
- 'map=%s' % outmap,
- 'table=%s' % outmap,
- 'key=%s' % key,
- 'layer=1'])
-
+ gcmd.RunCommand('v.db.connect',
+ quiet = True,
+ parent = self,
+ map = outmap,
+ table = outmap,
+ key = key,
+ layer = '1')
+
# return fully qualified map name
if '@' not in outmap:
outmap += '@' + grass.gisenv()['MAPSET']
Modified: grass/trunk/gui/wxpython/gui_modules/georect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/georect.py 2009-01-02 16:17:20 UTC (rev 35166)
+++ grass/trunk/gui/wxpython/gui_modules/georect.py 2009-01-02 21:17:38 UTC (rev 35167)
@@ -748,17 +748,18 @@
"""
# check to see if we are georectifying map in current working location/mapset
if self.newlocation == self.currentlocation and self.newmapset == self.currentmapset:
- cmdlist = ['i.target',
- '-c',
- 'group=%s' % tgroup]
+ gcmd.RunCommand('i.target',
+ parent = self,
+ flags = 'c',
+ group = tgroup)
else:
self.grwiz.SwitchEnv('new')
- cmdlist = ['i.target',
- 'group=%s' % tgroup,
- 'location=%s' % tlocation,
- 'mapset=%s' % tmapset]
- gcmd.Command(cmd=cmdlist, stderr=None)
-
+ gcmd.RunCommand('i.target',
+ parent = self,
+ group = tgroup,
+ location = tlocation,
+ mapset = tmapset)
+
self.grwiz.SwitchEnv('original')
def AddGCP(self, event):
@@ -1017,16 +1018,14 @@
f.close()
for vect in vectlist:
outname = vect+'_'+self.extension
- cmdlist = ['v.transform', '--q', 'input=%s' % vect, 'output=%s' % outname, 'pointsfile=%s' % self.pointsfile]
-
- p = gcmd.Command(cmd=cmdlist)
- stdout = p.ReadStdOutput()
- msg = '****'+outname+'****\n'
- for line in stdout:
- msg = msg+line+'\n'
- wx.MessageBox(msg)
+ p = gcmd.RunCommand('v.transform',
+ parent = self,
+ quiet = True,
+ input = vect,
+ output = outname,
+ pointsfile = self.pointsfile)
- if p.returncode == 0:
+ if p == 0:
wx.MessageBox("All maps were georectified successfully")
for vect in vectlist:
outname = vect+'_'+self.extension
@@ -1103,13 +1102,17 @@
# get list of forward and reverse rms error values for each point
self.grwiz.SwitchEnv('new')
- p = gcmd.Command(['g.transform',
- 'group=%s' % xygroup,
- 'order=%s' % order])
+ ret = gcmd.RunCommand('g.transform',
+ parent = self,
+ read = True,
+ group = xygroup,
+ order = order)
self.grwiz.SwitchEnv('original')
- errlist = p.ReadStdOutput()
+ if ret:
+ errlist = ret.split('\n')
+
if errlist == []:
return
Modified: grass/trunk/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gselect.py 2009-01-02 16:17:20 UTC (rev 35166)
+++ grass/trunk/gui/wxpython/gui_modules/gselect.py 2009-01-02 21:17:38 UTC (rev 35167)
@@ -474,18 +474,14 @@
def InsertTables(self, driver=None, database=None):
"""Insert attribute tables into combobox"""
items = []
- cmd = ['db.tables',
- '-p']
- if driver:
- cmd.append('driver=%s' % driver)
- if database:
- cmd.append('database=%s' % database)
+ ret = gcmd.RunCommand('db.tables',
+ flag = 'p',
+ parent = self,
+ driver = driver,
+ database = database)
- try:
- tableCmd = gcmd.Command(cmd)
- except gcmd.CmdError:
+ if ret != 0:
tableCmd = None
-
if tableCmd and \
tableCmd.returncode == 0:
@@ -560,11 +556,17 @@
if dbdatabase:
cmd.append('database=%s' % dbdatabase)
- try:
- columnchoices = gcmd.Command(cmd).ReadStdOutput()
- except gcmd.CmdError:
- columnchoices = []
+ ret = gcmd.RunCommand('db.columns',
+ read = True,
+ driver = dbdriver,
+ database = dbdatabase)
+ columnchoices = []
+ if ret:
+ for item in ret.split('\n'):
+ if len(item) < 1:
+ columnchoices.append(item)
+
# columnchoices.sort()
self.SetItems(columnchoices)
Modified: grass/trunk/gui/wxpython/gui_modules/location_wizard.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/location_wizard.py 2009-01-02 16:17:20 UTC (rev 35166)
+++ grass/trunk/gui/wxpython/gui_modules/location_wizard.py 2009-01-02 21:17:38 UTC (rev 35167)
@@ -1982,9 +1982,12 @@
'proj4=%s' % proj4string,
'location=%s' % self.startpage.location]
- p = gcmd.Command(cmdlist, stderr=None)
+ ret = gcmd.RunCommand('g.proj',
+ flags = 'c',
+ proj4 = proj4string,
+ location = self.startpage.location)
- if p.returncode == 0:
+ if ret == 0:
return True
return False
@@ -1993,14 +1996,13 @@
"""Create a new location based on given proj4 string"""
proj4string = self.custompage.customstring
location = self.startpage.location
+
+ ret = gcmd.RunCommand('g.proj',
+ flags = 'c',
+ proj4 = proj4string,
+ location = location)
- cmdlist = ['g.proj', '-c',
- 'proj4=%s' % proj4string,
- 'location=%s' % location]
-
- p = gcmd.Command(cmdlist, stderr=None)
-
- if p.returncode == 0:
+ if ret == 0:
return True
return False
@@ -2026,11 +2028,14 @@
'epsg=%s' % epsgcode,
'datumtrans=-1']
- p = gcmd.Command(cmdlist)
+ ret = gcmd.RunCommand('g.proj',
+ epsg = epsgcode,
+ datumtrans = '-1')
dtoptions = {}
- try:
- line = p.ReadStdOutput()
+
+ if ret:
+ line = ret.split('\n')
i = 0
while i < len(line):
if line[i] == '---':
@@ -2039,9 +2044,7 @@
line[i+3],
line[i+4])
i += 5
- except:
- pass
-
+
if dtoptions != {}:
dtrans = ''
# open a dialog to select datum transform number
@@ -2061,19 +2064,17 @@
dlg.Destroy()
return False
- cmdlist = ['g.proj', '-c',
- 'epsg=%s' % epsgcode,
- 'location=%s' % location,
- 'datumtrans=%s' % dtrans]
+ datumtrans = dtrans
else:
- cmdlist = ['g.proj','-c',
- 'epsg=%s' % epsgcode,
- 'location=%s' % location,
- 'datumtrans=1']
+ datumtrans = '1'
- p = gcmd.Command(cmdlist, stderr=None)
-
- if p.returncode == 0:
+ ret = gcmd.RunCommand('g.proj',
+ flags = 'c',
+ epsg = epsgcode,
+ location = location,
+ datumtrans = datumtrans)
+
+ if ret == 0:
return True
return False
@@ -2098,13 +2099,12 @@
return False
# creating location
- cmdlist = ['g.proj', '-c',
- 'georef=%s' % georeffile,
- 'location=%s' % location]
+ ret = gcmd.RunCommand('g.proj',
+ flags = 'c',
+ georef = georeffile,
+ location = location)
- p = gcmd.Command(cmdlist, stderr=None)
-
- if p.returncode == 0:
+ if ret == 0:
return True
return False
@@ -2133,9 +2133,12 @@
'wkt=%s' % wktfile,
'location=%s' % location]
- p = gcmd.Command(cmdlist, stderr=None)
-
- if p.returncode == 0:
+ ret = gcmd.RunCommand('g.proj',
+ flags = 'c',
+ wkt = wktfile,
+ location = location)
+
+ if ret == 0:
return True
return False
@@ -2205,10 +2208,10 @@
# in selected location in order to set default region (WIND)
#
envval = {}
- cmdlist = ['g.gisenv']
- p = gcmd.Command(cmdlist)
- if p.returncode == 0:
- output = p.ReadStdOutput()
+ ret = gcmd.RunCommand('g.gisenv',
+ read = True)
+ if ret:
+ output = ret.split('\n')
for line in output:
line = line.strip()
if '=' in line:
@@ -2219,10 +2222,10 @@
if self.currlocation != self.location or self.currmapset != 'PERMANENT':
# cmdlist = ['g.mapset', 'location=%s' % self.location, 'mapset=PERMANENT']
# gcmd.Command(cmdlist
- gcmd.Command(["g.gisenv",
- "set=LOCATION_NAME=%s" % self.location])
- gcmd.Command(["g.gisenv",
- "set=MAPSET=PERMANENT"])
+ gcmd.RunCommand('g.gisenv',
+ set = 'LOCATION_NAME=%s' % self.location)
+ gcmd.RunCommand('g.gisenv',
+ set = 'MAPSET=PERMANENT')
else:
dlg = wx.MessageBox(parent=self,
@@ -2234,10 +2237,11 @@
# get current region settings
#
region = {}
- cmdlist = ['g.region', '-gp3']
- p = gcmd.Command(cmdlist)
- if p.returncode == 0:
- output = p.ReadStdOutput()
+ ret = gcmd.RunCommand('g.region',
+ read = True,
+ flags = 'gp3')
+ if ret:
+ output = ret.split('\n')
for line in output:
line = line.strip()
if '=' in line:
@@ -2600,8 +2604,18 @@
'b=%f' % self.bottom,
'tbres=%f' % self.tbres]
- p = gcmd.Command(cmdlist)
- if p.returncode == 0:
+ ret = gcmd.RunCommand('g.region',
+ flags = 'sgpa',
+ n = self.north,
+ s = self.south,
+ e = self.east,
+ w = self.west,
+ nsres = self.nsres,
+ ewres = self.ewres,
+ t = self.top,
+ b = self.bottom,
+ tbres = self.tbres)
+ if ret == 0:
self.Destroy()
def OnCancel(self, event):
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2009-01-02 16:17:20 UTC (rev 35166)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2009-01-02 21:17:38 UTC (rev 35167)
@@ -1244,9 +1244,10 @@
for sql in addRecordDlg.GetSQLString():
sqlfile.file.write(sql + ";\n")
sqlfile.file.flush()
- executeCommand = gcmd.Command(cmd=["db.execute",
- "--q",
- "input=%s" % sqlfile.name])
+ gcmd.RunCommand('db.execute',
+ parent = self,
+ quiet = True,
+ input = sqlfile.name)
elif digitToolbar.GetAction('type') in ["line", "boundary"]:
# add new point to the line
@@ -1869,9 +1870,11 @@
for sql in addRecordDlg.GetSQLString():
sqlfile.file.write(sql + ";\n")
sqlfile.file.flush()
- executeCommand = gcmd.Command(cmd=["db.execute",
- "--q",
- "input=%s" % sqlfile.name])
+ gcmd.RunCommand('db.execute',
+ parent = True,
+ quiet = True,
+ input = sqlfile.name)
+
elif digitToolbar.GetAction() == "deleteLine":
# -> delete selected vector features
if digitClass.DeleteSelectedLines() < 0:
@@ -2399,17 +2402,16 @@
# We ONLY want to set extents here. Don't mess with resolution. Leave that
# for user to set explicitly with g.region
new = self.Map.AlignResolution()
+ gcmd.RunCommand('g.region',
+ parent = self,
+ overwrite = True,
+ n = new['n'],
+ s = new['s'],
+ e = new['e'],
+ w = new['w'],
+ rows = int(new['rows']),
+ cols = int(new['cols']))
- cmdRegion = ["g.region", "--o",
- "n=%f" % new['n'],
- "s=%f" % new['s'],
- "e=%f" % new['e'],
- "w=%f" % new['w'],
- "rows=%d" % int(new['rows']),
- "cols=%d" % int(new['cols'])]
-
- p = gcmd.Command(cmdRegion)
-
if tmpreg:
os.environ["GRASS_REGION"] = tmpreg
@@ -2432,23 +2434,36 @@
wind = dlg.wind
- p = gcmd.Command (["g.region", "-ugp", "region=%s" % wind])
+ region = gcmd.RunCommand('g.region',
+ parent = self,
+ read = True,
+ flags = 'ugp',
+ region = wind)
+
+ if not region:
+ dlg.Destroy()
+ return
+
+ for line in region.split('\n'):
+ if '=' not in line:
+ continue
+ key, val = line.split('=')
+ zoomreg[key.strip()] = float(val.strip())
+
+ self.Map.region['n'] = zoomreg['n']
+ self.Map.region['s'] = zoomreg['s']
+ self.Map.region['e'] = zoomreg['e']
+ self.Map.region['w'] = zoomreg['w']
- if p.returncode == 0:
- output = p.ReadStdOutput()
- for line in output:
- line = line.strip()
- if '=' in line: key,val = line.split('=')
- zoomreg[key] = float(val)
- self.Map.region['n'] = zoomreg['n']
- self.Map.region['s'] = zoomreg['s']
- self.Map.region['e'] = zoomreg['e']
- self.Map.region['w'] = zoomreg['w']
- self.ZoomHistory(self.Map.region['n'],self.Map.region['s'],self.Map.region['e'],self.Map.region['w'])
- self.UpdateMap()
-
+ self.ZoomHistory(self.Map.region['n'],
+ self.Map.region['s'],
+ self.Map.region['e'],
+ self.Map.region['w'])
+
+ self.UpdateMap()
+
dlg.Destroy()
-
+
def SaveDisplayRegion(self, event):
"""
Save display extents to named region file.
@@ -2502,8 +2517,18 @@
if tmpreg:
del os.environ["GRASS_REGION"]
- p = gcmd.Command(cmdRegion)
-
+ gcmd.RunCommand('g.region',
+ overwrite = True,
+ parent = self,
+ flags = 'u',
+ n = new['n'],
+ s = new['s'],
+ e = new['e'],
+ w = new['w'],
+ rows = int(new['rows']),
+ cols = int(new['cols']),
+ save = wind)
+
if tmpreg:
os.environ["GRASS_REGION"] = tmpreg
@@ -3512,9 +3537,9 @@
self.gismanager.goutput.RunCmd(vcmd)
else:
if rcmd:
- gcmd.Command(rcmd)
+ gcmd.Command(rcmd) # TODO: -> grass.run_command
if vcmd:
- gcmd.Command(vcmd)
+ gcmd.Command(vcmd) # TODO: -> grass.run_command
# restore GRASS_REGION
if tmpreg:
Modified: grass/trunk/gui/wxpython/gui_modules/mcalc_builder.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mcalc_builder.py 2009-01-02 16:17:20 UTC (rev 35166)
+++ grass/trunk/gui/wxpython/gui_modules/mcalc_builder.py 2009-01-02 21:17:38 UTC (rev 35167)
@@ -411,9 +411,9 @@
"""
Launches r.mapcalc help
"""
- cmdlist = ['g.manual','r.mapcalc']
- gcmd.Command(cmdlist)
-
+ gcmd.RunCommand('g.manual',
+ entry = 'r.mapcalc')
+
def OnClose(self,event):
self.Destroy()
Modified: grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_tools.py 2009-01-02 16:17:20 UTC (rev 35166)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_tools.py 2009-01-02 21:17:38 UTC (rev 35167)
@@ -2414,11 +2414,19 @@
color = self.FindWindowById(self.win['surface']['draw']['wire-color'])
def UpdateVectorPage(self, layer, data):
- vInfo = gcmd.Command(['v.info',
- '-t',
- 'map=%s' % layer.name])
+ vInfo = gcmd.RunCommand('v.info',
+ parent = self,
+ read = True,
+ flags = 't',
+ map = layer.name)
+
+ if not vInfo:
+ return
+
npoints = nprimitives = 0
- for line in vInfo.ReadStdOutput():
+ for line in vInfo.split('\n'):
+ if '=' not in line:
+ continue
key, value = line.split('=')
if key == 'map3d':
mapIs3D = int(value)
Modified: grass/trunk/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/preferences.py 2009-01-02 16:17:20 UTC (rev 35166)
+++ grass/trunk/gui/wxpython/gui_modules/preferences.py 2009-01-02 21:17:38 UTC (rev 35167)
@@ -1672,9 +1672,14 @@
cmd = ["d.font", "-l"]
- p = gcmd.Command(cmd, stderr=None)
+ ret = gcmd.RunCommand('d.font',
+ read = True,
+ flags = 'l')
- dfonts = p.ReadStdOutput()
+ if not ret:
+ return fontlist
+
+ dfonts = ret.split('\n')
dfonts.sort(lambda x,y: cmp(x.lower(), y.lower()))
for item in range(len(dfonts)):
# ignore duplicate fonts and those starting with #
Modified: grass/trunk/gui/wxpython/gui_modules/profile.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/profile.py 2009-01-02 16:17:20 UTC (rev 35166)
+++ grass/trunk/gui/wxpython/gui_modules/profile.py 2009-01-02 21:17:38 UTC (rev 35167)
@@ -281,12 +281,16 @@
r['datalist'] = self.CreateDatalist(r['name'], self.coordstr)
r['plegend'] = _('Profile of %s') % r['name']
- p = gcmd.Command(['r.info',
- 'map=%s' % r['name'],
- '-u',
- '--quiet'])
- r['units'] = p.ReadStdOutput()[0].split('=')[1]
+ ret = gcmd.RunCommand('r.info',
+ parent = self,
+ read = True,
+ quiet = True,
+ flags = 'u',
+ map = r['name'])
+ if ret:
+ r['units'] = p.split('\n')[0].split('=')[1]
+
# update title
self.ptitle += ' %s and' % r['name']
@@ -316,10 +320,12 @@
if len(self.mapwin.polycoords) > 0:
for point in self.mapwin.polycoords:
# get value of raster cell at coordinate point
- p = gcmd.Command(['r.what',
- 'input=%s' % self.raster[0]['name'],
- 'east_north=%d,%d' % (point[0],point[1])])
- outlist = p.ReadStdOutput()
+ ret = gcmd.RunCommand('r.what',
+ parent = self,
+ read = True,
+ input = self.raster[0]['name'],
+ east_north = '%d,%d' % (point[0],point[1]))
+ outlist = ret.split('\n')
val = outlist[0].split('|')[3]
# calculate distance between coordinate points
Modified: grass/trunk/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/render.py 2009-01-02 16:17:20 UTC (rev 35166)
+++ grass/trunk/gui/wxpython/gui_modules/render.py 2009-01-02 21:17:38 UTC (rev 35167)
@@ -727,22 +727,26 @@
projinfo = {}
- p = gcmd.Command(['g.proj', '-p'])
-
- if p.returncode == 0:
- for line in p.ReadStdOutput():
- if ':' in line:
- key,val = line.split(':')
- key = key.strip()
- val = val.strip()
- projinfo[key] = val
- elif "XY location (unprojected)" in line:
- projinfo['proj'] = "xy"
- projinfo['units'] = ''
+ ret = gcmd.RunCommand('g.proj',
+ read = True,
+ flags = 'p')
+
+ if not ret:
return projinfo
- else:
- return None
+ for line in ret.split('\n'):
+ if ':' in line:
+ key,val = line.split(':')
+ key = key.strip()
+ val = val.strip()
+ projinfo[key] = val
+ elif "XY location (unprojected)" in line:
+ projinfo['proj'] = "xy"
+ projinfo['units'] = ''
+ break
+
+ return projinfo
+
def GetListOfLayers(self, l_type=None, l_mapset=None, l_name=None,
l_active=None, l_hidden=None):
"""
@@ -921,10 +925,17 @@
del os.environ["GRASS_REGION"]
# run g.pngcomp to get composite image
- try:
- gcmd.Command(complist)
- except gcmd.CmdError, e:
- print >> sys.stderr, e
+ ret = gcmd.RunCommand('g.pnmcomp',
+ input = '%s' % ",".join(maps),
+ mask = '%s' % ",".join(masks),
+ opacity = '%s' % ",".join(opacities),
+ background = bgcolor,
+ width = self.width,
+ height = self.height,
+ output = self.mapfile)
+
+ if ret != 0:
+ print >> sys.stderr, _("ERROR: Rendering failed")
return None
# back to original gisrc
Modified: grass/trunk/gui/wxpython/gui_modules/rules.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/rules.py 2009-01-02 16:17:20 UTC (rev 35166)
+++ grass/trunk/gui/wxpython/gui_modules/rules.py 2009-01-02 21:17:38 UTC (rev 35167)
@@ -162,9 +162,9 @@
self.rules = self.rules + '%s' % os.linesep
def OnHelp(self, event):
- gcmd.Command(['g.manual',
- '--quiet',
- '%s' % self.cmd[0]])
+ gcmd.RunCommand('g.manual',
+ quiet = True,
+ entry = self.cmd[0])
def OnOverwrite(self, event):
self.overwrite = event.IsChecked()
Modified: grass/trunk/gui/wxpython/gui_modules/sqlbuilder.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/sqlbuilder.py 2009-01-02 16:17:20 UTC (rev 35166)
+++ grass/trunk/gui/wxpython/gui_modules/sqlbuilder.py 2009-01-02 21:17:38 UTC (rev 35167)
@@ -220,10 +220,11 @@
def GetColumns(self):
"""Get columns"""
- dbDescribe = gcmd.Command(['db.describe',
- '-c', '--q',
- 'table=%s' % self.tablename])
-
+ dbDescribe = gcmd.RunCommand('db.describe',
+ quiet = True,
+ flags = 'c',
+ table = self.tablename)
+
# skip ncols and nrows lines
for line in dbDescribe.ReadStdOutput()[2:]:
num, name, ctype, length = line.strip().split(":")
Modified: grass/trunk/gui/wxpython/gui_modules/utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/utils.py 2009-01-02 16:17:20 UTC (rev 35166)
+++ grass/trunk/gui/wxpython/gui_modules/utils.py 2009-01-02 21:17:38 UTC (rev 35167)
@@ -42,10 +42,11 @@
"""
import gcmd
- tempfileCmd = gcmd.Command(["g.tempfile",
- "pid=%d" % os.getpid()])
+ ret = gcmd.RunCommand('g.tempfile',
+ read = True,
+ pid = os.getpid())
- tempfile = tempfileCmd.ReadStdOutput()[0].strip()
+ tempfile = tempfileCmd.split('\n')[0].strip()
# FIXME
# ugly hack for MSYS (MS Windows)
@@ -247,7 +248,16 @@
'option=report']
layers = []
- for line in gcmd.Command(cmdlist, rerr=None).ReadStdOutput():
+
+ ret = gcmd.RunCommand('v.category',
+ read = True,
+ input = vector,
+ option = 'report')
+
+ if not ret:
+ return layers
+
+ for line in ret.split('\n'):
if not 'Layer' in line:
continue
Modified: grass/trunk/gui/wxpython/gui_modules/vdigit.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/vdigit.py 2009-01-02 16:17:20 UTC (rev 35166)
+++ grass/trunk/gui/wxpython/gui_modules/vdigit.py 2009-01-02 21:17:38 UTC (rev 35167)
@@ -185,15 +185,17 @@
x1, y1 = pos1
x2, y2 = pos2
- vEditCmd = gcmd.Command(['v.edit',
- '--q',
- 'map=%s' % bgmap,
- 'tool=select',
- 'bbox=%f,%f,%f,%f' % (pos1[0], pos1[1], pos2[0], pos2[1])])
- #'polygon=%f,%f,%f,%f,%f,%f,%f,%f,%f,%f' % \
- # (x1, y1, x2, y1, x2, y2, x1, y2, x1, y1)])
-
- output = vEditCmd.ReadStdOutput()[0] # first line
+ ret = gcmd.RunCommand('v.edit',
+ parent = self,
+ quiet = True,
+ map = bgmap,
+ tool = 'select',
+ bbox= '%f,%f,%f,%f' % (pos1[0], pos1[1], pos2[0], pos2[1]))
+
+ if not ret:
+ return ids
+
+ output = ret.split('\n')[0] # first line
ids = output.split(',')
ids = map(int, ids) # str -> int
@@ -1978,17 +1980,18 @@
Return True line found or False if not found"""
- cmdWhat = gcmd.Command(cmd=['v.what',
- '--q',
- 'map=%s' % self.map,
- 'east_north=%f,%f' % \
- (float(coords[0]), float(coords[1])),
- 'distance=%f' % qdist])
+ ret = gcmd.RunCommand('v.what',
+ parent = self,
+ quiet = True,
+ map = self.map,
+ east_north = '%f,%f' % \
+ (float(coords[0]), float(coords[1])),
+ distance = qdist)
- if cmdWhat.returncode != 0:
+ if not ret:
return False
- for item in cmdWhat.ReadStdOutput():
+ for item in ret.split('\n'):
litem = item.lower()
if "id:" in litem: # get line id
self.line = int(item.split(':')[1].strip())
Modified: grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py 2009-01-02 16:17:20 UTC (rev 35166)
+++ grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py 2009-01-02 21:17:38 UTC (rev 35167)
@@ -37,7 +37,6 @@
import menuform
import mapdisp
import render
-import gcmd
import histogram
import utils
import profile
Modified: grass/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py 2009-01-02 16:17:20 UTC (rev 35166)
+++ grass/trunk/gui/wxpython/wxgui.py 2009-01-02 21:17:38 UTC (rev 35167)
@@ -27,6 +27,7 @@
import re
import string
import getopt
+import platform
### XML
import xml.sax
@@ -61,11 +62,9 @@
import wx.lib.customtreectrl as CT
import wx.lib.flatnotebook as FN
from wx.lib.wordwrap import wordwrap
-try:
- import subprocess
-except:
- import compat.subprocess as subprocess
+import grass
+
import gui_modules.utils as utils
import gui_modules.preferences as preferences
import gui_modules.wxgui_utils as wxgui_utils
@@ -368,8 +367,9 @@
if dlg.ShowModal() == wx.ID_OK:
ms = dlg.GetMapsets()
# run g.mapsets with string of accessible mapsets
- cmdlist = ['g.mapsets', 'mapset=%s' % ','.join(ms)]
- gcmd.Command(cmdlist)
+ gcmd.RunCommand('g.mapsets',
+ parent = self,
+ mapset = '%s' % ','.join(ms))
def OnRDigit(self, event):
"""
@@ -500,8 +500,8 @@
# name
info.SetName("GRASS GIS")
# version
- versionCmd = gcmd.Command(['g.version'])
- info.SetVersion(versionCmd.ReadStdOutput()[0].replace('GRASS', '').strip())
+ version = grass.read_command('g.version').replace('GRASS', '').strip()
+ info.SetVersion(version)
# description
copyrightFile = open(os.path.join(os.getenv("GISBASE"), "COPYING"), 'r')
copyrightOut = []
@@ -628,7 +628,7 @@
fileStream = ''.join(file.readlines())
p = re.compile('(grass-gxw.dtd)')
p.search(fileStream)
- if subprocess.mswindows:
+ if platform.system() == 'Windows':
# FIXME mixing '\' and '/' causes error in p.sub
dtdFilename = dtdFilename.replace("\\", "/")
fileStream = p.sub(dtdFilename, fileStream)
@@ -939,48 +939,6 @@
self.goutput.RunCmd(cmdlist)
- def OnXTerm(self, event):
- """
- Run commands that need interactive xmon
- """
- command = self.GetMenuCmd(event)
-
- # unset display mode
- del os.environ['GRASS_RENDER_IMMEDIATE']
-
- # open next available xmon
- xmonlist = []
- gisbase = os.environ['GISBASE']
-
- # make list of xmons that are not running
- cmdlist = ["d.mon", "-L"]
- p = gcmd.Command(cmdlist)
-
- for line in p.ReadStdOutput():
- line = line.strip()
- if line.startswith('x') and 'not running' in line:
- xmonlist.append(line[0:2])
-
- # open available xmon
- xmon = xmonlist[0]
- cmdlist = ["d.mon","start=%s" % xmon]
- p = gcmd.Command(cmdlist)
-
- # run the command
- runbat = os.path.join(gisbase,'etc','grass-run.bat')
- xtermwrapper = os.path.join(gisbase,'etc','grass-xterm-wrapper')
- grassrun = os.path.join(gisbase,'etc','grass-run.sh')
- command = ' '.join(command)
-
- if 'OS' in os.environ and os.environ['OS'] == "Windows_NT":
- cmdlist = ["cmd.exe", "/c", 'start "%s"' % runbat, command]
- else:
- cmdlist = [xtermwrapper, '-e "%s"' % grassrun, command]
- p = gcmd.Command(cmdlist)
-
- # reset display mode
- os.environ['GRASS_RENDER_IMMEDIATE'] = 'TRUE'
-
def OnPreferences(self, event):
"""General GUI preferences/settings"""
preferences.PreferencesDialog(parent=self).ShowModal()
Modified: grass/trunk/gui/wxpython/xml/menudata.xml
===================================================================
--- grass/trunk/gui/wxpython/xml/menudata.xml 2009-01-02 16:17:20 UTC (rev 35166)
+++ grass/trunk/gui/wxpython/xml/menudata.xml 2009-01-02 21:17:38 UTC (rev 35167)
@@ -606,12 +606,14 @@
<handler>self.OnMenuCmd</handler>
<command>g.proj</command>
</menuitem>
+<!--
<menuitem>
<label>Projection for current location</label>
<help>Create/edit projection information for current location</help>
<handler>self.OnXTerm</handler>
<command>g.setproj</command>
</menuitem>
+-->
<separator/>
<menuitem>
<label>Convert coordinates</label>
@@ -634,12 +636,14 @@
<menu>
<label>Develop raster map</label>
<items>
+<!--
<menuitem>
<label>Digitize raster (requires XTerm)</label>
<help>Digitize raster map</help>
<handler>self.OnXTerm</handler>
<command>r.digit</command>
</menuitem>
+-->
<separator/>
<menuitem>
<label>Compress/decompress</label>
@@ -1051,6 +1055,7 @@
<menu>
<label>Landscape structure modeling</label>
<items>
+<!--
<menuitem>
<label>Set up (requires XTerm)</label>
<help>Set up sampling and analysis framework</help>
@@ -1058,6 +1063,7 @@
<command>r.le.setup</command>
</menuitem>
<separator/>
+-->
<menuitem>
<label>Analyze landscape</label>
<help>Contains a set of measures for attributes, diversity, texture, juxtaposition, and edge.</help>
@@ -1716,12 +1722,14 @@
<handler>self.OnMenuCmd</handler>
<command>v.net.path</command>
</menuitem>
+<!--
<menuitem>
<label>Display shortest route (requires XTerm)</label>
<help>Display shortest route along network between 2 nodes (visualization only, requires XTerm))</help>
<handler>self.OnXTerm</handler>
<command>d.path</command>
</menuitem>
+-->
<menuitem>
<label>Split net</label>
<help>Splits net to bands between cost isolines (direction from centre). Centre node must be opened (costs >= 0). Costs of centre node are used in calculation.</help>
@@ -1994,12 +2002,14 @@
<handler>self.OnMenuCmd</handler>
<command>i.rectify</command>
</menuitem>
+<!--
<menuitem>
<label>Ortho photo rectification (requires Xterm)</label>
<help>Ortho Photo rectification</help>
<handler>self.OnXTerm</handler>
<command>i.ortho.photo</command>
</menuitem>
+-->
<separator/>
<menu>
<label>Basic RS processing</label>
@@ -2074,12 +2084,14 @@
<command>i.smap</command>
</menuitem>
<separator/>
+<!--
<menuitem>
<label>Interactive input for supervised classification (requires Xterm)</label>
<help>Interactive input for supervised classification</help>
<handler>self.OnXTerm</handler>
<command>i.class</command>
</menuitem>
+-->
<menuitem>
<label>Input for supervised MLC</label>
<help>Generates statistics for i.maxlik from raster map layer.</help>
More information about the grass-commit
mailing list