[GRASS-SVN] r59941 - grass/trunk/gui/wxpython/modules

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Apr 25 06:01:30 PDT 2014


Author: martinl
Date: 2014-04-25 06:01:30 -0700 (Fri, 25 Apr 2014)
New Revision: 59941

Modified:
   grass/trunk/gui/wxpython/modules/mcalc_builder.py
Log:
wxGUI/map_calc: fix selection


Modified: grass/trunk/gui/wxpython/modules/mcalc_builder.py
===================================================================
--- grass/trunk/gui/wxpython/modules/mcalc_builder.py	2014-04-24 22:00:33 UTC (rev 59940)
+++ grass/trunk/gui/wxpython/modules/mcalc_builder.py	2014-04-25 13:01:30 UTC (rev 59941)
@@ -257,7 +257,8 @@
         self.btn_load.Bind(wx.EVT_BUTTON, self.OnLoadExpression)
         self.btn_copy.Bind(wx.EVT_BUTTON, self.OnCopy)
         
-        self.mapselect.Bind(wx.EVT_TEXT, self.OnSelectTextEvt)
+        # self.mapselect.Bind(wx.EVT_TEXT, self.OnSelectTextEvt)
+        self.mapselect.Bind(wx.EVT_TEXT, self.OnSelect)
         self.function.Bind(wx.EVT_COMBOBOX, self._return_funct)
         self.function.Bind(wx.EVT_TEXT_ENTER, self.OnSelect)
         self.newmaptxt.Bind(wx.EVT_TEXT, self.OnUpdateStatusBar)
@@ -271,7 +272,11 @@
     def _return_funct(self,event):
         i = event.GetString()
         self._addSomething(self.funct_dict[i])
-    
+        
+        # reset
+        win = self.FindWindowById(event.GetId())
+        win.SetValue('')
+        
     def _layout(self):
         sizer = wx.BoxSizer(wx.VERTICAL)
         
@@ -424,15 +429,17 @@
         elif event.GetId() == self.btn['parenr'].GetId(): mark = ")"
         self._addSomething(mark)
         
-    def OnSelectTextEvt(self, event):
-        """!Checks if user is typing or the event was emited by map selection.
-        Prevents from changing focus.
-        """
-        item = self.mapselect.GetValue().strip()
-        if not (abs(len(item) - len(self.lastMapName)) == 1  and \
-            self.lastMapName in item or item in self.lastMapName):
-            self.OnSelect(event)
-        self.lastMapName = item
+    ### unused
+    # def OnSelectTextEvt(self, event):
+    #     """!Checks if user is typing or the event was emited by map selection.
+    #     Prevents from changing focus.
+    #     """
+    #     item = self.mapselect.GetValue().strip()
+    #     if not (abs(len(item) - len(self.lastMapName)) == 1 and \
+    #         self.lastMapName in item or item in self.lastMapName):
+    #         self.OnSelect(event)
+        
+    #     self.lastMapName = item
 
     def OnSelect(self, event):
         """!Gets raster map or function selection and send it to
@@ -441,11 +448,14 @@
         Checks for characters which can be in raster map name but 
         the raster map name must be then quoted.
         """
-        item = self.FindWindowById(event.GetId()).GetValue().strip()
+        win = self.FindWindowById(event.GetId())
+        item = event.GetString().strip()
         if any((char in item) for char in self.charactersToQuote):
             item = '"' + item + '"'
         self._addSomething(item)
-
+        
+        win.ChangeValue('') # reset
+        
     def OnUpdateStatusBar(self, event):
         """!Update statusbar text"""
         command = self._getCommand()



More information about the grass-commit mailing list