[GRASS-SVN] r72551 - grass/trunk/gui/wxpython/modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Mar 24 04:31:03 PDT 2018
Author: marisn
Date: 2018-03-24 04:31:02 -0700 (Sat, 24 Mar 2018)
New Revision: 72551
Modified:
grass/trunk/gui/wxpython/modules/mcalc_builder.py
Log:
Raster calculator: Do not add extra spaces;
Better insertion position handling.
Modified: grass/trunk/gui/wxpython/modules/mcalc_builder.py
===================================================================
--- grass/trunk/gui/wxpython/modules/mcalc_builder.py 2018-03-24 11:24:00 UTC (rev 72550)
+++ grass/trunk/gui/wxpython/modules/mcalc_builder.py 2018-03-24 11:31:02 UTC (rev 72551)
@@ -568,6 +568,8 @@
self._addSomething(item)
win.ChangeValue('') # reset
+ # Map selector likes to keep focus. Set it back to expression input area
+ wx.CallAfter(self.text_mcalc.SetFocus)
def OnUpdateStatusBar(self, event):
"""Update statusbar text"""
@@ -619,8 +621,17 @@
except:
pass
- newmcalcstr += what + ' ' + mcalcstr[position:]
-
+ newmcalcstr += what
+
+ # Do not add extra space if there is already one
+ try:
+ if newmcalcstr[-1] != ' ' and mcalcstr[position] != ' ':
+ newmcalcstr += ' '
+ except:
+ newmcalcstr += ' '
+
+ newmcalcstr += mcalcstr[position:]
+
self.text_mcalc.SetValue(newmcalcstr)
if len(what) > 0:
match = re.search(pattern="\(.*\)", string=what)
@@ -628,6 +639,11 @@
position_offset += match.start() + 1
else:
position_offset += len(what)
+ try:
+ if newmcalcstr[position + position_offset] == ' ':
+ position_offset += 1
+ except:
+ pass
self.text_mcalc.SetInsertionPoint(position + position_offset)
self.text_mcalc.Update()
More information about the grass-commit
mailing list