[GRASS-SVN] r42247 - in grass/trunk/gui/wxpython: . gui_modules xml

svn_grass at osgeo.org svn_grass at osgeo.org
Thu May 13 09:16:40 EDT 2010


Author: mmetz
Date: 2010-05-13 09:16:38 -0400 (Thu, 13 May 2010)
New Revision: 42247

Modified:
   grass/trunk/gui/wxpython/gui_modules/mcalc_builder.py
   grass/trunk/gui/wxpython/wxgui.py
   grass/trunk/gui/wxpython/xml/menudata.xml
Log:
wxGUI/mapcalc: fix 3D help, make overwrite option visible, find also interactive (3D) map calculator in command search

Modified: grass/trunk/gui/wxpython/gui_modules/mcalc_builder.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mcalc_builder.py	2010-05-12 18:59:12 UTC (rev 42246)
+++ grass/trunk/gui/wxpython/gui_modules/mcalc_builder.py	2010-05-13 13:16:38 UTC (rev 42247)
@@ -38,15 +38,22 @@
     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):
+                 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
-        wx.Frame.__init__(self, parent, id = id, title = title, **kwargs)
+        # grass command
+        self.cmd = kwargs['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)
         self.SetIcon(wx.Icon(os.path.join(globalvar.ETCICONDIR, 'grass.ico'), wx.BITMAP_TYPE_ICO))
         
         self.panel = wx.Panel(parent = self, id = wx.ID_ANY)
@@ -201,7 +208,7 @@
                                     style = wx.CB_DROPDOWN |
                                     wx.CB_READONLY | wx.TE_PROCESS_ENTER)
         
-        self.overwrite = wx.CheckBox(parent = self, id = wx.ID_ANY,
+        self.overwrite = wx.CheckBox(parent = self.panel, id = wx.ID_ANY,
                                      label=_("Allow output files to overwrite existing files"))
         self.overwrite.SetValue(UserSettings.Get(group='cmd', key='overwrite', subkey='enabled'))
         
@@ -308,7 +315,8 @@
         sizer.Add(item = expressSizer, proportion = 1,
                   flag = wx.EXPAND | wx.LEFT | wx.RIGHT,
                   border = 5)
-        sizer.Add(item = self.overwrite, flag = wx.EXPAND | wx.LEFT | wx.RIGHT,
+        sizer.Add(item = self.overwrite, proportion = 0,
+                  flag = wx.EXPAND | wx.LEFT | wx.RIGHT,
                       border = 5)
         sizer.Add(item = buttonSizer4, proportion = 0,
                   flag = wx.ALIGN_RIGHT | wx.ALL, border = 1)
@@ -400,13 +408,9 @@
         
         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('expression=%s = %s' % (name, mctxt))]
+            cmd = [self.cmd, str('expression=%s = %s' % (name, mctxt))]
             if self.overwrite.IsChecked():
                 cmd.append('--overwrite')
             self.log.RunCmd(cmd)
@@ -416,7 +420,7 @@
                 overwrite = True
             else:
                 overwrite = False
-            gcmd.RunCommand(prg,
+            gcmd.RunCommand(self.cmd,
                             expression = "%s=%s" % (name, mctxt),
                             overwrite = overwrite)
         
@@ -428,7 +432,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/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py	2010-05-12 18:59:12 UTC (rev 42246)
+++ grass/trunk/gui/wxpython/wxgui.py	2010-05-13 13:16:38 UTC (rev 42247)
@@ -956,18 +956,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/trunk/gui/wxpython/xml/menudata.xml
===================================================================
--- grass/trunk/gui/wxpython/xml/menudata.xml	2010-05-12 18:59:12 UTC (rev 42246)
+++ grass/trunk/gui/wxpython/xml/menudata.xml	2010-05-13 13:16:38 UTC (rev 42247)
@@ -1006,7 +1006,9 @@
 	    <menuitem>
 	      <label>Interactive map calculator</label>
 	      <help>Map calculator for raster map algebra.</help>
+	      <keywords>raster,algebra</keywords>
 	      <handler>OnMapCalculator</handler>
+	      <command>r.mapcalc</command>
 	    </menuitem>
 	    <menuitem>
 	      <label>Map calculator</label>
@@ -2783,7 +2785,9 @@
 	    <menuitem>
 	      <label>Interactive map calculator</label>
 	      <help>Map calculator for raster map algebra.</help>
+	      <keywords>raster,algebra</keywords>
 	      <handler>OnMapCalculator3D</handler>
+	      <command>r3.mapcalc</command>
 	    </menuitem>
 	    <menuitem>
 	      <label>Map calculator</label>



More information about the grass-commit mailing list