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

Allow registering click and value change events after element instantiation #2704

Merged
merged 6 commits into from
Mar 27, 2024

Conversation

falkoschindler
Copy link
Contributor

@falkoschindler falkoschindler commented Mar 15, 2024

This PR addresses feature request #2687, allowing to add event handlers after UI element have been created. It is still work in progress though.

  • button
  • value elements
  • color_picker
  • echart
  • interactive_image
  • joystick
  • json_editor
  • keyboard
  • list
  • menu_item
  • scene
  • scroll_area
  • table
  • tree
  • upload

@falkoschindler falkoschindler added the enhancement New feature or request label Mar 15, 2024
@petergaultney
Copy link
Contributor

this is totally unrelated to this PR (but very related to my attempts to contribute):

i just ran autopep8 --max-line-length=120 --experimental --in-place --recursive . (as per the README) on the directory after making my changes, and a whole bunch of files that I hadn't touched got reformatted. That seems... undesirable. Is this a known issue?

Screenshot 2024-03-15 at 5 17 04 PM

@petergaultney
Copy link
Contributor

this PR is continued in #2708

@falkoschindler
Copy link
Contributor Author

Regarding the autopep8 conflict, I just created a separate issue: #2750.

petergaultney and others added 5 commits March 25, 2024 15:38
* JsonEditor: on_select and on_change builder-style registration

* ValueElement: builder pattern for on_value_change

* Table: allow multiple on_selection and on_pagination_change handlers

via the builder pattern

* Tree: allow all Python handlers to be registered more than once

via the builder pattern

* Keyboard element: support multiple on_key handlers

via the builder pattern.

* color picker: support multiple on_pick callbacks via builder pattern

* list item: support multiple on_click callbacks via builder pattern

* MenuItem: support multiple on_click callbacks via builder pattern

* Upload: support multiple on_upload & on_rejected callbacks via builder pattern

* Scene: support multiple click/drag handlers via builder pattern

* ScrollArea: support multiple on_scroll callbacks via builder pattern

* EChart: support multiple on_point_click handlers via builder pattern

* InteractiveImage: support multiple on_mouse handlers via builder pattern

* Joystick: support multiple handlers of each event type via builder pattern

* code review

---------

Co-authored-by: Falko Schindler <[email protected]>
@falkoschindler falkoschindler added this to the 1.4.20 milestone Mar 25, 2024
@falkoschindler falkoschindler marked this pull request as ready for review March 25, 2024 14:50
Copy link
Member

@rodja rodja left a comment

Choose a reason for hiding this comment

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

Should we add some tests?

@rodja rodja merged commit 072381e into main Mar 27, 2024
7 checks passed
@rodja rodja deleted the event-registration branch March 27, 2024 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants