-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Management of widgets in tree view #6478
Conversation
…nd manage it in a dedicated way
/** | ||
* Get the status of main area. | ||
*/ | ||
get mainIsTabPanel(): Boolean { |
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.
Need to think about this, but at first glance trying to know what a page or a set of extensions is trying to add sounds a bit odd.
The shell should be generic enough, for example we could imaging other custom application reusing NotebookShell
but without the tree view (or a different one not using a TabPanel
).
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.
Also for more context the NotebookShell
was initially thought as only allowing 1 widget in the main area on purpose. As a way to have document / widget centric pages.
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 agree that this solution is not generic enough.
Also for more context the
NotebookShell
was initially thought as only allowing 1 widget in the main area on purpose.
Is that still relevant as there is already the tree view that would allow several widgets in main area ?
Indeed if the tree view will be the only one needing several widgets, the better way might be to expose its tab panel as said in #6410. Would the idea be to use token ?
Otherwise, another way could be to use a dock panel like in JupyterLab, but limited to one widget by default. That would keep the initial context but allows several widgets in main area if necessary.
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.
Is that still relevant as there is already the tree view that would allow several widgets in main area ?
Good point. For the tree page it would make sense for widgets to be added to the tab panel. And would be natural to extension authors using app.shell.add(widget, 'main')
.
Would the idea be to use token ?
Yes the idea would have been to require the token to be able to add new widgets to the tab panel. Thinking more about it this might be simpler to implement, although maybe less straighforward to extension authors who would somehow need to create a dedicated plugin for this.
The main area can only contain one widget in NotebookShell. If the main area is a TabPanel (tree view for instance), there is no easy way to add a widget to that TabPanel, or to search in its widgets from an extension.
This PR allows using
app.shell.add(...)
andapp.shell.activateById(...)
in the tree view as in JupyterLab main area.Using a flag in NotebookShell :
May be related to #6316 as it transparently give access to the tab panel.