File tree 3 files changed +20
-4
lines changed 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -2092,6 +2092,14 @@ def get_default_filetype(self):
2092
2092
"""
2093
2093
return rcParams ['savefig.format' ]
2094
2094
2095
+ def get_window_title (self ):
2096
+ """
2097
+ Get the title text of the window containing the figure.
2098
+ Return None if there is no window (eg, a PS backend).
2099
+ """
2100
+ if hasattr (self , "manager" ):
2101
+ return self .manager .get_window_title ()
2102
+
2095
2103
def set_window_title (self , title ):
2096
2104
"""
2097
2105
Set the title text of the window containing the figure. Note that
@@ -2413,6 +2421,13 @@ def show_popup(self, msg):
2413
2421
"""
2414
2422
pass
2415
2423
2424
+ def get_window_title (self ):
2425
+ """
2426
+ Get the title text of the window containing the figure.
2427
+ Return None if there is no window (eg, a PS backend).
2428
+ """
2429
+ pass
2430
+
2416
2431
def set_window_title (self , title ):
2417
2432
"""
2418
2433
Set the title text of the window containing the figure. Note that
Original file line number Diff line number Diff line change @@ -419,10 +419,8 @@ def save_figure(self, *args):
419
419
sorted_filetypes = filetypes .items ()
420
420
sorted_filetypes .sort ()
421
421
default_filetype = self .canvas .get_default_filetype ()
422
- default_filename = str (self .canvas .window ().windowTitle ()) or 'image'
423
- default_filename = default_filename .replace (' ' , '_' )
424
422
425
- start = default_filename + ' .' + default_filetype
423
+ start = 'image .' + default_filetype
426
424
filters = []
427
425
selectedFilter = None
428
426
for name , exts in sorted_filetypes :
Original file line number Diff line number Diff line change @@ -481,6 +481,9 @@ def destroy( self, *args ):
481
481
if DEBUG : print ("destroy figure manager" )
482
482
self .window .close ()
483
483
484
+ def get_window_title (self ):
485
+ return str (self .window .windowTitle ())
486
+
484
487
def set_window_title (self , title ):
485
488
self .window .setWindowTitle (title )
486
489
@@ -614,7 +617,7 @@ def save_figure(self, *args):
614
617
sorted_filetypes = filetypes .items ()
615
618
sorted_filetypes .sort ()
616
619
default_filetype = self .canvas .get_default_filetype ()
617
- default_filename = str ( self .canvas .window (). windowTitle () ) or 'image'
620
+ default_filename = self .canvas .get_window_title ( ) or 'image'
618
621
default_filename = default_filename .replace (' ' , '_' )
619
622
620
623
start = default_filename + '.' + default_filetype
You can’t perform that action at this time.
0 commit comments