[GRASS-SVN] r42192 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sun May 9 13:09:48 EDT 2010


Author: martinl
Date: 2010-05-09 13:09:47 -0400 (Sun, 09 May 2010)
New Revision: 42192

Modified:
   grass/trunk/gui/wxpython/gui_modules/mcalc_builder.py
Log:
wxGUI/mapcalc: fix inserting operands


Modified: grass/trunk/gui/wxpython/gui_modules/mcalc_builder.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mcalc_builder.py	2010-05-09 16:59:07 UTC (rev 42191)
+++ grass/trunk/gui/wxpython/gui_modules/mcalc_builder.py	2010-05-09 17:09:47 UTC (rev 42192)
@@ -345,31 +345,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