[GRASS-SVN] r53663 - in grass/trunk/gui/wxpython: gmodeler gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Nov 2 06:02:16 PDT 2012


Author: martinl
Date: 2012-11-02 06:02:14 -0700 (Fri, 02 Nov 2012)
New Revision: 53663

Modified:
   grass/trunk/gui/wxpython/gmodeler/dialogs.py
   grass/trunk/gui/wxpython/gui_core/ghelp.py
   grass/trunk/gui/wxpython/gui_core/prompt.py
Log:
wxGUI/prompt: hide auto-complete when closing dialog


Modified: grass/trunk/gui/wxpython/gmodeler/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/dialogs.py	2012-11-02 12:46:29 UTC (rev 53662)
+++ grass/trunk/gui/wxpython/gmodeler/dialogs.py	2012-11-02 13:02:14 UTC (rev 53663)
@@ -113,6 +113,7 @@
             event.Skip()
         else:
             self.Destroy()
+
 class ModelSearchDialog(wx.Dialog):
     def __init__(self, parent, id = wx.ID_ANY, title = _("Add new GRASS module to the model"),
                  style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER, **kwargs):
@@ -149,6 +150,7 @@
         self.cmd_prompt.Bind(wx.EVT_KEY_UP, self.OnText)
         self.search.searchChoice.Bind(wx.EVT_CHOICE, self.OnText)
         self.Bind(wx.EVT_BUTTON, self.OnOk, self.btnOk)
+        self.Bind(wx.EVT_BUTTON, self.OnCancel, self.btnCancel)
         
         self._layout()
         
@@ -196,6 +198,10 @@
     
     def OnOk(self, event):
         """!Button 'OK' pressed"""
+        # hide autocomplete
+        if self.cmd_prompt.AutoCompActive():
+            self.cmd_prompt.AutoCompCancel()
+        
         self.btnOk.SetFocus()
         cmd = self.GetCmd()
         
@@ -213,6 +219,14 @@
         
         self.EndModal(wx.ID_OK)
         
+    def OnCancel(self, event):
+        """Cancel pressed, close window"""
+        # hide autocomplete
+        if self.cmd_prompt.AutoCompActive():
+            self.cmd_prompt.AutoCompCancel()
+        
+        self.Hide()
+        
     def OnText(self, event):
         """!Text in prompt changed"""
         if self.cmd_prompt.AutoCompActive():

Modified: grass/trunk/gui/wxpython/gui_core/ghelp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/ghelp.py	2012-11-02 12:46:29 UTC (rev 53662)
+++ grass/trunk/gui/wxpython/gui_core/ghelp.py	2012-11-02 13:02:14 UTC (rev 53663)
@@ -128,6 +128,10 @@
             event.Skip()
             return
         
+        # hide autocomplete
+        if self.cmdPrompt.AutoCompActive():
+            self.cmdPrompt.AutoCompCancel()
+        
         text = event.GetEventObject().GetValue()
         if not text:
             self.cmdPrompt.SetFilter(None)

Modified: grass/trunk/gui/wxpython/gui_core/prompt.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/prompt.py	2012-11-02 12:46:29 UTC (rev 53662)
+++ grass/trunk/gui/wxpython/gui_core/prompt.py	2012-11-02 13:02:14 UTC (rev 53663)
@@ -726,7 +726,7 @@
         # create command and map lists for autocompletion
         #
         self.AutoCompSetIgnoreCase(False) 
-        
+                
         #
         # line margins
         #
@@ -942,7 +942,7 @@
         """
         # keycodes used: "." = 46, "=" = 61, "-" = 45 
         pos = self.GetCurrentPos()
-        #complete command after pressing '.'
+        # complete command after pressing '.'
         if event.GetKeyCode() == 46 and not event.ShiftDown():
             self.autoCompList = list()
             entry = self.GetTextLeft()



More information about the grass-commit mailing list