Extended listeners on delegates don't always fire.
- Dominant language
- Python
- Stars
- 462
- Forks
- 90
- PR merge metrics
- No merged PRs in 30d
Description
In the code below, the `on_trait_change` listener doesn't fire until after we've replaced the `parameters` instance with a new one.
``` python
from traits.api import DelegatesTo, HasStrictTraits, Instance, Int, on_trait_change
class Parameters(HasStrictTraits):
combination = Int
class Workflow(HasStrictTraits):
parameters = Instance(Parameters)
class View(HasStrictTraits):
workflow = Instance(Workflow)
parameters = DelegatesTo('workflow')
@on_trait_change('parameters.combination', post_init=True)
def report_change(self, new):
print "combination changed to: ", new
parameters = Parameters()
workflow = Workflow(parameters=parameters)
run_tab_view = View(workflow=workflow)
# No notifications from these lines.
parameters.combination = 3
parameters.combination = 4
# After setting new parameters, we do get notifications.
workflow.parameters = Parameters()
workflow.parameters.combination = 3
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.