-
-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wxGUI/history: Order commands by time and optimize node refresh #3896
base: main
Are you sure you want to change the base?
wxGUI/history: Order commands by time and optimize node refresh #3896
Conversation
Co-authored-by: Anna Petrasova <kratochanna@gmail.com>
gui/wxpython/history/tree.py
Outdated
def _reloadNode(self, node): | ||
"""Reload the model of a specific node""" | ||
self._model.SortChildren(node) | ||
self.SetModel(copy.deepcopy(self._model)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may work, but this line looks strange to me...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But otherwise it looks like it works nicely!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, the behavior is a bit strange here.. First I assumed that it should work without SetModel line, just:
self._model.SortChildren(node)
self._orig_model = copy.deepcopy(self._model)
similarly as it is in a datacatalog.
But in our case, the history tree is not loaded - just empty panel is shown .. So I tried another variant:
def _reloadNode(self, node):
"""Reload the model of a specific node"""
self._model.SortChildren(node)
self._orig_model = copy.deepcopy(self._model)
if node != self._model.root:
self.RefreshNode(node)
but the result was the same, again no error and the panel is empty.
What works is this:
def _reloadNode(self, node):
"""Reload the model of a specific node"""
self._model.SortChildren(node)
self._orig_model = copy.deepcopy(self._model)
self.SetModel(self._model)
which looks a bit better than the original method but no glory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RefreshItems helped .. see a72e552
This PR addresses several interconnected enhancements that have been linked into a single PR:
Command Ordering:
Commands are now ordered from newest (at the top) to oldest. Originally, they were not sorted - there was not mechanism for that.
Node Refresh Optimization:
_refreshTree()
, which only refreshed and sorted day nodes, with_reloadNode()
, which reloads and sorts both day nodes and command nodes.HistoryTreeModel
.Necessary refactoring to support the changes in command ordering and optimization improvements.