-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat: Support for dropping extra callback args #271
Merged
jnumainville
merged 5 commits into
deephaven:main
from
jnumainville:260_no_param_callbacks
Feb 8, 2024
Merged
feat: Support for dropping extra callback args #271
jnumainville
merged 5 commits into
deephaven:main
from
jnumainville:260_no_param_callbacks
Feb 8, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jnumainville
changed the title
feat: Support for dropping callback args
feat: Support for dropping extra callback args
Feb 8, 2024
mofojed
requested changes
Feb 8, 2024
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.
Sweet. As a side note, the kwargs was unnecessary - JS will only be allowed to call positional arguments anyways. But it does make the solution more general/complete so I like that.
mofojed
approved these changes
Feb 8, 2024
mofojed
added a commit
to mofojed/deephaven-plugins
that referenced
this pull request
Feb 22, 2024
- We are wrapping callables now because of deephaven#271, but did not account for `signature` raising an error: https://docs.python.org/3/library/inspect.html - Instead of not working at all, just return the original Callable. They'll need to have provided the correct number of arguments, which isn't the worst thing in the world - Tested with the `print` button example: ``` import deephaven.ui as ui @ui.component def button_event_printer(*children, id="My Button"): return ui.action_button( *children, on_key_down=print, on_key_up=print, on_press=print, on_press_start=print, on_press_end=print, on_press_up=print, on_focus=print, on_blur=print, ) @ui.component def button_events(): return ui.panel([ button_event_printer("1", id="My Button 1"), button_event_printer("2", id="My Button 2"), ]) be = button_events() ```
mofojed
added a commit
that referenced
this pull request
Feb 22, 2024
- We are wrapping callables now because of #271, but did not account for `signature` raising an error: https://docs.python.org/3/library/inspect.html - Instead of not working at all, just return the original Callable. They'll need to have provided the correct number of arguments, which isn't the worst thing in the world - Tested with the `print` button example: ``` import deephaven.ui as ui @ui.component def button_event_printer(*children, id="My Button"): return ui.action_button( *children, on_key_down=print, on_key_up=print, on_press=print, on_press_start=print, on_press_end=print, on_press_up=print, on_focus=print, on_blur=print, ) @ui.component def button_events(): return ui.panel([ button_event_printer("1", id="My Button 1"), button_event_printer("2", id="My Button 2"), ]) be = button_events() ```
Merged
jnumainville
added a commit
that referenced
this pull request
Mar 13, 2024
Adds spec for `list_view` There is one major additions on top of what has been discussed in the picker spec. I see it as an oversight (or at least not ideal) to some extent that there's no simple way for embedded buttons to access their parent's keys easily, as far as I can tell. I suppose it's simple enough to bind item keys to button events if you're doing this in React, but I think we'll want a way to do that easily, especially with tables, because it doesn't make sense to pass a button for each item in a ticking table. The least intrusive method here is returning extra args for the item key and section key that a button is embedded in that can be ignored (using the changes implemented in #271).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #260
This snippet now works:
This implementation is more robust than that though. It supports:
*args
or**kwargs
are used, all of the relevant args are passed in.