[GRASS-SVN] r42250 - in grass/branches/develbranch_6/gui/wxpython:
. gui_modules xml
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu May 13 17:39:39 EDT 2010
Author: martinl
Date: 2010-05-13 17:39:34 -0400 (Thu, 13 May 2010)
New Revision: 42250
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/mcalc_builder.py
grass/branches/develbranch_6/gui/wxpython/wxgui.py
grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml
Log:
mmetz: wxGUI/mapcalc: fix 3D help, make overwrite option visible, find
also interactive (3D) map calculator in command search
(merge r42247, r42248, r42249 from trunk)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mcalc_builder.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mcalc_builder.py 2010-05-13 21:25:59 UTC (rev 42249)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mcalc_builder.py 2010-05-13 21:39:34 UTC (rev 42250)
@@ -37,15 +37,22 @@
"""!Mapcalc Frame class. Calculator-style window to create and run
r(3).mapcalc statements
"""
- def __init__(self, parent, id = wx.ID_ANY, title = _('Map calculator'),
- rast3d = False, style = wx.DEFAULT_FRAME_STYLE | wx.RESIZE_BORDER, **kwargs):
+ def __init__(self, parent, cmd, id = wx.ID_ANY, title = _('Map calculator'),
+ style = wx.DEFAULT_FRAME_STYLE | wx.RESIZE_BORDER, **kwargs):
self.parent = parent
if self.parent:
self.log = self.parent.GetLogWindow()
else:
self.log = None
- self.rast3d = rast3d
+ # grass command
+ self.cmd = cmd
+
+ if self.cmd == 'r.mapcalc':
+ self.rast3d = False
+ if self.cmd == 'r3.mapcalc':
+ self.rast3d = True
+
wx.Frame.__init__(self, parent, id = id, title = title, **kwargs)
self.SetIcon(wx.Icon(os.path.join(globalvar.ETCICONDIR, 'grass.ico'), wx.BITMAP_TYPE_ICO))
@@ -304,6 +311,7 @@
sizer.Add(item = expressSizer, proportion = 1,
flag = wx.EXPAND | wx.LEFT | wx.RIGHT,
border = 5)
+
sizer.Add(item = buttonSizer4, proportion = 0,
flag = wx.ALIGN_RIGHT | wx.ALL, border = 1)
@@ -394,17 +402,13 @@
mctxt = self.text_mcalc.GetValue().strip().replace("\n"," ")
mctxt = mctxt.replace(" " , "")
- if self.rast3d:
- prg = 'r3.mapcalc'
- else:
- prg = 'r.mapcalc'
if self.log:
- cmd = [prg, str('%s = %s' % (name, mctxt))]
+ cmd = [self.cmd, str('%s = %s' % (name, mctxt))]
self.log.RunCmd(cmd)
self.parent.Raise()
else:
- gcmd.RunCommand(prg,
+ gcmd.RunCommand(self.cmd,
"%s=%s" % (name, mctxt))
def OnClear(self, event):
@@ -415,7 +419,7 @@
def OnHelp(self, event):
"""!Launches r.mapcalc help
"""
- gcmd.RunCommand('g.manual', entry = 'r.mapcalc')
+ gcmd.RunCommand('g.manual', parent = self, entry = self.cmd)
def OnClose(self,event):
"""!Close window"""
Modified: grass/branches/develbranch_6/gui/wxpython/wxgui.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/wxgui.py 2010-05-13 21:25:59 UTC (rev 42249)
+++ grass/branches/develbranch_6/gui/wxpython/wxgui.py 2010-05-13 21:39:34 UTC (rev 42250)
@@ -164,9 +164,10 @@
self.SetSize((w, h))
except:
pass
+ else:
+ self.Centre()
self.Layout()
- self.Centre()
self.Show()
# load workspace file if requested
@@ -1009,18 +1010,26 @@
self.profile.Refresh()
self.profile.Update()
- def OnMapCalculator(self, event):
+ def OnMapCalculator(self, event, cmd = ''):
"""!Init map calculator for interactive creation of mapcalc statements
"""
- win = mapcalculator.MapCalcFrame(parent = self, title = _('GRASS GIS Map Calculator'))
+
+ if event:
+ cmd = self.GetMenuCmd(event)
+
+ win = mapcalculator.MapCalcFrame(parent = self, title = _('GRASS GIS Map Calculator'),
+ cmd=cmd[0])
win.CentreOnScreen()
win.Show()
- def OnMapCalculator3D(self, event):
+ def OnMapCalculator3D(self, event, cmd =''):
"""!Init map calculator for interactive creation of mapcalc statements
"""
+ if event:
+ cmd = self.GetMenuCmd(event)
+
win = mapcalculator.MapCalcFrame(parent = self, title = _('GRASS GIS Map Calculator (3D raster)'),
- rast3d = True)
+ cmd=cmd[0])
win.CentreOnScreen()
win.Show()
Modified: grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml 2010-05-13 21:25:59 UTC (rev 42249)
+++ grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml 2010-05-13 21:39:34 UTC (rev 42250)
@@ -1014,7 +1014,9 @@
<menuitem>
<label>Raster calculator</label>
<help>Map calculator for raster map algebra.</help>
+ <keywords>raster,algebra</keywords>
<handler>OnMapCalculator</handler>
+ <command>r.mapcalc</command>
</menuitem>
<menu>
<label>Neighborhood analysis</label>
@@ -2692,7 +2694,9 @@
<menuitem>
<label>Volume calculator</label>
<help>Map calculator for 3D raster map algebra.</help>
+ <keywords>raster,algebra</keywords>
<handler>OnMapCalculator3D</handler>
+ <command>r3.mapcalc</command>
</menuitem>
<menuitem>
<label>Cross section</label>
More information about the grass-commit
mailing list