[GRASS-SVN] r44274 - grass/branches/releasebranch_6_4/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Nov 9 06:30:22 EST 2010


Author: martinl
Date: 2010-11-09 03:30:22 -0800 (Tue, 09 Nov 2010)
New Revision: 44274

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mcalc_builder.py
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/prompt.py
Log:
wxGUI/mapcalc: statusbar added
(merge r44273 from devbr6)


Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mcalc_builder.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mcalc_builder.py	2010-11-09 11:28:51 UTC (rev 44273)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mcalc_builder.py	2010-11-09 11:30:22 UTC (rev 44274)
@@ -38,7 +38,7 @@
 
 class MapCalcFrame(wx.Frame):
     """!Mapcalc Frame class. Calculator-style window to create and run
-    r(3).mapcalc statements
+    r(3).mapcalc statements.
     """
     def __init__(self, parent, cmd, id = wx.ID_ANY,
                  style = wx.DEFAULT_FRAME_STYLE | wx.RESIZE_BORDER, **kwargs):
@@ -62,6 +62,7 @@
         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)
+        self.CreateStatusBar()
         
         #
         # variables
@@ -240,7 +241,9 @@
         self.mapselect.Bind(wx.EVT_TEXT, self.OnSelect)
         self.function.Bind(wx.EVT_COMBOBOX, self.OnSelect)
         self.function.Bind(wx.EVT_TEXT_ENTER, self.OnSelect)
-        
+        self.newmaptxt.Bind(wx.EVT_TEXT, self.OnUpdateStatusBar)
+        self.text_mcalc.Bind(wx.EVT_TEXT, self.OnUpdateStatusBar)
+
         self._layout()
 
         self.SetMinSize(self.GetBestSize())
@@ -321,7 +324,7 @@
                          flag = wx.TOP | wx.BOTTOM | wx.RIGHT, border = 5)
         
         controlSizer.Add(item = operatorSizer, proportion = 1,
-                         flag = wx.RIGHT, border = 5)
+                         flag = wx.RIGHT | wx.EXPAND, border = 5)
         controlSizer.Add(item = operandSizer, proportion = 0,
                          flag = wx.EXPAND)
 
@@ -384,6 +387,12 @@
         """
         item = event.GetString()
         self._addSomething(item)
+
+    def OnUpdateStatusBar(self, event):
+        """!Update statusbar text"""
+        self.SetStatusText("r.mapcalc ' %s = %s'" % (self.newmaptxt.GetValue(),
+                                                     self.text_mcalc.GetValue()))
+        event.Skip()
         
     def _addSomething(self, what):
         """!Inserts operators, map names, and functions into text area
@@ -522,7 +531,7 @@
 
 if __name__ == "__main__":
     app = wx.App(0)
-    frame = MapCalcFrame(None)
+    frame = MapCalcFrame(parent = None, cmd = 'r.mapcalc')
     frame.Show()
     app.MainLoop()
 

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/prompt.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/prompt.py	2010-11-09 11:28:51 UTC (rev 44273)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/prompt.py	2010-11-09 11:30:22 UTC (rev 44274)
@@ -898,7 +898,10 @@
                 cmd = utils.split(utils.EncodeString((line)))
             
             #  send the command list to the processor 
-            self.parent.RunCmd(cmd)
+            if cmd[0] in ('r.mapcalc', 'r3.mapcalc'):
+                self.parent.parent.OnMapCalculator(event = None, cmd = cmd)
+            else:
+                self.parent.RunCmd(cmd)
             
             # add command to history    
             self.cmdbuffer.append(' '.join(cmd))



More information about the grass-commit mailing list