Skip to content

Blocks-Backend-Events#844

Merged
abidlabs merged 5 commits into
Blocks-Devfrom
Blocks-Backend-Events
Mar 22, 2022
Merged

Blocks-Backend-Events#844
abidlabs merged 5 commits into
Blocks-Devfrom
Blocks-Backend-Events

Conversation

@omerXfaruq
Copy link
Copy Markdown
Contributor

All events are implemented except Tabs. Tabs is not a component in backend.

Closes #723

- all events are implemented
@pngwn
Copy link
Copy Markdown
Member

pngwn commented Mar 21, 2022

@farukozderim I think Tabs should be the same as everything else. It isn't any different functionally from rows, columns or carousel. Grid will probably fall under a similar category.

@abidlabs
Copy link
Copy Markdown
Member

I agree with @pngwn, tab change could be a useful event to track. @farukozderim since Tab is a BlockContext which is a Block, it should also support the set_event_trigger() already, right?

My only additional suggestion here is to have more descriptive docstrings for the event triggers of. Instead :

"""
Parameters:
    fn: function name
    inputs: List of inputs
    outputs: List of outputs
Returns: None
"""
"""
Creates a trigger to call a function when this component is clicked
Parameters:
    fn: the function to call
    inputs: the input components whose values should be used as the inputs to the function
    outputs: the output components whose values should be updated based on the function return values
Returns: None
"""

Otherwise, LGTM.

Comment thread gradio/blocks.py Outdated
def set_event_trigger(
self,
event_name: str,
fn: str,
Copy link
Copy Markdown
Member

@abidlabs abidlabs Mar 21, 2022

Choose a reason for hiding this comment

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

Type of fn should be Callable (here and below)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated

@omerXfaruq
Copy link
Copy Markdown
Contributor Author

omerXfaruq commented Mar 22, 2022

I wanted to clarify meaning of tabs event below, but now it is clarified!
#723 (comment)

- refactor fn: str -> Callable
- add change event to TabItem
@abidlabs
Copy link
Copy Markdown
Member

abidlabs commented Mar 22, 2022

I wanted to clarify meaning of tabs event below, but now it is clarified!
#723 (comment)

Small clarification, this event is supposed to be triggered when the TabItem is selected from the menu of tabs, right? In that case, should the TabItem event be called click() not change()?

If the idea is that this trigger should be called any time that the selected tab changes, then Tab should have the change() event.

- add change event to Tabs
@omerXfaruq
Copy link
Copy Markdown
Contributor Author

Ready to merge!

@abidlabs abidlabs merged commit 1ff6270 into Blocks-Dev Mar 22, 2022
@abidlabs abidlabs deleted the Blocks-Backend-Events branch March 22, 2022 17:35
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.

3 participants