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

Skip to content

Commit bc5add6

Browse files
committed
Don't trigger save when gtk save dialog is closed by escape.
Pressing escape to close the gtk save dialog sets the return value of `dialog.run()` to `ResponseType.DELETE_EVENT` rather than `ResponseType.CANCEL` (and thus previously incorrectly triggered a save), whereas checking for `ResponseType.OK` covers all cases.
1 parent da1ea05 commit bc5add6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/backends/backend_gtk3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ def on_notify_filter(*args):
570570
ff = dialog.get_filter() # Doesn't autoadjust to filename :/
571571
fmt = self.canvas.get_supported_filetypes_grouped()[ff.get_name()][0]
572572
dialog.destroy()
573-
if response == Gtk.ResponseType.CANCEL:
573+
if response != Gtk.ResponseType.OK:
574574
return
575575
# Save dir for next time, unless empty str (which means use cwd).
576576
if mpl.rcParams['savefig.directory']:

0 commit comments

Comments
 (0)