enthought / enthought/traitsui
Bug: Tree editor does not update in the UI
- Dominant language
- Python
- Stars
- 306
- Forks
- 99
- PR merge metrics
- No merged PRs in 30d
Description
I've attached a semi-minimal example, but a tree editor item does not update in the UI when data is added to the object if the tree editor has `hide_root=True`, the item is `style='custom'` and has a `visible_when` criteria, and the Group has `scrollable=True`.
I am not seeing any error message when running this code.
Semi-Minimal example
```
from traits.api import Instance, List, Str, Button, Bool, HasTraits
from traitsui.api import (
Group, Item, ModelView, TreeEditor, TreeNode, View, UItem,)
class Data_Group(HasTraits):
name = Str
class Holder(HasTraits):
name = Str
Data_Groups = List(Instance(Data_Group))
class SimpleExample(ModelView):
model = Instance(Holder)
# Adds another Data_Group
button = Button('Add')
def _button_fired(self):
yeah = Data_Group(name='frank')
self.model.Data_Groups.append(yeah)
def default_traits_view(self):
tree_editor = TreeEditor(
nodes=[
TreeNode(
node_for=[Holder],
auto_open=True,
children='Data_Groups',
label='',
),
TreeNode(
node_for=[Data_Group],
auto_open=False,
label='name',
),
],
# If hide_root is commented out(or set to false) it works
hide_root=True,
orientation='vertical',
)
return View(
Group(
Item(
name='model',
editor=tree_editor,
resizable=True,
show_label=False,
),
Item('button'),
show_border=True,
),
title='Measurement Groups',
width=500,
resizable=True,
)
class SimpleView(ModelView):
model = Instance(SimpleExample)
show_measurement_groups_table = Bool()
def default_traits_view(self):
return View(
Group(
Item(name='show_measurement_groups_table',
),
UItem(
'model',
# If style is commented out it works
style='custom',
# If visible_when is commented out it works
visible_when='show_measurement_groups_table',
),
),
resizable=True,
# If scrollable is commented out it works
scrollable=True,
)
if __name__ == '__main__':
temp = Holder(name='test')
collection = SimpleExample(model=temp)
mcv = SimpleView(model=collection)
mcv.configure_traits()
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.