diff --git a/gui/wxpython/history/browser.py b/gui/wxpython/history/browser.py index 223c518d315..e1d1ce37efe 100644 --- a/gui/wxpython/history/browser.py +++ b/gui/wxpython/history/browser.py @@ -94,7 +94,7 @@ def _layout(self): self.general_info_box_sizer, proportion=0, flag=wx.EXPAND | wx.ALL, border=5 ) mainSizer.Add( - self.region_settings_box_sizer, + self.sizer_region_settings, proportion=0, flag=wx.EXPAND | wx.ALL, border=5, @@ -137,12 +137,12 @@ def _createRegionSettingsBox(self): id=wx.ID_ANY, label=_("Computational region during command execution"), ) - self.region_settings_box_sizer = wx.StaticBoxSizer( + self.sizer_region_settings = wx.StaticBoxSizer( self.region_settings_box, wx.VERTICAL ) self.sizer_region_settings_match = wx.BoxSizer(wx.HORIZONTAL) - self.region_settings_box_sizer.Add( + self.sizer_region_settings.Add( self.sizer_region_settings_match, proportion=0, flag=wx.ALL | wx.EXPAND, @@ -153,7 +153,7 @@ def _createRegionSettingsBox(self): self.sizer_region_settings_grid.SetCols(2) self.sizer_region_settings_grid.SetRows(9) - self.region_settings_box_sizer.Add( + self.sizer_region_settings.Add( self.sizer_region_settings_grid, proportion=1, flag=wx.ALL | wx.EXPAND, @@ -173,7 +173,10 @@ def _region_settings_filter(self, key): return (key != "projection") and (key != "zone") and (key != "cells") def _updateGeneralInfoBox(self, command_info): - """Update a static box for displaying general info about the command""" + """Update a static box for displaying general info about the command. + + :param dict command_info: command info entry for update + """ self.sizer_general_info.Clear(True) idx = 0 @@ -206,8 +209,12 @@ def _updateGeneralInfoBox(self, command_info): self.general_info_box.Layout() self.general_info_box.Show() - def _updateRegionSettingsBox(self, command_info): - """Update a static box for displaying region settings of the command""" + def _updateRegionSettingsGrid(self, command_info): + """Update a grid that displays numerical values + for the regional settings of the executed command. + + :param dict command_info: command info entry for update + """ self.sizer_region_settings_grid.Clear(True) self.region_settings = command_info["region"] @@ -238,6 +245,10 @@ def _updateRegionSettingsBox(self, command_info): ) idx += 1 + self.region_settings_box.Show() + + def _updateRegionSettingsMatch(self): + """Update text, icon and button dealing with region update""" self.sizer_region_settings_match.Clear(True) # Region condition @@ -290,27 +301,26 @@ def _updateRegionSettingsBox(self, command_info): border=10, ) - self.region_settings_box.Layout() self.region_settings_box.Show() def showCommandInfo(self, command_info): - """Show command info input.""" + """Show command info input. + + :param dict command_info: command info entry for update + """ if command_info: self._updateGeneralInfoBox(command_info) - self._updateRegionSettingsBox(command_info) + self._updateRegionSettingsGrid(command_info) + self._updateRegionSettingsMatch() else: - self.clearCommandInfo() + self.hideCommandInfo() self.SetupScrolling(scroll_x=False, scroll_y=True) self.Layout() - def clearCommandInfo(self): - """Clear command info.""" - self.sizer_general_info.Clear(True) - self.sizer_region_settings_grid.Clear(True) - self.sizer_region_settings_text.Clear(True) - self._createGeneralInfoBox() - self._createRegionSettingsBox() - self._layout() + def hideCommandInfo(self): + """Hide command info input.""" + self.general_info_box.Hide() + self.region_settings_box.Hide() def _get_current_region(self): """Get current computational region settings.""" @@ -329,6 +339,8 @@ def OnUpdateRegion(self, event): history_region = self._get_history_region() gs.run_command("g.region", **history_region) self.giface.updateMap.emit(render=False, renderVector=False) + self._updateRegionSettingsMatch() + self.Layout() class HistoryBrowser(wx.SplitterWindow): diff --git a/gui/wxpython/history/tree.py b/gui/wxpython/history/tree.py index ead959fbaae..e99432cdde5 100644 --- a/gui/wxpython/history/tree.py +++ b/gui/wxpython/history/tree.py @@ -367,7 +367,7 @@ def UpdateHistoryModelFromScratch(self): """Reload tree history model based on the current history log from scratch.""" self._model.RemoveNode(self._model.root) self._initHistoryModel() - self.infoPanel.clearCommandInfo() + self.infoPanel.hideCommandInfo() def InsertCommand(self, entry): """Insert command node to the model and refresh the tree. @@ -499,7 +499,7 @@ def OnRemoveCmd(self, event): # Remove the entry from history self.RemoveEntryFromHistory(history_index) - self.infoPanel.clearCommandInfo() + self.infoPanel.hideCommandInfo() self._giface.entryFromHistoryRemoved.emit(index=history_index) self._model.RemoveNode(selected_command)