-
-
Notifications
You must be signed in to change notification settings - Fork 31.2k
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
IDLE on macOS will close without warning when there are open unsaved files #112898
Comments
Is "launching IDLE.app" what I do when I click the an icon in either Finder or the dock? Either way, I have The box is a tkinter.message.askyesnocancel box called in idlelib.iomenu.IOBinding.maybesave, which is called in editor.EditorWindow.maybesave. Tkinter.message calls code in other tkinter dialog submodules. EDIT: Change |
I observe this when using “Quit” from the app menu and the dock icon menu, and using Command-Q. I suspect this has always been the case on Tk Aqua and does not have to do with the macOS or Tcl/Tk version. Apparently the way to prevent this is to override the Tcl proc |
I double clicked on the IDLE.app in the finder to start IDLE. |
I'll see if implementing this for IDLE helps here. |
I think this is the spot where IDLE already tries to prevent Tk Aqua from closing: Lines 218 to 224 in dd2ebdf
Replacing |
I was wrong. This behavior was introduced in Tk 8.6.11 (late 2020) by this change: https://core.tcl-lang.org/tk/info/a055a4fa5c68 |
Implement the TK function ``::tk::mac::Quit`` on macOS to ensure that IDLE asks about saving unsaved files when quitting IDLE.
Thanks, that's a better fix that I had initially. UPDATE: I've added you as a co-author to the PR I created earlier. |
There is other problem here. |
) * gh-112898: warn about unsaved files when quitting IDLE on macOS Implement the TK function ``::tk::mac::Quit`` on macOS to ensure that IDLE asks about saving unsaved files when quitting IDLE. Co-authored-by: Christopher Chavez chrischavez@gmx.us
…pythonGH-112939) * pythongh-112898: warn about unsaved files when quitting IDLE on macOS Implement the TK function ``::tk::mac::Quit`` on macOS to ensure that IDLE asks about saving unsaved files when quitting IDLE. (cherry picked from commit 3251ba8) Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com> Co-authored-by: Christopher Chavez chrischavez@gmx.us
…pythonGH-112939) * pythongh-112898: warn about unsaved files when quitting IDLE on macOS Implement the TK function ``::tk::mac::Quit`` on macOS to ensure that IDLE asks about saving unsaved files when quitting IDLE. (cherry picked from commit 3251ba8) Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com> Co-authored-by: Christopher Chavez chrischavez@gmx.us
I don't understand why, but... If I choose "cancel" in the dialog that asks about saving IDLE keeps running, IDLE only quits when I choose Yes or No. Could this be because EditorWindow._close is never called when the user chooses "cancel"? I'm not really a Tkinter user, all my changes are done by emulation surrounding code without deep knowledge about Tk/Tkinter. |
Clicked "comment" too soon... One think I did notice when testing what happens when I choose "cancel": the dialog gets shown a second time. |
GH-112939) (#112960) gh-112898: warn about unsaved files when quitting IDLE on macOS (GH-112939) * gh-112898: warn about unsaved files when quitting IDLE on macOS Implement the TK function ``::tk::mac::Quit`` on macOS to ensure that IDLE asks about saving unsaved files when quitting IDLE. (cherry picked from commit 3251ba8) Co-authored-by: Christopher Chavez chrischavez@gmx.us Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
GH-112939) (#112961) gh-112898: warn about unsaved files when quitting IDLE on macOS (GH-112939) * gh-112898: warn about unsaved files when quitting IDLE on macOS Implement the TK function ``::tk::mac::Quit`` on macOS to ensure that IDLE asks about saving unsaved files when quitting IDLE. (cherry picked from commit 3251ba8) Co-authored-by: Christopher Chavez chrischavez@gmx.us Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Leaving the issue open for now to further investigate the "cancel" issue mentioned by Serhiy. |
Try to comment out line |
…se" dialog On macOS, when it is asked just before quiting the application, the user has no option to cancel quiting.
…se" dialog On macOS, when it is asked just before quiting the application, the user has no option to cancel quiting.
I have not tried #112994, but currently I either do not understand Serhiy’s concern, or I have not observed it. Something I do observe is that when quitting IDLE (i.e.
Ronald, are you referring to the duplicated dialog which occurs after pressing Command-Q and then canceling? That appears to be caused by this binding: cpython/Lib/idlelib/config-keys.def Line 267 in c454e93
Currently I would suggest removing this binding in favor of only relying on |
I'll look at this later this week. |
Although defining |
…iles Without this changeset I get two consecutive dialogs asking if I want to save an unsafed file, when choosing "Cancel" in the first one.
#113513 fixes the second dialog for me. Sorry about the delay in looking into this. |
As I point out in #113513 (comment):
This was true even before 8.6.11, but I would emphasize that if IDLE is going to rely on |
Is this also true for other high-level event commands, such as It might be possible to avoid creating multiple Tk instances, AFAIK macosx.py is currently the only file in IDLE that creates a throwaway instance of |
Yes. |
…oren/cpython into pythongh-112898-double-dialog
…python#112939) * pythongh-112898: warn about unsaved files when quitting IDLE on macOS Implement the TK function ``::tk::mac::Quit`` on macOS to ensure that IDLE asks about saving unsaved files when quitting IDLE. Co-authored-by: Christopher Chavez chrischavez@gmx.us
…python#112939) * pythongh-112898: warn about unsaved files when quitting IDLE on macOS Implement the TK function ``::tk::mac::Quit`` on macOS to ensure that IDLE asks about saving unsaved files when quitting IDLE. Co-authored-by: Christopher Chavez chrischavez@gmx.us
Bug report
Bug description:
To reproduce:
Expected behaviour:
Actual behaviour:
CPython versions tested on:
3.11, 3.12, 3.13
Operating systems tested on:
macOS
Linked PRs
The text was updated successfully, but these errors were encountered: