Improve nbAgg & WebAgg toolbars by QuLogic · Pull Request #17078 · matplotlib/matplotlib · GitHub
Skip to content

Improve nbAgg & WebAgg toolbars - #17078

Merged
tacaswell merged 5 commits into
matplotlib:masterfrom
QuLogic:webagg-toolbar
Apr 28, 2020
Merged

tacaswell merged 5 commits into
matplotlib:masterfrom
QuLogic:webagg-toolbar

Conversation

@QuLogic

@QuLogic QuLogic commented Apr 9, 2020

Copy link
Copy Markdown
Member

PR Summary

This tweaks the nbAgg and WebAgg toolbars to look a little better. Using button groups, we can emulate the spacer setup that other GUIs have. For WebAgg, start using Matplotlib's icons and try to move away from jQuery UI's CSS. Additionally, implement set_history_buttons, so the back/forward buttons disable themselves, and add a style for active button, to show pan/zoom state.

Previously, nbAgg looked like:
Screenshot_2020-04-09 Untitled
and now it looks like:
Screenshot_2020-04-20 Untitled

Previously, WebAgg looked like:
Screenshot_2020-04-09 matplotlib
and now it looks like:
Screenshot_2020-04-20 matplotlib

Waiting for #17053.

PR Checklist

  • [N/A] Has Pytest style unit tests
  • Code is Flake 8 compliant
  • [N/A] New features are documented, with examples if plot related
  • [N/A] Documentation is sphinx and numpydoc compliant
  • [N/A] Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • [N/A] Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@timhoffm

timhoffm commented Apr 9, 2020

Copy link
Copy Markdown
Member

@QuLogic

QuLogic commented Apr 9, 2020

Copy link
Copy Markdown
Member Author

I'm not sure if it was aligned before, or just coincidence. It's easiest if we use flexbox, looks like it's available almost everywhere.

@QuLogic

QuLogic commented Apr 9, 2020

Copy link
Copy Markdown
Member Author

Oh, I checked again, and it's actually just vertical-align:middle; on everything, which is pretty easy to do.

@timhoffm

Copy link
Copy Markdown
Member

@QuLogic when using the "Waiting for other PR" label, can you please cross-link the other PR, so that one can find out what has to be reviewed before this?

@QuLogic QuLogic mentioned this pull request Apr 11, 2020
2 tasks
@QuLogic

QuLogic commented Apr 21, 2020

Copy link
Copy Markdown
Member Author

Updated to be vertically aligned.

Additionally, I implemented set_history_buttons, so the back/forward buttons disable themselves, and added a style for active button, to show pan/zoom state.

For nbAgg, it uses 'active' & disabled style in Bootstrap:
Screenshot_2020-04-20 Untitled

For WebAgg, there are new styles to colorize the active image to approximately tab:blue, and a disabled style:
Screenshot_2020-04-20 matplotlib

@QuLogic

QuLogic commented Apr 25, 2020

Copy link
Copy Markdown
Member Author

Rebased and updated the original description with the new screenshots.

@QuLogic

QuLogic commented Apr 25, 2020

Copy link
Copy Markdown
Member Author

Looks like this broke the non-embedded WebAgg, so don't merge until I re-check this.

QuLogic added 5 commits April 27, 2020 19:30
This is one step to removing dependence on jQuery-UI.
For nbAgg, encapsulate buttons in a button group, and create new groups
whenever we encounter a spacer. Change the toolbar's style to use
Bootstrap.
* Add some surrounding `div`s for button groups, like the nbAgg toolbar,
  in order to add spacers.
* Add our own CSS file instead of using jQuery UI styles.
This uses the 'active' Bootstrap style on nbagg, and colorizes the image
to tab:blue on webagg.
@QuLogic

QuLogic commented Apr 27, 2020

Copy link
Copy Markdown
Member Author

@dorafc dorafc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JS looks ok as a JQuery -> vanilla js translation. This is really the kind of thing you want to verify works in the browser.

@tacaswell tacaswell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the embedding example, spawning a sever with plt.show and nbagg work as expected.

@tacaswell
tacaswell merged commit a31fac2 into matplotlib:master Apr 28, 2020
@QuLogic
QuLogic deleted the webagg-toolbar branch April 28, 2020 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants