File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed
lib/matplotlib/backends/web_backend Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -472,12 +472,8 @@ mpl.figure.prototype.key_event = function(event, name) {
472472
473473mpl . figure . prototype . toolbar_button_onclick = function ( name ) {
474474 if ( name == 'download' ) {
475- if ( this . format_dropdown ) {
476- var format_dropdown = this . format_dropdown ;
477- var format = format_dropdown . options [ format_dropdown . selectedIndex ] . value ;
478- } else {
479- format = 'png' ;
480- }
475+ var format_dropdown = this . format_dropdown ;
476+ var format = format_dropdown . options [ format_dropdown . selectedIndex ] . value ;
481477 this . ondownload ( this , format ) ;
482478 } else {
483479 this . send_message ( "toolbar_button" , { name : name } ) ;
Original file line number Diff line number Diff line change @@ -112,6 +112,21 @@ mpl.figure.prototype._init_toolbar = function() {
112112 nav_element . append ( button ) ;
113113 }
114114
115+ var fmt_picker_span = $ ( '<span/>' ) ;
116+
117+ var fmt_picker = $ ( '<select width="75" style="width: 75px; margin-top: 10px"</select>' ) ;
118+ fmt_picker . addClass ( 'mpl-toolbar-optionui-widget ui-widget-content' ) ;
119+ fmt_picker_span . append ( fmt_picker ) ;
120+ nav_element . append ( fmt_picker_span ) ;
121+ this . format_dropdown = fmt_picker [ 0 ] ;
122+
123+ for ( var ind in mpl . extensions ) {
124+ var fmt = mpl . extensions [ ind ] ;
125+ var option = $ (
126+ '<option/>' , { selected : fmt === mpl . default_extension } ) . html ( fmt ) ;
127+ fmt_picker . append ( option )
128+ }
129+
115130 // Add the status bar.
116131 var status_bar = $ ( '<span class="mpl-message" style="text-align:right; float: right;"/>' ) ;
117132 nav_element . append ( status_bar ) ;
You can’t perform that action at this time.
0 commit comments