浏览代码

wxGUI/prompt: update autocomplete map list when there is a change in db (#1573)

Anna Petrasova 3 年之前
父节点
当前提交
6226ab0f35
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      gui/wxpython/gui_core/prompt.py

+ 8 - 0
gui/wxpython/gui_core/prompt.py

@@ -70,6 +70,11 @@ class GPrompt(object):
         # list of traced commands
         self.commands = list()
 
+        # reload map lists when needed
+        if giface:
+            giface.currentMapsetChanged.connect(self._reloadListOfMaps)
+            giface.grassdbChanged.connect(self._reloadListOfMaps)
+
     def _readHistory(self):
         """Get list of commands from history file"""
         hist = list()
@@ -110,6 +115,9 @@ class GPrompt(object):
 
         return result
 
+    def _reloadListOfMaps(self):
+        self.mapList = self._getListOfMaps()
+
     def _runCmd(self, cmdString):
         """Run command