RIDE icon indicating copy to clipboard operation
RIDE copied to clipboard

Treeview not updated when editing variable section

Open JFoederer opened this issue 1 year ago • 1 comments

When using the grid editor to add or remove variables from a test suite file's variables section, the file is updated as expected but the changes are not applied to the treeview.

In the screenshot you see ${a} and ${b} still visible, while I have removed them and the newly added ${x} is not added. image

RIDE v2.1dev50, Python 3.11, Windows

JFoederer avatar Jun 30 '24 13:06 JFoederer

Observed error when adding ${x} after deleting ${a} and ${b} variables:

Error in listener: Tree._variable_added_3952, topic: ride.variable.added

Traceback (most recent call last):
None
  File "/home/helio/.local/lib/python3.12/site-packages/pubsub/core/topicobj.py", line 482, in __sendMessage
    listener(data, self, allData)
  File "/home/helio/.local/lib/python3.12/site-packages/pubsub/core/listener.py", line 237, in __call__
    cb(**kwargs)
  File "/home2/helio/github/RIDE/src/robotide/ui/treeplugin.py", line 657, in _variable_added
    self._get_or_create_node(
  File "/home2/helio/github/RIDE/src/robotide/ui/treeplugin.py", line 632, in _get_or_create_node
    index = self._get_insertion_index(parent_node, predicate)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home2/helio/github/RIDE/src/robotide/ui/treeplugin.py", line 644, in _get_insertion_index
    if predicate(self.controller.get_handler(item)):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home2/helio/github/RIDE/src/robotide/ui/treeplugin.py", line 660, in <lambda>
    lambda item: not item.is_variable or item.index > message.index)
                                         ^^^^^^^^^^
  File "/home2/helio/github/RIDE/src/robotide/ui/treenodehandlers.py", line 807, in index
    return self.controller.index
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home2/helio/github/RIDE/src/robotide/controller/settingcontrollers.py", line 454, in index
    return self.parent.index(self)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home2/helio/github/RIDE/src/robotide/controller/tablecontrollers.py", line 94, in index
    return [v for v in self].index(ctrl)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Main cause is, deletion of variables not updated in Tree.

Observed in Fedora 40, Python 3.12, wxPython 4.2.1, RIDE v2.1dev54.

HelioGuilherme66 avatar Jun 30 '24 14:06 HelioGuilherme66