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

DOC: Mention dispatch is used for distinguishing observers #1195

Merged
merged 1 commit into from
Jun 9, 2020

Conversation

kitchoi
Copy link
Contributor

@kitchoi kitchoi commented Jun 9, 2020

This PR expands the user manual to highlight another difference in observe: dispatch is used while distinguishing observers.

Context: I was looking at TraitsUI code, and noticed that existing calls to remove change handlers do not specify dispatch="ui". It works because on_trait_change does not differentiate it.
https://github.com/enthought/traitsui/blob/f919dbd2044bcbff7280e5580286e93caa8a153a/traitsui/qt4/list_editor.py#L138-L140
https://github.com/enthought/traitsui/blob/f919dbd2044bcbff7280e5580286e93caa8a153a/traitsui/qt4/list_editor.py#L149-L151
observe does, and the call with remove=True in the above example will need to include dispatch="ui" when it is switched to use observe

Checklist

  • Tests
  • Update API reference (docs/source/traits_api_reference)
  • Update User manual (docs/source/traits_user_manual)
  • Update type annotation hints in traits-stubs

@mdickinson
Copy link
Member

We may want to reconsider distinguishing by dispatch: it does seem a bit clumsy that one needs to specify the dispatch mechanism when removing a handler.

Copy link
Member

@mdickinson mdickinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mdickinson mdickinson merged commit 64c8c17 into master Jun 9, 2020
@mdickinson mdickinson deleted the doc-observe-dispatch branch June 9, 2020 11:24
mdickinson pushed a commit that referenced this pull request Jul 21, 2020
mdickinson added a commit that referenced this pull request Jul 21, 2020
* Expand user manual to mention dispatch (#1195)

(cherry picked from commit 64c8c17)

* Fix trait_documenter for properties (#1246)

* Add a failing tests

* And fix the failing test

(cherry picked from commit 464ec60)

* Update changelog

Co-authored-by: Kit Choi <kitchoi@users.noreply.github.com>
@mdickinson mdickinson added porting: backported to 6.1 This PR has been backported to the Traits 6.1.x release branch and removed porting: needs backport to 6.1 labels Jul 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
porting: backported to 6.1 This PR has been backported to the Traits 6.1.x release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants