-
Notifications
You must be signed in to change notification settings - Fork 26
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
Support for observe in ExtensionPoint #291
Comments
I think we need to explore this for the 5.0.0 release (doesn't have to be merged into master) because it might bring up potential issues when we move to using traits |
For reference, I think |
I have so far attempted two approaches, neither were successful: (1) Reimplement ExtensionRegistry and friends with observe (2) Caching the TraitListObject returned by envisage/envisage/tests/test_extension_point.py Lines 114 to 137 in 71a913c
In particular, it would fail on the very last line with As I said in #346, I think the naming of "name_items" is unfortunate: It is not the same as "name_items" in Traits's on_trait_change framework (as is demonstrated by this other test in #346). Had it been called something else, one would not have tried to convert it to My next idea is for |
That idea also does not work because although an event can be fired for At the end, I have to subclass TraitList and have it cached on the object, and at the same time, prevent mutations to occur directly on the list. PR coming... |
We had to revert #354; re-opening this issue accordingly. |
Traits 6.1 introduces a new trait notification/observation framework:
observe
. The mini-language for this framework has changed for observing mutations in a container such as a list.Currently
ExtensionPoint
emits property change event using a trait named name and name_items. This allows users to useon_trait_change
as if anExtensionPoint
was aList
and listen to "mutations" to it even though the list is never cached. In other words, it behaves as if it was twoProperty
combined. Changingon_trait_change("name_items")
toobserve("name:items")
won't work as expected. This issue is about how to makeExtensionPoint
be compatible withobserve
.I might be able to put together a small example and post here later.
The text was updated successfully, but these errors were encountered: