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

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jun 28 13:49:57 EDT 2009


Author: martinl
Date: 2009-06-28 13:49:56 -0400 (Sun, 28 Jun 2009)
New Revision: 38107

Modified:
   grass/trunk/gui/wxpython/gui_modules/prompt.py
Log:
wxGUI: prompt - on left mouse button pressed - show dropdown list


Modified: grass/trunk/gui/wxpython/gui_modules/prompt.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/prompt.py	2009-06-28 16:44:45 UTC (rev 38106)
+++ grass/trunk/gui/wxpython/gui_modules/prompt.py	2009-06-28 17:49:56 UTC (rev 38107)
@@ -278,6 +278,7 @@
         self.Bind(wx.EVT_KILL_FOCUS, self.OnControlChanged)
         self.Bind(wx.EVT_TEXT, self.OnEnteredText)
         self.Bind(wx.EVT_KEY_DOWN , self.OnKeyDown)
+        self.Bind(wx.EVT_LEFT_DOWN, self.OnClick)
 
         # if need drop down on left click
         self.dropdown.Bind(wx.EVT_LISTBOX , self.OnListItemSelected, self.dropdownlistbox)
@@ -435,6 +436,19 @@
         self._colSearch = 0
         self._colFetch = -1
 
+    def OnClick(self, event):
+        """Left mouse button pressed"""
+        sel = self.dropdownlistbox.GetFirstSelected()
+        if not self.dropdown.IsShown():
+            if sel > -1:
+                self.dropdownlistbox.Select(sel)
+            else:
+                self.dropdownlistbox.Select(0)
+            self._listItemVisible()
+            self._showDropDown()
+        else:
+            self.dropdown.Hide()
+        
     def OnCommandSelect(self, event):
         """!Command selected from history"""
         self.SetFocus()
@@ -560,7 +574,7 @@
             if sel > 0:
                 self.dropdownlistbox.Select(sel - 1)
                 self._listItemVisible()
-            self._showDropDown ()
+            self._showDropDown()
             skip = False
         
         if visible:



More information about the grass-commit mailing list