Skip to content

Improve nbAgg & WebAgg toolbars #17078

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

Merged
merged 5 commits into from
Apr 28, 2020
Merged

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Apr 9, 2020

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
Copy link
Member

timhoffm commented Apr 9, 2020

Can the dropdown box in webagg be centered again?

@QuLogic
Copy link
Member Author

QuLogic commented Apr 9, 2020

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
Copy link
Member Author

QuLogic commented Apr 9, 2020

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

@timhoffm
Copy link
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
Copy link
Member Author

QuLogic commented Apr 21, 2020

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
Copy link
Member Author

QuLogic commented Apr 25, 2020

Rebased and updated the original description with the new screenshots.

@QuLogic
Copy link
Member Author

QuLogic commented Apr 25, 2020

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
Copy link
Member Author

QuLogic commented Apr 27, 2020

OK, it was just crossed PRs with #17135 and an errant slash.

Copy link
Contributor

@dorafc dorafc left a comment

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.

Copy link
Member

@tacaswell tacaswell left a comment

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