-
Notifications
You must be signed in to change notification settings - Fork 13
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
get a list of active windows/panels #32
Comments
Thanks for trying it out! I think it should already be possible to some extent, for example by creating new
This part would probably require adding support for disposing the Phosphor / Lumino panels. What use cases do you have in mind? |
Thanks for your reply! Here's what I have in mind: I have to work with a 3rd party DMS which has a very basic document viewer built-in, rendering only one document at a time. I want to use the Jupyter Lab framework, in particular the Lumino panels, to view multiple documents from that DMS, side by side, allowing dynamic tabbing and resizing and all the other Lumino goodness. Luckily the DMS has a REST API, so I can write Python code to get a list of available documents, download them, store them in a temporary location, and then somehow get Jupyter Lab to render them. I want to write a file explorer-like widget in Python which, thanks to ipylab, I can now hook into the Jupyter Lab framework. as a left side panel, so that it could look and behave similar to the native Jupyter Lab file explorer. But what I then still need is some way to launch a new panel, to switch to an existing panel (if the user clicks on a document that is already open), and to close an existing panel (if the user selects a close button in the widget). I may be able to do some of that using the panel = Panel() approach, though it seems to me that I would then not be able to leverage Jupyter Lab's native file rendering plugins (I would like to use the standard PDF renderer, for example). It would also probably be easier and more robust if I could iterate, programmatically in python, over all Lumino panels and interrogate them as to which document they render. Hence my original question. Hope this explanation helps, and that you can provide me with a few pointers on how to achieve this (or a brief explanation why it can't be done, period - that's useful information too). I'm fairly experienced with Python, but don't know much about Javascript/Typescript. |
Thanks for the detailed write-up! What you describe here is pretty much the goal of It's built as a JupyterLab extension, but uses the Jupyter Widget protocol to forward messages from Python to JavaScript. Usually JupyterLab extensions can't interfere and remove things from other extensions, so I'm not sure it would technically be feasible to iterate through all the Lumino widgets and interact with them. However it should be possible to track the ones created from Python and have control over them (to be implemented). Regarding the PDF example, it's already possible to use the app.commands.execute('docmanager:open', {
'path': './example.pdf'
}) With Ideally the best would be start building this more advanced application you describe, and see where the problems are and where it's blocking. Then we can start adding the missing bits to |
@harmvanderheijden Maybe we could start by adding an example to this repo that builds a tree viewer using ipytree, put it in the left area, and when a leaf node is clicked it calls the |
Sounds like a plan! I'm going to try to make something along those line. Will let you know when I have something. |
Nice! Don't hesitate to open a PR if you want too add such example to the repo and discuss more. |
ipylab is very cool, have been experimenting with it a bit.
I'm trying to get a list of active windows (PhosphorJS panels? Not sure of the right jargon) from the jupyterlab framework, but I don't see how it's done. Looks like the app.shell.widgets dictionary contains a number of widgets that are related to the active panels, but I don't understand the structure.
Ideally I would like to be able to write in Python using ipywidgets a widget that I could place in the left panel (as you demonstrate in the widgets.ipynb example), and which could e.g. open and close windows in the main panel (and keep track of them, interact with them). Sort of how the standard javascript based file explorer in jupyterlab behaves. Is something like that at all possible with the current ipylab framework or should I look elsewhere?
The text was updated successfully, but these errors were encountered: