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

On decorator #2453

Merged
merged 16 commits into from
May 2, 2023
Merged

On decorator #2453

merged 16 commits into from
May 2, 2023

Conversation

willmcgugan
Copy link
Collaborator

@willmcgugan willmcgugan commented May 2, 2023

Implement the @on decorator

Fixes #2398

@willmcgugan willmcgugan marked this pull request as draft May 2, 2023 13:21
@willmcgugan willmcgugan marked this pull request as ready for review May 2, 2023 13:23
Copy link
Contributor

@davep davep left a comment

Choose a reason for hiding this comment

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

Couple of typo things and an extreme test suggestion but otherwise looking good! Looking forward to using this.

docs/guide/events.md Outdated Show resolved Hide resolved
docs/guide/events.md Outdated Show resolved Hide resolved
tests/test_on.py Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

I might be tempted to add a test here that MyApp.my_custom_handler.__doc__ is what is expected, but that might be taking things too far.

willmcgugan and others added 2 commits May 2, 2023 15:18
Co-authored-by: Dave Pearson <davep@davep.org>
Co-authored-by: Dave Pearson <davep@davep.org>
Copy link
Contributor

@rodrigogiraoserrao rodrigogiraoserrao left a comment

Choose a reason for hiding this comment

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

A couple of minor suggestions.

docs/examples/events/on_decorator.css Outdated Show resolved Hide resolved
docs/guide/events.md Outdated Show resolved Hide resolved
docs/guide/events.md Outdated Show resolved Hide resolved
docs/guide/events.md Show resolved Hide resolved
src/textual/_on.py Outdated Show resolved Hide resolved
src/textual/_on.py Outdated Show resolved Hide resolved
willmcgugan and others added 6 commits May 2, 2023 15:40
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Decorator approach to event handling
3 participants