[GRASS-SVN] r62693 - in grass/branches/releasebranch_7_0: . gui/wxpython/gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Nov 10 07:39:57 PST 2014


Author: annakrat
Date: 2014-11-10 07:39:57 -0800 (Mon, 10 Nov 2014)
New Revision: 62693

Modified:
   grass/branches/releasebranch_7_0/
   grass/branches/releasebranch_7_0/gui/wxpython/gui_core/treeview.py
   grass/branches/releasebranch_7_0/gui/wxpython/gui_core/widgets.py
Log:
wxGUI/search tab: fixes for wxPython 3, fixed finding and showing modules in tree (merge from trunk, r62608)


Property changes on: grass/branches/releasebranch_7_0
___________________________________________________________________
Modified: svn:mergeinfo
   - /grass/trunk:61096,62179-62180,62182,62403,62422,62424,62437,62466,62487,62491,62494,62501,62506,62508-62509,62515,62518-62519,62521,62526,62533,62539,62541,62555,62562,62570,62573,62575,62585,62588,62597,62603,62606,62609,62614,62618,62628,62632,62638,62642,62648-62649,62652,62655-62657,62666
   + /grass/trunk:61096,62179-62180,62182,62403,62422,62424,62437,62466,62487,62491,62494,62501,62506,62508-62509,62515,62518-62519,62521,62526,62533,62539,62541,62555,62562,62570,62573,62575,62585,62588,62597,62603,62606,62608-62609,62614,62618,62628,62632,62638,62642,62648-62649,62652,62655-62657,62666

Modified: grass/branches/releasebranch_7_0/gui/wxpython/gui_core/treeview.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/gui_core/treeview.py	2014-11-10 15:35:05 UTC (rev 62692)
+++ grass/branches/releasebranch_7_0/gui/wxpython/gui_core/treeview.py	2014-11-10 15:39:57 UTC (rev 62693)
@@ -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/branches/releasebranch_7_0/gui/wxpython/gui_core/widgets.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/gui_core/widgets.py	2014-11-10 15:35:05 UTC (rev 62692)
+++ grass/branches/releasebranch_7_0/gui/wxpython/gui_core/widgets.py	2014-11-10 15:39:57 UTC (rev 62693)
@@ -865,6 +865,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,
@@ -904,13 +905,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