Browse Source

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

Anna Petrasova 3 years ago
parent
commit
6226ab0f35
1 changed files with 8 additions and 0 deletions
  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