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

feat: Table hooks #168

Merged
merged 8 commits into from
Dec 22, 2023
Merged

feat: Table hooks #168

merged 8 commits into from
Dec 22, 2023

Conversation

jnumainville
Copy link
Collaborator

@jnumainville jnumainville commented Dec 13, 2023

Fixes #112

Uses new python threading API from here

This is a quick example to see all of the hooks working

import deephaven.ui as ui
from deephaven.table import Table
from deephaven import time_table

@ui.component
def watch_cell(source: Table):

    current_table = ui.use_table_data(source)
    current_row = ui.use_row_data(source)
    current_row_list = ui.use_row_list(source)
    current_column = ui.use_column_data(source)
    current_cell = ui.use_cell_data(source)

    view1 = ui.view(f"current time: ${current_table}")
    view2 = ui.view(f"current time: ${current_row}")
    view3 = ui.view(f"current time: ${current_row_list}")
    view4 = ui.view(f"current time: ${current_column}")
    view5 = ui.view(f"current time: ${current_cell}")

    return [view1, view2, view3, view4, view5]

t = time_table("PT1S").tail(1)

watch = watch_cell(t)

@jnumainville jnumainville marked this pull request as ready for review December 18, 2023 22:28
plugins/ui/src/deephaven/ui/hooks/use_table_data.py Outdated Show resolved Hide resolved
plugins/ui/src/deephaven/ui/hooks/use_table_data.py Outdated Show resolved Hide resolved
update: TableUpdate: The update to pass to the function.
is_replay: True if the update is a replay, False otherwise.
"""
submit_task(executor_name, partial(_deferred_update, ctx, func))
Copy link
Member

Choose a reason for hiding this comment

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

I'm not too familiar with this submit_task functionality. Will need to take a closer look...

plugins/ui/DESIGN.md Outdated Show resolved Hide resolved
Copy link
Member

@mofojed mofojed left a comment

Choose a reason for hiding this comment

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

We probably should make a hook just for submitting tasks with the execution context, similar to how I made the use_render_queue hook for submitting tasks on the render thread.

@jnumainville jnumainville merged commit 54f152d into deephaven:main Dec 22, 2023
11 checks passed
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.

Hooks built on top of use_table_listener
2 participants