Browse Source

wxGUI/mcalc: fix inserting point for one-character operators

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@58005 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 11 years ago
parent
commit
b8c1532d78
1 changed files with 3 additions and 3 deletions
  1. 3 3
      gui/wxpython/modules/mcalc_builder.py

+ 3 - 3
gui/wxpython/modules/mcalc_builder.py

@@ -6,7 +6,7 @@
 Classes:
 Classes:
  - mcalc_builder::MapCalcFrame
  - mcalc_builder::MapCalcFrame
 
 
-(C) 2008, 2011-2012 by the GRASS Development Team
+(C) 2008, 2011-2013 by the GRASS Development Team
 
 
 This program is free software under the GNU General Public License
 This program is free software under the GNU General Public License
 (>=v2). Read the file COPYING that comes with GRASS for details.
 (>=v2). Read the file COPYING that comes with GRASS for details.
@@ -450,7 +450,6 @@ class MapCalcFrame(wx.Frame):
     def _addSomething(self, what):
     def _addSomething(self, what):
         """!Inserts operators, map names, and functions into text area
         """!Inserts operators, map names, and functions into text area
         """
         """
-        self.text_mcalc.SetFocus()
         mcalcstr  = self.text_mcalc.GetValue()
         mcalcstr  = self.text_mcalc.GetValue()
         position  = self.text_mcalc.GetInsertionPoint()
         position  = self.text_mcalc.GetInsertionPoint()
         
         
@@ -467,7 +466,7 @@ class MapCalcFrame(wx.Frame):
         newmcalcstr += what + ' ' + mcalcstr[position:]
         newmcalcstr += what + ' ' + mcalcstr[position:]
         
         
         self.text_mcalc.SetValue(newmcalcstr)
         self.text_mcalc.SetValue(newmcalcstr)
-        if len(what) > 1:
+        if len(what) > 0:
             match = re.search(pattern="\(.*\)", string=what)
             match = re.search(pattern="\(.*\)", string=what)
             if match:
             if match:
                 position_offset += match.start() + 1
                 position_offset += match.start() + 1
@@ -476,6 +475,7 @@ class MapCalcFrame(wx.Frame):
 
 
         self.text_mcalc.SetInsertionPoint(position + position_offset)
         self.text_mcalc.SetInsertionPoint(position + position_offset)
         self.text_mcalc.Update()
         self.text_mcalc.Update()
+        self.text_mcalc.SetFocus()
         
         
     def OnMCalcRun(self,event):
     def OnMCalcRun(self,event):
         """!Builds and runs r.mapcalc statement
         """!Builds and runs r.mapcalc statement