-
-
Notifications
You must be signed in to change notification settings - Fork 653
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
Implement property for Command.action. #2433
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! A couple of minor suggestions inline; but this looks like an obvious oversight in the API, so we should definitely fix it.
@@ -63,6 +63,29 @@ def test_create(): | |||
) | |||
|
|||
|
|||
def test_change_action(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is a little odd; it's only really validating that the action can be cleared, which I think would have always been true.
I added a property handler for
action
, so that it is possible to specify what a Command does after it's been created.Sometimes, you want to make the action depend on the current state of your application, and having global variables to indicate that state may not always be possible.
With this change, you can change the action to be another closure. But, because the handler needs to be wrapped in a
wrapped_handler
, doing this from you app looks ugly:After this change, it looks like this:
PR Checklist: