[GRASS-SVN] r42193 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sun May 9 13:11:25 EDT 2010


Author: martinl
Date: 2010-05-09 13:11:24 -0400 (Sun, 09 May 2010)
New Revision: 42193

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mcalc_builder.py
Log:
wxGUI/mapcalc: fix inserting operands
(merge r42192 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-09 17:09:47 UTC (rev 42192)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mcalc_builder.py	2010-05-09 17:11:24 UTC (rev 42193)
@@ -339,31 +339,30 @@
         """
         item = event.GetString()
         self._addSomething(item)
-        self.text_mcalc.SetFocus()
         
     def _addSomething(self,what):
         """!Inserts operators, map names, and functions into text area
         """
         self.text_mcalc.SetFocus()
-        mcalcstr = self.text_mcalc.GetValue()
-        newmcalcstr = ''
-        position = self.text_mcalc.GetInsertionPoint()
+        mcalcstr  = self.text_mcalc.GetValue()
+        position  = self.text_mcalc.GetInsertionPoint()
         
-        selection = self.text_mcalc.GetSelection()
-
         newmcalcstr = mcalcstr[:position]
         
+        position_offset = 0
         try:
             if newmcalcstr[-1] != ' ':
-                newmcalcstr += " "
+                newmcalcstr += ' '
+                position_offset += 1
         except:
             pass
+        
         newmcalcstr += what
-        position_offset = len(what)
-        newmcalcstr += " " + mcalcstr[position:]
+        position_offset += len(what)
+        newmcalcstr += ' ' + mcalcstr[position:]
         
         self.text_mcalc.SetValue(newmcalcstr)
-        self.text_mcalc.SetInsertionPoint(position+position_offset)
+        self.text_mcalc.SetInsertionPoint(position + position_offset)
         self.text_mcalc.Update()
         
     def OnMCalcRun(self,event):



More information about the grass-commit mailing list