[GRASS-SVN] r62608 - grass/trunk/gui/wxpython/gui_core
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Nov 4 19:53:15 PST 2014
Author: annakrat
Date: 2014-11-04 19:53:15 -0800 (Tue, 04 Nov 2014)
New Revision: 62608
Modified:
grass/trunk/gui/wxpython/gui_core/treeview.py
grass/trunk/gui/wxpython/gui_core/widgets.py
Log:
wxGUI/search tab: fixes for wxPython 3, fixed finding and showing modules in tree
Modified: grass/trunk/gui/wxpython/gui_core/treeview.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/treeview.py 2014-11-05 03:00:30 UTC (rev 62607)
+++ grass/trunk/gui/wxpython/gui_core/treeview.py 2014-11-05 03:53:15 UTC (rev 62608)
@@ -101,6 +101,8 @@
for i in range(len(index))[1:]:
item = self.GetItemByIndex(index[:i])
self.Expand(item)
+ # needed for wxPython 3:
+ self.EnsureVisible(item)
item = self.GetItemByIndex(index)
self.SelectItem(item, select)
Modified: grass/trunk/gui/wxpython/gui_core/widgets.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/widgets.py 2014-11-05 03:00:30 UTC (rev 62607)
+++ grass/trunk/gui/wxpython/gui_core/widgets.py 2014-11-05 03:53:15 UTC (rev 62608)
@@ -939,6 +939,7 @@
self._search.Bind(wx.EVT_TEXT, self.OnSearchModule)
self._search.Bind(wx.EVT_KEY_UP, self.OnKeyUp)
+ self._search.Bind(wx.EVT_TEXT_ENTER, self.OnEnter)
if self._showTip:
self._searchTip = StaticWrapText(parent = self, id = wx.ID_ANY,
@@ -978,13 +979,21 @@
def OnKeyUp(self, event):
"""Key or key combination pressed"""
if event.GetKeyCode() in (wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER) and not event.ControlDown():
- if self._results:
- self._resultIndex += 1
- if self._resultIndex == len(self._results):
- self._resultIndex = 0
- self.showSearchResult.emit(result=self._results[self._resultIndex])
+ self._showSearchResult()
event.Skip()
+ def OnEnter(self, event):
+ """Process EVT_TEXT_ENTER to show search results"""
+ self._showSearchResult()
+ event.Skip()
+
+ def _showSearchResult(self):
+ if self._results:
+ self._resultIndex += 1
+ if self._resultIndex == len(self._results):
+ self._resultIndex = 0
+ self.showSearchResult.emit(result=self._results[self._resultIndex])
+
def OnSearchModule(self, event):
"""Search module by keywords or description"""
value = self._search.GetValue()
More information about the grass-commit
mailing list