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

Update the notebook tools on tracker.currentChanged #7659

Merged
merged 1 commit into from Dec 19, 2019

Conversation

jtpio
Copy link
Member

@jtpio jtpio commented Dec 19, 2019

References

Fixes #7643.

Code changes

Update the notebook tools on tracker.currentChanged.

User-facing changes

The notebooks tools should now be removed from the left area when a notebook that doesn't have the focus is closed:

notebook-tools-currentwidget

Backwards-incompatible changes

None.

@jupyterlab-dev-mode
Copy link

Thanks for making a pull request to JupyterLab!

To try out this branch on binder, follow this link: Binder

@jtpio
Copy link
Member Author

jtpio commented Dec 19, 2019

This will need a second look, to make sure there is no undesirable side-effect, and check if RestorablePool is the adequate place to implement the change.

@vidartf
Copy link
Member

vidartf commented Dec 19, 2019

If possible, I would leave this to after strict null checks have been merged, as it should help highlight internal consumers not ready to handle the null value.

@jtpio
Copy link
Member Author

jtpio commented Dec 19, 2019

OK to wait for #7657.

This can stay as a draft in the meantime.

@jtpio
Copy link
Member Author

jtpio commented Dec 19, 2019

Actually the change in RestorablePool might not be strictly required, as the currentChanged signal seems to be emitted with the value of null when the last notebook is disposed and removed from the pool.

The issue for the notebook tools is that the handler for the tracker.currentChanged is not set up, only the one for labShell.currentChanged is:

if (labShell) {
labShell.currentChanged.connect((sender, args) => {
updateTools();
});
} else {
tracker.currentChanged.connect((sender, args) => {
updateTools();
});
}

@jtpio jtpio changed the title Let WidgetTracker.currentChanged emit null as currentWidget Update the notebook tools on tracker.currentChanged Dec 19, 2019
@jtpio
Copy link
Member Author

jtpio commented Dec 19, 2019

I've updated the PR to only focus on resolving #7643.

There might still be a use case for being able to explicitly set pool.current to null, and have the currentChanged signal emitted with a null value. Although I'm not entirely convinced yet. In any case this could be discussed as a separate issue.

@blink1073
Copy link
Member

@jtpio, this looks good as-is, or do you still consider it draft?

@jtpio
Copy link
Member Author

jtpio commented Dec 19, 2019

It's ready, was just waiting for the tests to finish :)

@jtpio jtpio marked this pull request as ready for review December 19, 2019 15:52
@blink1073
Copy link
Member

Thanks!

@blink1073 blink1073 merged commit 0c2ef44 into jupyterlab:master Dec 19, 2019
@jtpio jtpio deleted the current-widget-null branch December 19, 2019 21:32
@jtpio jtpio added this to the 2.0 milestone Dec 19, 2019
@lock lock bot added the status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Jan 18, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pkg:notebook status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Notebook Tools panel lifecycle
3 participants