Skip to content

gh-112898: Fix double close dialog with warning about unsafed files #113513

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

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Lib/idlelib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

from tkinter.font import Font
import idlelib
from idlelib import macosx

class InvalidConfigType(Exception): pass
class InvalidConfigSet(Exception): pass
Expand Down Expand Up @@ -660,6 +661,12 @@ def GetCoreKeys(self, keySetName=None):
'<<zoom-height>>': ['<Alt-Key-2>'],
}

if sys.platform == "darwin":
# XXX: ^^^ This test should be macosx.isAquaTk(),
# but that has some side effect that results in not
# calling the quit event handler.
del keyBindings['<<close-all-windows>>']

if keySetName:
if not (self.userCfg['keys'].has_section(keySetName) or
self.defaultCfg['keys'].has_section(keySetName)):
Expand Down
2 changes: 0 additions & 2 deletions Lib/idlelib/macosx.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,6 @@ def help_dialog(event=None):
root.bind('<<open-config-dialog>>', config_dialog)
root.createcommand('::tk::mac::ShowPreferences', config_dialog)
if flist:
root.bind('<<close-all-windows>>', flist.close_all_callback)

# The binding above doesn't reliably work on all versions of Tk
# on macOS. Adding command definition below does seem to do the
# right thing for now.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment “The binding above…” should likely also be adjusted so that it makes sense after removing the binding it refers to.

Expand Down