Skip to content
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

Replace on_trait_change with observe #732

Closed
6 tasks
corranwebster opened this issue Oct 10, 2020 · 0 comments · Fixed by #880
Closed
6 tasks

Replace on_trait_change with observe #732

corranwebster opened this issue Oct 10, 2020 · 0 comments · Fixed by #880
Labels
difficulty: intermediate Issues which need some context about the package. type: refactoring Issues related to refactoring

Comments

@corranwebster
Copy link
Contributor

corranwebster commented Oct 10, 2020

The new Traits observe framework has a number of advantages and bugfixes compared to the older on_trait_change listeners. We should migrate the codebase to use the new framework wherever possible.

Because function signatures of observers are different from trait change handlers, we can't make the change in a completely automated way. As a result it is best if we do this in a series of steps to make review easier.

Further, to reduce errors and boilerplate, it makes sense to introduce standard ways to connect and disconnect dynamic observers (for example, via flagging standard metadata).

  • standard framework for connecting/disconnecting observers (Widget observer framework #733)
  • convert all @on_trait_change usages to @observe (about 50 places it is used) (Convert on_trait_change decorators to observe decorators #864)
  • convert all dynamic on_trait_change usages to observe (about 200 places it is used)
    • convert dynamic on_trait_change usages that fit into standard framework
    • convert any other simple (ie. single-trait) on_trait_change usages
    • convert any remaining complex (eg. multiply chained, container) on_trait_change usages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: intermediate Issues which need some context about the package. type: refactoring Issues related to refactoring
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant