Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

lindakarlovska
Copy link
Contributor

This PR addresses several interconnected enhancements that have been linked into a single PR:

  1. Command Ordering:
    Commands are now ordered from newest (at the top) to oldest. Originally, they were not sorted - there was not mechanism for that.

  2. Node Refresh Optimization:

  • Replaces the method _refreshTree(), which only refreshed and sorted day nodes, with _reloadNode(), which reloads and sorts both day nodes and command nodes.
  • When a node is updated with new information (after a command run finishes), the update is made directly to the node's attributes. Previously, the node was removed and re-added, which caused delay. Refreshing and sorting are now made through new methods in the new HistoryTreeModel .
  1. Refactoring:
    Necessary refactoring to support the changes in command ordering and optimization improvements.
@lindakarlovska lindakarlovska self-assigned this Jun 19, 2024
@lindakarlovska lindakarlovska added GUI wxGUI related enhancement New feature or request labels Jun 19, 2024
Co-authored-by: Anna Petrasova <kratochanna@gmail.com>
@lindakarlovska lindakarlovska added this to the 8.4.0 milestone Jun 19, 2024
def _reloadNode(self, node):
"""Reload the model of a specific node"""
self._model.SortChildren(node)
self.SetModel(copy.deepcopy(self._model))
Copy link
Contributor

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...

Copy link
Contributor

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!

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RefreshItems helped .. see a72e552

@lindakarlovska lindakarlovska changed the title wxGUI/history: ordering commands by time plus node refresh optimalization Jun 19, 2024
@github-actions github-actions bot added the Python Related code is in Python label Jun 19, 2024
@petrasovaa petrasovaa self-requested a review June 19, 2024 20:20
@lindakarlovska lindakarlovska requested review from petrasovaa and removed request for petrasovaa June 20, 2024 06:26
@neteler neteler modified the milestones: 8.4.0, 8.5.0 Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request GUI wxGUI related Python Related code is in Python
3 participants