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

Management of widgets in tree view #6478

Closed
wants to merge 1 commit into from

Conversation

brichet
Copy link
Contributor

@brichet brichet commented Jul 19, 2022

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(...) and app.shell.activateById(...) in the tree view as in JupyterLab main area.

Using a flag in NotebookShell :

  • adding a widget in the main area will add it to the TabPanel.
  • searching a widget in the main area will search in the TabPanel widgets.

May be related to #6316 as it transparently give access to the tab panel.

@github-actions
Copy link
Contributor

Binder 👈 Launch a Binder on branch brichet/notebook/feature/mainarea_tree

@jtpio
Copy link
Member

jtpio commented Jul 20, 2022

Thanks @brichet for bringing this.

Linking to #6410 which expresses a similar idea.

/**
* Get the status of main area.
*/
get mainIsTabPanel(): Boolean {
Copy link
Member

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).

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

@jtpio jtpio added this to the 7.0 milestone Jul 20, 2022
@brichet brichet mentioned this pull request Aug 1, 2022
@jtpio jtpio closed this in #6496 Aug 5, 2022
@brichet brichet deleted the feature/mainarea_tree branch August 5, 2022 07:10
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants