@@ -539,17 +539,6 @@ def zoom(self, *args):
539
539
super ().zoom (* args )
540
540
self ._update_buttons_checked ()
541
541
542
- @cbook .deprecated ("3.1" )
543
- def get_filechooser (self ):
544
- fc = FileChooserDialog (
545
- title = 'Save the figure' ,
546
- parent = self .win ,
547
- path = os .path .expanduser (rcParams ['savefig.directory' ]),
548
- filetypes = self .canvas .get_supported_filetypes (),
549
- default_filetype = self .canvas .get_default_filetype ())
550
- fc .set_current_name (self .canvas .get_default_filename ())
551
- return fc
552
-
553
542
def save_figure (self , * args ):
554
543
dialog = Gtk .FileChooserDialog (
555
544
title = "Save the figure" ,
@@ -631,79 +620,6 @@ def set_history_buttons(self):
631
620
self ._gtk_ids ['Forward' ].set_sensitive (can_forward )
632
621
633
622
634
- @cbook .deprecated ("3.1" )
635
- class FileChooserDialog (Gtk .FileChooserDialog ):
636
- """GTK+ file selector which remembers the last file/directory
637
- selected and presents the user with a menu of supported image formats
638
- """
639
- def __init__ (self ,
640
- title = 'Save file' ,
641
- parent = None ,
642
- action = Gtk .FileChooserAction .SAVE ,
643
- buttons = (Gtk .STOCK_CANCEL , Gtk .ResponseType .CANCEL ,
644
- Gtk .STOCK_SAVE , Gtk .ResponseType .OK ),
645
- path = None ,
646
- filetypes = [],
647
- default_filetype = None ,
648
- ):
649
- super ().__init__ (title , parent , action , buttons )
650
- self .set_default_response (Gtk .ResponseType .OK )
651
- self .set_do_overwrite_confirmation (True )
652
-
653
- if not path :
654
- path = os .getcwd ()
655
-
656
- # create an extra widget to list supported image formats
657
- self .set_current_folder (path )
658
- self .set_current_name ('image.' + default_filetype )
659
-
660
- hbox = Gtk .Box (spacing = 10 )
661
- hbox .pack_start (Gtk .Label (label = "File Format:" ), False , False , 0 )
662
-
663
- liststore = Gtk .ListStore (GObject .TYPE_STRING )
664
- cbox = Gtk .ComboBox ()
665
- cbox .set_model (liststore )
666
- cell = Gtk .CellRendererText ()
667
- cbox .pack_start (cell , True )
668
- cbox .add_attribute (cell , 'text' , 0 )
669
- hbox .pack_start (cbox , False , False , 0 )
670
-
671
- self .filetypes = filetypes
672
- sorted_filetypes = sorted (filetypes .items ())
673
- default = 0
674
- for i , (ext , name ) in enumerate (sorted_filetypes ):
675
- liststore .append (["%s (*.%s)" % (name , ext )])
676
- if ext == default_filetype :
677
- default = i
678
- cbox .set_active (default )
679
- self .ext = default_filetype
680
-
681
- def cb_cbox_changed (cbox , data = None ):
682
- """File extension changed"""
683
- head , filename = os .path .split (self .get_filename ())
684
- root , ext = os .path .splitext (filename )
685
- ext = ext [1 :]
686
- new_ext = sorted_filetypes [cbox .get_active ()][0 ]
687
- self .ext = new_ext
688
-
689
- if ext in self .filetypes :
690
- filename = root + '.' + new_ext
691
- elif ext == '' :
692
- filename = filename .rstrip ('.' ) + '.' + new_ext
693
-
694
- self .set_current_name (filename )
695
- cbox .connect ("changed" , cb_cbox_changed )
696
-
697
- hbox .show_all ()
698
- self .set_extra_widget (hbox )
699
-
700
- def get_filename_from_user (self ):
701
- if self .run () == int (Gtk .ResponseType .OK ):
702
- return self .get_filename (), self .ext
703
- else :
704
- return None , self .ext
705
-
706
-
707
623
class ToolbarGTK3 (ToolContainerBase , Gtk .Box ):
708
624
_icon_extension = '.png'
709
625
@@ -800,18 +716,6 @@ def draw_rubberband(self, x0, y0, x1, y1):
800
716
801
717
802
718
class SaveFigureGTK3 (backend_tools .SaveFigureBase ):
803
-
804
- @cbook .deprecated ("3.1" )
805
- def get_filechooser (self ):
806
- fc = FileChooserDialog (
807
- title = 'Save the figure' ,
808
- parent = self .figure .canvas .manager .window ,
809
- path = os .path .expanduser (rcParams ['savefig.directory' ]),
810
- filetypes = self .figure .canvas .get_supported_filetypes (),
811
- default_filetype = self .figure .canvas .get_default_filetype ())
812
- fc .set_current_name (self .figure .canvas .get_default_filename ())
813
- return fc
814
-
815
719
def trigger (self , * args , ** kwargs ):
816
720
817
721
class PseudoToolbar :
0 commit comments