-
Notifications
You must be signed in to change notification settings - Fork 23
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
[WIP] Prototype of streamlined Graphical GIS <-> Notebook "bounce" workflow #340
base: main
Are you sure you want to change the base?
Conversation
Integration tests report: appsharing.space |
this._jgisWidget = new JupyterGISPanel(options); | ||
this._jgisWidget = new JupyterGISWidget({ | ||
// FIXME: Where do we get a context object? | ||
// context: ..., |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Invoking help from @brichet 🙏🏽
Since JupyterGISWidget
is a DocumentWidget
, it's needs a context here.
Is JupyterGISWidget
a good choice here?
The place I see where JupyterLab creates a document context is here https://github.com/jupyterlab/jupyterlab/blob/main/packages/docmanager/src/manager.ts#L549 I'm not sure we'd have everything in place to do something equivalent here. And should we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if we can have a map with the toolbar without going through this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that both solutions should be possible (create a context or add a toolbar to the widget), but I haven't test it.
The buttons on the toolbars looks for the active widget in the tracker, that mean that the created widget must be added to the tracker to make it work. Currently the tracker expect JupyterGISWidget
, but it can be updated to allow also JupyterGISPanel
I guess (or an other widget including JupyterGISPanel
with a toolbar).
IIUC, this PR creates a temporary project file, and the goal is to open that file in a widget with a toolbar (the widget must be tracked). I think we'll have to activate the sidebars too, to be able to manage that map.
If this is true, I don't understand why we shouldn't open the regular JupyterGISWidget
while splitting the main area. We'll get it all for free...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why we shouldn't open the regular JupyterGISWidget while splitting the main area. We got all this working for free...
We can definitely take this approach 👍🏽
The jupyterlab-sidecar approach from Python was to get something on the screen quickly. I had a feeling that wouldn't be the long term approach we would take.
We can definitely have that Python function trigger opening the file next to the Notebook and splitting the main area.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to take that approach, we could probably use the command to open the file:
jupytergis/python/jupytergis_core/src/jgisplugin/plugins.ts
Lines 162 to 165 in 60809d7
return app.commands.execute('docmanager:open', { | |
path: model.path, | |
factory: FACTORY | |
}); |
with an additional argument like to split the main area. I haven't tried it, but it should be something like:
app.commands.execute('docmanager:open', {
path: 'debug.jgis',
factory: 'JupyterGIS .jgis Viewer', // the factory name should be exported
options: { mode: 'split-right' }
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's probably better to not depend on ipylab
in a project like JupyterGIS.
ipylab
is indeed still a bit more like a toy. It's likely fine if individual users install it themselves if they want to. Or maybe a quick mention in the docs could also work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for commenting @jtpio
Or maybe a quick mention in the docs could also work?
Since here we want to implement an actual new feature in JupyterGIS, then we should just write the needed TypeScript code in the Notebook output renderer we have.
It feels weird to open a document from there, but maybe that could be lazy e.g. if that JupyterGIS document is already opened, we should not open it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed privately with @martinRenou , we can first try embedding the DocumentWidget
in the output, as started by @mfisher87 in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks all for your expertise in designing this feature! We have a holiday in the US today, so I'll make some more progress tomorrow :) @martinRenou @brichet any other context from your private conversation that might be useful?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mfisher87 you can try using DocumentManager.open()
, it creates both the context and the widget, and return the widget.
The following code returns the main area widget, with the toolbar, it can be a good starting point.
const widget = options.docManager.open(`RTC:${path}`);
if (widget instanceof JupyterGISWidget) {
this._jgisWidget = widget;
this.addWidget(this._jgisWidget);
this._jgisWidget.show();
}
b2cc693
to
5329e90
Compare
5329e90
to
baf0b1a
Compare
9103433
to
5b96097
Compare
for more information, see https://pre-commit.ci
FYI @mfisher87 #419 has been merged, you can probably revive or remake this PR. |
Awesome work @brichet !! I hope to have some time to play with this tomorrow. |
Description
Just barely got started implementing a streamlined version of the "GIS<->Notebook bounce" workflow with huge thanks to @martinRenou for making some time to teach me stuff this morning! I wanted to share our progress so far.
From an example notebook, we want to debug this geodataframe:
This opens a side panel with JupyterGIS displaying the data on a basemap. Eventually, I want to directly pass the geodataframe instead.
Still TODO, and I don't have time today:
Checklist
Resolves #XXX
.Failing lint checks can be resolved with:
pre-commit run --all-files
jlpm run lint
📚 Documentation preview: https://jupytergis--340.org.readthedocs.build/en/340/
💡 JupyterLite preview is available from the doc, by clicking on