Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add Save Tool to NbAgg Figure [backport to 1.4.x] #3974

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 7 commits into from
Jan 12, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Hook up the save_figure function
  • Loading branch information
blink1073 committed Jan 12, 2015
commit 89c88e7b3e8d45681bab51b2cde5cdc92040d93c
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_webagg_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def release_zoom(self, event):

def save_figure(self, *args):
"""Save the current figure"""
warnings.warn('"Save figure" not implemented in Web Backend')
self.canvas.send_event('save')


class FigureManagerWebAgg(backend_bases.FigureManagerBase):
Expand Down
8 changes: 8 additions & 0 deletions lib/matplotlib/backends/web_backend/mpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,14 @@ mpl.figure.prototype.send_draw_message = function() {
}
}


mpl.figure.prototype.handle_save = function(fig, msg) {
var format_dropdown = fig.format_dropdown;
var format = format_dropdown.options[format_dropdown.selectedIndex].value;
fig.ondownload(fig, format);
}


mpl.figure.prototype.handle_resize = function(fig, msg) {
var size = msg['size'];
if (size[0] != fig.canvas.width || size[1] != fig.canvas.height) {
Expand Down