瀏覽代碼

wxGUI/prompt: fix autocompletion

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@53887 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 12 年之前
父節點
當前提交
f47e56427a
共有 2 個文件被更改,包括 10 次插入10 次删除
  1. 9 9
      gui/wxpython/core/modulesdata.py
  2. 1 1
      gui/wxpython/gui_core/prompt.py

+ 9 - 9
gui/wxpython/core/modulesdata.py

@@ -38,7 +38,7 @@ class ModulesData(object):
         else:
             self.moduleDesc = LayerManagerMenuData().GetModules()
 
-        self.moduleList = self._getListOfModules()
+        self.moduleDict = self.GetDictOfModules()
 
     def GetCommandDesc(self, cmd):
         """!Gets the description for a given module (command).
@@ -67,7 +67,7 @@ class ModulesData(object):
         """
         items = list()
 
-        mList = self.moduleList
+        mList = self.moduleDict
 
         prefixes = mList.keys()
         prefixes.sort()
@@ -82,12 +82,12 @@ class ModulesData(object):
 
         return items
 
-    def _getListOfModules(self):
-        """!Gets list of modules as a dictionary optimized for autocomplete.
+    def GetDictOfModules(self):
+        """!Gets modules as a dictionary optimized for autocomplete.
 
         \code
-        print data._getListOfModules()['r'][0:4]
-        print data._getListOfModules()['r.li'][0:4]
+        print data.GetDictOfModules()['r'][0:4]
+        print data.GetDictOfModules()['r.li'][0:4]
         r: ['basins.fill', 'bitpattern', 'blend', 'buffer']
         r.li: ['cwed', 'dominance', 'edgedensity', 'mpa']
         \endcode
@@ -164,9 +164,9 @@ class ModulesData(object):
         @param data data dict
         """
         if data:
-            self.moduleList = data
+            self.moduleDict = data
         else:
-            self.moduleList = self._getListOfModules()
+            self.moduleDict = self.GetDictOfModules()
 
 
 def test():
@@ -175,7 +175,7 @@ def test():
     print '%s:' % module, data.GetCommandDesc(module)
     print '[0:5]:', data.GetCommandItems()[0:5]
 
-    modules = data._getListOfModules()  # pylint: disable=W0212
+    modules = data.GetDictOfModules()
     print 'r:', modules['r'][0:4]
     print 'r.li:', modules['r.li'][0:4]
     

+ 1 - 1
gui/wxpython/gui_core/prompt.py

@@ -883,7 +883,7 @@ class GPromptSTC(GPrompt, wx.stc.StyledTextCtrl):
             self.toComplete = self.EntityToComplete()
             try:
                 if self.toComplete['entity'] == 'command': 
-                    self.autoCompList = self.modulesData.GetCommandItems(entry.strip())
+                    self.autoCompList = self.modulesData.GetDictOfModules()[entry.strip()]
             except (KeyError, TypeError):
                 return
             self.ShowList()