[GRASS-SVN] r44387 -
grass/branches/develbranch_6/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Nov 23 08:57:01 EST 2010
Author: martinl
Date: 2010-11-23 05:57:01 -0800 (Tue, 23 Nov 2010)
New Revision: 44387
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/mcalc_builder.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py
Log:
wxGUI: mcalc fixes
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py 2010-11-23 10:38:35 UTC (rev 44386)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py 2010-11-23 13:57:01 UTC (rev 44387)
@@ -116,13 +116,23 @@
# set default color table for raster data
if UserSettings.Get(group='cmd', key='rasterColorTable', subkey='enabled') and \
args[0][0][:2] == 'r.':
- moduleInterface = menuform.GUI().ParseCommand(args[0], show = None)
- outputParam = moduleInterface.get_param(value = 'output', raiseError = False)
colorTable = UserSettings.Get(group='cmd', key='rasterColorTable', subkey='selection')
- if outputParam and outputParam['prompt'] == 'raster':
+ mapName = None
+ if args[0][0] == 'r.mapcalc':
+ try:
+ mapName = args[0][1].split('=', 1)[0].strip()
+ except KeyError:
+ pass
+ else:
+ moduleInterface = menuform.GUI().ParseCommand(args[0], show = None)
+ outputParam = moduleInterface.get_param(value = 'output', raiseError = False)
+ if outputParam and outputParam['prompt'] == 'raster':
+ mapName = outputParam['value']
+
+ if mapName:
argsColor = list(args)
argsColor[0] = [ 'r.colors',
- 'map=%s' % outputParam['value'],
+ 'map=%s' % mapName,
'color=%s' % colorTable ]
self.requestCmdColor = callable(*argsColor, **kwds)
self.resultQ.put((requestId, self.requestCmdColor.run()))
@@ -480,7 +490,7 @@
else:
lname = None
- if self.parent.GetName() == "LayerManager":
+ if self.parent.GetName() == "LayerManager":
self.parent.curr_page.maptree.AddLayer(ltype=layertype,
lname=lname,
lcmd=command)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mcalc_builder.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mcalc_builder.py 2010-11-23 10:38:35 UTC (rev 44386)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mcalc_builder.py 2010-11-23 13:57:01 UTC (rev 44387)
@@ -451,10 +451,13 @@
if not self.addbox.IsChecked():
return
name = self.newmaptxt.GetValue().strip() + '@' + grass.gisenv()['MAPSET']
- self.parent.GetLayerTree().AddLayer(ltype = 'raster',
- lname = name,
- lcmd = ['d.rast', 'map=%s' % name],
- multiple = False)
+ mapTree = self.parent.GetLayerTree()
+ if not mapTree.GetMap().GetListOfLayers(l_name = name):
+ mapTree.AddLayer(ltype = 'raster',
+ lname = name,
+ lcmd = ['d.rast', 'map=%s' % name],
+ multiple = False)
+
display = self.parent.GetLayerTree().GetMapDisplay()
if display and display.IsAutoRendered():
display.GetWindow().UpdateMap(render = True)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py 2010-11-23 10:38:35 UTC (rev 44386)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py 2010-11-23 13:57:01 UTC (rev 44387)
@@ -739,6 +739,8 @@
if not self.cmdDesc or cmd != self.cmdDesc.get_name():
if cmd in ('r.mapcalc', 'r3.mapcalc'):
self.parent.parent.OnMapCalculator(event = None, cmd = [cmd])
+ # add command to history & clean prompt
+ self.UpdateCmdHistory([cmd])
self.OnCmdErase(None)
else:
try:
@@ -746,6 +748,19 @@
except IOError:
self.cmdDesc = None
+ def UpdateCmdHistory(self, cmd):
+ """!Update command history
+
+ @param cmd command given as a list
+ """
+ # add command to history
+ self.cmdbuffer.append(' '.join(cmd))
+
+ # keep command history to a managable size
+ if len(self.cmdbuffer) > 200:
+ del self.cmdbuffer[0]
+ self.cmdindex = len(self.cmdbuffer)
+
def OnKeyPressed(self, event):
"""!Key press capture for autocompletion, calltips, and command history
@@ -902,20 +917,13 @@
cmd = utils.split(utils.EncodeString((line)))
# send the command list to the processor
- if cmd[0] in ('r.mapcalc', 'r3.mapcalc'):
+ if cmd[0] in ('r.mapcalc', 'r3.mapcalc') and len(cmd) == 1:
self.parent.parent.OnMapCalculator(event = None, cmd = cmd)
else:
self.parent.RunCmd(cmd)
- # add command to history
- self.cmdbuffer.append(' '.join(cmd))
-
- # keep command history to a managable size
- if len(self.cmdbuffer) > 200:
- del self.cmdbuffer[0]
- self.cmdindex = len(self.cmdbuffer)
-
- # reset command-line
+ # add command to history & clean prompt
+ self.UpdateCmdHistory(cmd)
self.OnCmdErase(None)
elif event.GetKeyCode() == wx.WXK_SPACE:
More information about the grass-commit
mailing list