Skip to content

use Qt window title as default savefig filename #908

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 9 commits into from
Jul 9, 2012
Prev Previous commit
Next Next commit
fix qt4 not using get_default_filename in save_figure
restore enforcing lowercase in get_default_filename
  • Loading branch information
mspacek committed Jul 5, 2012
commit c090a9c17b9c00594e93555b484ea2e4c32fab96
2 changes: 1 addition & 1 deletion lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -2114,7 +2114,7 @@ def get_default_filename(self):
a default filename.
"""
default_filename = self.get_window_title() or 'image'
default_filename = default_filename.replace(' ', '_')
default_filename = default_filename.lower().replace(' ', '_')
return default_filename + '.' + self.get_default_filetype()

def switch_backends(self, FigureCanvasClass):
Expand Down
4 changes: 1 addition & 3 deletions lib/matplotlib/backends/backend_qt4.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,10 +617,8 @@ def save_figure(self, *args):
sorted_filetypes = filetypes.items()
sorted_filetypes.sort()
default_filetype = self.canvas.get_default_filetype()
default_filename = self.canvas.get_window_title() or 'image'
default_filename = default_filename.replace(' ', '_')

start = default_filename + '.' + default_filetype
start = self.canvas.get_default_filename()
filters = []
selectedFilter = None
for name, exts in sorted_filetypes:
Expand Down