Replace on_trait_change with observe#285
Conversation
rahulporuri
left a comment
There was a problem hiding this comment.
LGTM with a few comments/suggestions.
|
|
||
| # Listen for the object's trait being changed. | ||
| self.obj.on_trait_change(self._on_trait_changed, self.trait_name) | ||
| self.obj.observe(self._on_trait_changed, self.trait_name) |
There was a problem hiding this comment.
looks like we don't have a good place to unhook this listener
There was a problem hiding this comment.
yeah I noticed this as well... not sure what the best thing to do is
|
Orthogonal to this PR, but we should add a "maintenance" news fragment type. I wasn't sure which of "feature, bugfix, deprecation, removal, doc, test, build" to classify this PR as, but it feels like it will be ultimately relevant for the changelog (as I imagine 5.1 of apptools main purpose will be this migration to observe / depending on traits 6.2) I am going to call it a feature for now simply because IDK where to put it. When generating the actual changelog we will want to move this, but this way it will still be picked up |
Checklist
This PR replaces almost all uses of
on_trait_changewith observe.All that remains is
apptools.selection.selection_service.pyandapptools.scripting.recorder.py(also an undo example but that is deprecated here anyway). These are a bit trickier and can be addressed separately