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

custom widgets support for notebook outputs #13517

Merged
merged 4 commits into from
Mar 25, 2024

Conversation

jonah-iden
Copy link
Contributor

What it does

this adds support for other ipywidget types like ipydatagrid and ipyleaflets.
Also fixes focusing of notebook editor widget after its shown and updating associated notebooks for extensions after the workspace was granted trust.

To explain overwriting the append child of head in output-webview.internal.ts a bit more:
Vscode has a single endpoint all webviews can downlaod script files from, in theia though every webview can only download files from its own host address as the endpoint.
There is a asWebviewURL function in the extension API which we don't know for which webview the webviewUri is for. In VScode thsts no problem because the endpoint is always the same but in theia its dependent on the webview.
So what im doing is adding a placeholder to the url which is replaced when a script is added to the head to generate the correct URL and make downloading the script work.

How to test

pip install ipydatagrid in your used python environment
Create or open a notebook and add the following cell.

import numpy as np
import pandas as pd
from ipydatagrid import DataGrid

df = pd.DataFrame(
    data={
        "Col1HasAVeryLongName": [1, 2, 4],
        "Col2MediumName": [4, 5, 6],
        "Col3": [7, 8, 10],
    }
)
grid = DataGrid(df, index_name="index_column", layout={"height": "90px"})
grid

Follow-ups

Review checklist

Reminder for reviewers

@jonah-iden jonah-iden requested a review from jbicker March 22, 2024 13:19
@jonah-iden jonah-iden changed the title Jiden/ipydatagrid+ipyleaflets support custom widgets support for notebook outputs Mar 22, 2024
Copy link
Contributor

@jbicker jbicker left a comment

Choose a reason for hiding this comment

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

Tested in browser version. Works!
LGTM.

@jonah-iden jonah-iden merged commit 29aa635 into master Mar 25, 2024
13 of 14 checks passed
@jonah-iden jonah-iden deleted the jiden/ipydatagrid+ipyleaflets-support branch March 25, 2024 16:02
@github-actions github-actions bot added this to the 1.48.0 milestone Mar 25, 2024
@msujew msujew added the notebook issues related to notebooks label Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notebook issues related to notebooks
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants