Browse Source

wxGUI/prompt: bug fix when command is not selected from the list

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@40135 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 15 years ago
parent
commit
0d47d566f3
1 changed files with 14 additions and 3 deletions
  1. 14 3
      gui/wxpython/gui_modules/prompt.py

+ 14 - 3
gui/wxpython/gui_modules/prompt.py

@@ -614,7 +614,7 @@ class GPromptPopUp(GPrompt, TextCtrlAutoComplete):
         self.Bind(wx.EVT_TEXT,       self.OnUpdateStatusBar)
         
     def __checkKey(self, text, keywords):
-        """!Check if text is in keywords"""
+        """!Check if text is in keywords (unused)"""
         found = 0
         keys = text.split(',')
         if len(keys) > 1: # -> multiple keys
@@ -646,7 +646,7 @@ class GPromptPopUp(GPrompt, TextCtrlAutoComplete):
 
 class GPromptSTC(GPrompt, wx.stc.StyledTextCtrl):
     """!Styled wxGUI prompt with autocomplete and calltips"""    
-    def __init__(self, parent, id = wx.ID_ANY, margin = False, wrap = None):
+    def __init__(self, parent, id = wx.ID_ANY, margin = False):
         GPrompt.__init__(self, parent)
         wx.stc.StyledTextCtrl.__init__(self, self.panel, id)
         
@@ -869,7 +869,18 @@ class GPromptSTC(GPrompt, wx.stc.StyledTextCtrl):
             if len(self.cmdbuffer) > 200:
                 del self.cmdbuffer[0]
             self.cmdindex = len(self.cmdbuffer)
-            
+
+        elif event.GetKeyCode() == wx.WXK_SPACE:
+            items = self.GetTextLeft().split()
+            if len(items) == 1:
+                cmd = items[0].strip()
+                if not self.cmdDesc or cmd != self.cmdDesc.get_name():
+                    try:
+                        self.cmdDesc = menuform.GUI().ParseInterface(cmd = [cmd])
+                    except IOError:
+                        self.cmdDesc = None
+            event.Skip()
+        
         else:
             event.Skip()