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
Allow extensions and users to customize easily toolbar items. #10469
Conversation
Thanks for making a pull request to JupyterLab! To try out this branch on binder, follow this link: |
377559b
to
4548c17
Compare
0ee1575
to
62103fe
Compare
|
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulation you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon! Remember to remove If these instruction are inaccurate, feel free to suggest an improvement. |
@fcollonval I attempted to backport this manually but there were a lot of conflicts and I think you'd be better suited to handle them. We could also save this one for 4.0. |
Thanks @blink1073 to try backporting this one. I'll have a look. |
Ok let's not include this one on 3.2.x. |
Just checking: did we decide not to backport because of the amount of conflicts? But it could be backported because there is no breaking change, apart from the note in the top comment? |
I'm fine with this being backported, from my perspective it was a lack of bandwidth. |
I think we should consider a 3.3 version due to notebook v7 (aka nb7). Because in addition to this one, we need to add customization for widget shell positioning; for example:
Going a bit further into the implementation, we could extend the |
It could be good to discuss what should be changed in jlab to support nb7 and check if it can be based on a v3.3 or should wait for v4. |
For reference, checking whether customizing toolbars was available in 3.2 came up while looking at jupyterlab/retrolab#283 |
@fcollonval mind opening a new issue to discuss this? Thanks! |
Done |
@meeseeksdev please backport to 3.3.x |
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon! Remember to remove the If these instructions are inaccurate, feel free to suggest an improvement. |
… easily toolbar items.
…tomize easily toolbar items.) (#11873) * Backport PR #10469: Allow extensions and users to customize easily toolbar items. * Backport #11899 * Fix doc * Remove duplicate entry in setting * Backport #10880 It seems the automatic backport in 3.1.x by the bot did not make it * Fix doc snippets * Fix test import * Fix `ToolbarButton`
References
Fixes #10419
Create toolbar items asynchronously in Widget factory.(not needed)CommandToolbarButton
to cover commands without iconsCode changes
That registry can generate toolbar item widget based on a factory name (the one use to create the container) and the item name. It has a default widget factory to build item from definition (in particular to create
CommandToolbarButton
)CommandToolbarButton
to receive an icon and or a label that overrides the one define by the command (mainly to cover command without icon).toolbar = true
will be passed to tune icon, label,... of the command.User-facing changes
Users can now customize toolbar items. They can hide existing items in the same matter than the menus or the shortcuts (aka set
disabled
to true). They can add new items; for now the default factory supports only spacers and command buttons.In the example below, the restart and run all button is hidden and a new button to trigger clear all outputs is added.
Keyboard shortcuts appear now in toolbar as we reuse commands:
Before
After
The customizable toolbar has been applied to the following document factory:
Here is an example on the text file editor:
Backwards-incompatible changes
CSVDelimiter widget toolbar has been changed to fit the usual pattern of receiving the document widget rather than using signal. This was considered as ok as that part of the code is unlikely to be reused else where.
Reference:
jupyterlab/packages/csvviewer/src/toolbar.ts
Line 27 in 9fa65ce