Usage of the textual.on decorator in parent/mixin classes
#3948
Unanswered
joshua-dean
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This is more of a question of usage/feasibility than an outright feature request, so apologies if I've improperly categorized the issue.
Versions:
python 3.11.7textual 0.46.0The
textual.ondecorator is useful, but does not function if used in an inherited class:Clicking the
Placeholderin this example yields:widget handle_clickwidget on_clickmixin on_clickbut does not produce
mixin handle_click.The logic for this appears to be at the
_MessagePumpMetalevel, asclass_dictwill not contain methods fromOnClickMixin, so no methods in the mixin ever get checked for the_textual_onattribute.Changing
OnClickMixinto inheritMessagePumpdoes cause all four toasts to appear. Is this within the intended use of theMessagePumpclass, or could utilizing it in this way create problems in the future?If it is not good practice or the intended usage, would it be useful to implement a base class for this purpose, and/or change the logic in
_MessagePumpMetato accommodate this use case?Beta Was this translation helpful? Give feedback.
All reactions