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

items in lists are not removed if list in message is empty #33

Open
MatthijsBurgh opened this issue May 13, 2021 · 2 comments
Open

items in lists are not removed if list in message is empty #33

MatthijsBurgh opened this issue May 13, 2021 · 2 comments

Comments

@MatthijsBurgh
Copy link
Contributor

When a message contains a list and the list has reduced to zero, the old list items are still shown. As the code which removes the list items is not reached when the list is empty.

The code that executes the deletion is

# remove obsolete children
if len(message) < self._tree_items[topic_name].childCount():
for i in range(len(message), self._tree_items[topic_name].childCount()):
item_topic_name = topic_name + '[%d]' % i
self._recursive_delete_widget_items(self._tree_items[item_topic_name])

@audrow
Copy link
Collaborator

audrow commented Dec 20, 2021

Thanks for pointing this out @MatthijsBurgh. If you want to make a PR for this, feel free to @ me as a reviewer.

@MatthijsBurgh
Copy link
Contributor Author

I have tried in the past. I wasn't able to come up with a good solution then. It was hard to find good if/else conditions. Especially if you want to detect whether the list should be a list of messages. This is especially difficult if the list is empty.

MrVolans added a commit to MrVolans/rqt_topic that referenced this issue Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants