Jelajahi Sumber

wxGUI/prompt: parse only GRASS modules

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@37423 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 16 tahun lalu
induk
melakukan
06dd0a9e09
1 mengubah file dengan 15 tambahan dan 13 penghapusan
  1. 15 13
      gui/wxpython/gui_modules/prompt.py

+ 15 - 13
gui/wxpython/gui_modules/prompt.py

@@ -355,21 +355,23 @@ class TextCtrlAutoComplete(wx.TextCtrl, listmix.ColumnSorterMixin):
         pattern = str(text)
         if len(cmd) > 1:
             # search for module's options
-            if not self._module:
+            if cmd[0] in self._choicesCmd and not self._module:
                 self._module = menuform.GUI().ParseInterface(cmd = cmd)
-            if len(cmd[-1].split('=', 1)) == 1:
-                # new option
-                if cmd[-1][0] == '-':
-                    # -> flags
-                    self.SetChoices(self._module.get_list_flags(), type = 'flag')
-                    pattern = cmd[-1].lstrip('-')
+
+            if self._module:
+                if len(cmd[-1].split('=', 1)) == 1:
+                    # new option
+                    if cmd[-1][0] == '-':
+                        # -> flags
+                        self.SetChoices(self._module.get_list_flags(), type = 'flag')
+                        pattern = cmd[-1].lstrip('-')
+                    else:
+                        # -> options
+                        self.SetChoices(self._module.get_list_params(), type = 'param')
+                        pattern = cmd[-1]
                 else:
-                    # -> options
-                    self.SetChoices(self._module.get_list_params(), type = 'param')
-                    pattern = cmd[-1]
-            else:
-                # value
-                pattern = cmd[-1].split('=', 1)[1]
+                    # value
+                    pattern = cmd[-1].split('=', 1)[1]
         else:
             # search for GRASS modules
             if self._module: