[GRASS-SVN] r39938 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Dec 7 09:29:41 EST 2009


Author: martinl
Date: 2009-12-07 09:29:40 -0500 (Mon, 07 Dec 2009)
New Revision: 39938

Modified:
   grass/trunk/gui/wxpython/gui_modules/prompt.py
Log:
wxGUI/prompt: up/down - list history/modules right - get list of modules
	(merge r39937 from devbr6)


Modified: grass/trunk/gui/wxpython/gui_modules/prompt.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/prompt.py	2009-12-07 14:18:59 UTC (rev 39937)
+++ grass/trunk/gui/wxpython/gui_modules/prompt.py	2009-12-07 14:29:40 UTC (rev 39938)
@@ -240,9 +240,10 @@
         # some variables
         self._choices = choices
         self._hideOnNoMatch = True
-        self._module = None # currently selected module
-        self._choiceType = None # type of choice (module, params, flags, raster, vector ...)
+        self._module = None      # currently selected module
+        self._choiceType = None  # type of choice (module, params, flags, raster, vector ...)
         self._screenheight = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y)
+        self._historyItem = 0   # last item
         
         # sort variable needed by listmix
         self.itemDataMap = dict()
@@ -571,18 +572,37 @@
         sel = self.dropdownlistbox.GetFirstSelected()
         visible = self.dropdown.IsShown()
         KC = event.GetKeyCode()
-        if KC == wx.WXK_DOWN:
-            if sel < (self.dropdownlistbox.GetItemCount() - 1):
-                self.dropdownlistbox.Select(sel + 1)
-                self._listItemVisible()
-            self._showDropDown()
-            skip = False
+        if KC == wx.WXK_RIGHT:
+            if len(self.GetValue()) < 1 and not visible:
+                if sel < (self.dropdownlistbox.GetItemCount() - 1):
+                    self.dropdownlistbox.Select(sel + 1)
+                    self._listItemVisible()
+                self._showDropDown()
+                skip = False
         elif KC == wx.WXK_UP:
-            if sel > 0:
-                self.dropdownlistbox.Select(sel - 1)
-                self._listItemVisible()
-            self._showDropDown()
-            skip = False
+            if visible:
+                if sel > 0:
+                    self.dropdownlistbox.Select(sel - 1)
+                    self._listItemVisible()
+                self._showDropDown()
+                skip = False
+            else:
+                self._historyItem -= 1
+                try:
+                    self.SetValue(self.GetItems()[self._historyItem])
+                except IndexError:
+                    self._historyItem += 1
+        elif KC == wx.WXK_DOWN:
+            if visible:
+                if sel < (self.dropdownlistbox.GetItemCount() - 1):
+                    self.dropdownlistbox.Select(sel + 1)
+                    self._listItemVisible()
+                self._showDropDown()
+                skip = False
+            else:
+                if self._historyItem < -1:
+                    self._historyItem += 1
+                    self.SetValue(self.GetItems()[self._historyItem])
         
         if visible:
             if event.GetKeyCode() == wx.WXK_RETURN:



More information about the grass-commit mailing list