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: Implement python item_table_source #415

Merged
merged 13 commits into from
May 10, 2024

Conversation

jnumainville
Copy link
Contributor

Fixes #414
Adds Python side of item_table_source and required refactoring.

@jnumainville
Copy link
Contributor Author

jnumainville commented Apr 18, 2024

@mofojed I'm wondering if it actually makes sense to make this a "Python side only" concept. There's not anything really "UI" related. The dictionary could just be merged into the props on component creation.
Or, at least maybe that makes sense for now so this doesn't break anything but also isn't waiting on JS changes?

@jnumainville
Copy link
Contributor Author

I went ahead and did the unpacking
It works with this example.
Doesn't have to be a long term solution but at least this makes any fixes we need to make independent of this PR

import deephaven.ui as ui
from deephaven.ui import use_state
from deephaven import time_table
import datetime
 
column_types = time_table("PT2S", start_time=datetime.datetime.now() - datetime.timedelta(seconds=2000)).update([
    "Int=new Integer(i)",
    "Double=new Double(i+i/10)",
])

@ui.component
def picker():
    value, set_value = use_state(1000)

    source = ui.item_table_source(column_types, key_column="Int", label_column="Int")

    # Picker for selecting values
    pick = ui.picker(
        source,
        label="Int",
        on_selection_change=set_value,
        selected_key=value
    )

    return ui.flex(
        pick,
        ui.text(value, key="text1"),
        direction="column",
        margin=10,
        gap=10,
    )

picker_column_types = picker()

@jnumainville jnumainville self-assigned this Apr 19, 2024
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.

Looks good, we should also add to the examples.

mofojed
mofojed previously approved these changes Apr 29, 2024
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.

Looks good to me, will need to merge latest and fix conflicts.

mofojed
mofojed previously approved these changes May 10, 2024
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.

Suggestion to clean up the example doc a little bit.

plugins/ui/docs/README.md Outdated Show resolved Hide resolved
@jnumainville jnumainville merged commit ce1a019 into deephaven:main May 10, 2024
13 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.

ui.item_table_source implementation
3 participants