Skip to content
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: Better document close and exit. #89459

Closed
terryjreedy opened this issue Sep 26, 2021 · 12 comments
Closed

IDLE: Better document close and exit. #89459

terryjreedy opened this issue Sep 26, 2021 · 12 comments
Assignees
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@terryjreedy
Copy link
Member

BPO 45296
Nosy @terryjreedy, @taleinat, @ambv, @miss-islington, @E-Paine
PRs
  • @terryjreedy bpo-45296: Fix exit/quit message on Windows  #28577
  • [3.10] bpo-45296: Fix exit/quit message on Windows (GH-28577) #28600
  • [3.9] bpo-45296: Fix exit/quit message on Windows (GH-28577) #28601
  • bpo-45296: Clarify close, quit, and exit in IDLE #30936
  • [3.10] bpo-45296: Clarify close, quit, and exit in IDLE (GH-30936) #30944
  • [3.9] bpo-45296: Clarify close, quit, and exit in IDLE (GH-30936) #30945
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/terryjreedy'
    closed_at = <Date 2022-01-27.03:56:18.530>
    created_at = <Date 2021-09-26.20:52:27.906>
    labels = ['expert-IDLE', 'type-bug', '3.9', '3.10', '3.11']
    title = 'IDLE: Better document close and exit.'
    updated_at = <Date 2022-01-27.03:56:18.529>
    user = 'https://github.com/terryjreedy'

    bugs.python.org fields:

    activity = <Date 2022-01-27.03:56:18.529>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2022-01-27.03:56:18.530>
    closer = 'terry.reedy'
    components = ['IDLE']
    creation = <Date 2021-09-26.20:52:27.906>
    creator = 'terry.reedy'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 45296
    keywords = ['patch']
    message_count = 12.0
    messages = ['402678', '402689', '402693', '402697', '402768', '402773', '402774', '402775', '402820', '411829', '411832', '411834']
    nosy_count = 5.0
    nosy_names = ['terry.reedy', 'taleinat', 'lukasz.langa', 'miss-islington', 'epaine']
    pr_nums = ['28577', '28600', '28601', '30936', '30944', '30945']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue45296'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @terryjreedy
    Copy link
    Member Author

    On Windows:
    >>> exit
    'Use exit() or Ctrl-Z plus Return to exit'
    >>> quit
    'Use quit() or Ctrl-Z plus Return to exit'
    >>> exit.eof
    'Ctrl-Z plus Return'

    On *nix, 'Ctrl-Z plus Return' is 'Ctrl-D (i.e, EOF)'
    IDLE uses the latter even on Windows, and Ctrl-Z does not work.

    Both exit and quit are instances of _sitebuiltins.Quitter

    class Quitter(object):
    def __init__(self, name, eof):
    self.name = name
    self.eof = eof
    def __repr__(self):
    return 'Use %s() or %s to exit' % (self.name, self.eof)
    def __call__(self, code=None):
    # Shells like IDLE catch the SystemExit, but listen when their
    # stdin wrapper is closed.
    try:
    sys.stdin.close()
    except:
    pass
    raise SystemExit(code)

    class Quitter(object):
    def __init__(self, name, eof):
    self.name = name
    self.eof = eof
    def __repr__(self):
    return 'Use %s() or %s to exit' % (self.name, self.eof)
    def __call__ [not relevant here]

    We just need to replace current exit/quit.eof as indicated above on startup.

    @terryjreedy terryjreedy added topic-IDLE 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes labels Sep 27, 2021
    @terryjreedy terryjreedy self-assigned this Sep 27, 2021
    @terryjreedy terryjreedy added type-bug An unexpected behavior, bug, or error topic-IDLE 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes labels Sep 27, 2021
    @terryjreedy terryjreedy self-assigned this Sep 27, 2021
    @terryjreedy terryjreedy added the type-bug An unexpected behavior, bug, or error label Sep 27, 2021
    @terryjreedy
    Copy link
    Member Author

    Tal, Paine: should be use exactly the raw REPL message or something that might be clearer to beginners, like 'Ctrl-D (end-of-file)'?

    @taleinat
    Copy link
    Contributor

    How about "Control-D (end-of-file, a.k.a. EOF)" or even just "Control-D"?

    @E-Paine
    Copy link
    Mannequin

    E-Paine mannequin commented Sep 27, 2021

    How about "Control-D (end-of-file, a.k.a. EOF)"

    I doubt beginners care that it's EOF.

    or even just "Control-D"

    I'd be a lot more inclined towards this.

    IDLE uses the latter [Ctrl-D] even on Windows, and Ctrl-Z does not work.

    Is it worth considering changing this behaviour? IMO Ctrl-D is better for consistency between platforms, but wanted to throw the idea out there for discussion.

    @ambv
    Copy link
    Contributor

    ambv commented Sep 28, 2021

    New changeset e649e06 by Terry Jan Reedy in branch 'main':
    bpo-45296: Fix exit/quit message on Windows (GH-28577)
    e649e06

    @ambv
    Copy link
    Contributor

    ambv commented Sep 28, 2021

    New changeset 813fbba by Miss Islington (bot) in branch '3.9':
    bpo-45296: Fix exit/quit message on Windows (GH-28577) (GH-28601)
    813fbba

    @ambv
    Copy link
    Contributor

    ambv commented Sep 28, 2021

    New changeset acd46fe by Miss Islington (bot) in branch '3.10':
    bpo-45296: Fix exit/quit message on Windows (GH-28577) (GH-28600)
    acd46fe

    @ambv
    Copy link
    Contributor

    ambv commented Sep 28, 2021

    The wording chosen by Terry, i.e. "Ctrl-D (end-of-file)", is pretty clear. Merged and fixed. Thanks!

    @ambv ambv closed this as completed Sep 28, 2021
    @ambv ambv closed this as completed Sep 28, 2021
    @terryjreedy
    Copy link
    Member Author

    Unfortunately, I have discovered, the new wording is better but only correct for IDLE when Shell is the only window.

    On the file menu, I want to:
    A. Change 'Close' to 'Close Window', so it is clear that 'Close'/Alt-F4 only close the window and not IDLE.
    B. Also change 'Exit' to 'Exit IDLE' or maybe 'Quit IDLE', so it is clearer that this and Ctrl-Q close all windows and exit IDLE. Ctrl-Q is the default binding for 'close-all-windows', which users can configure.

    Also, add a little in the doc entry for these choices. Or maybe open a separate issue to add the option name for all menu entry hotkeys that can be rebound. I don't know how many that is.

    For a single window app, like the REPL, when not running in Command Prompt or the equivalent, closing the window and exiting the application are the same thing. The same is true when Shell is the only IDLE window. Closing Shell exits IDLE. After submitting the PR, I discovered that exit() and quit() only close Shell but do not exit IDLE if there are other windows. So the message should really be something like the following:

    To close Shell, enter 'exit()', 'quit()', or 'Alt-F4'.
    To exit IDLE, hit 'Ctrl-Q', hotkey for 'File >= Exit IDLE'.

    This requires replacing the __repr__ method. Someone who rebinds either hotkey option, which I expect is rare, will have to remember that they did so if that happen to enter either 'exit' or 'quit' without parens.

    The question of IDLE on Windows and <^Z Return> was discussed some years ago on an issue a vaguely remember but could not find. It was decided to either not add it or maybe to remove it, and key cross-platform ^D for closing Shell (and only Shell as it does nothing in Editor). I don't want to change that decision.

    @terryjreedy terryjreedy reopened this Sep 29, 2021
    @terryjreedy terryjreedy changed the title IDLE: Change Ctrl-Z note in exit/quit repr on Windows IDLE: Better document close and exit. Sep 29, 2021
    @terryjreedy terryjreedy reopened this Sep 29, 2021
    @terryjreedy terryjreedy changed the title IDLE: Change Ctrl-Z note in exit/quit repr on Windows IDLE: Better document close and exit. Sep 29, 2021
    @terryjreedy
    Copy link
    Member Author

    New changeset fcde0bc by Terry Jan Reedy in branch 'main':
    bpo-45296: Clarify close, quit, and exit in IDLE (GH-30936)
    fcde0bc

    @miss-islington
    Copy link
    Contributor

    New changeset bc7d96e by Miss Islington (bot) in branch '3.9':
    bpo-45296: Clarify close, quit, and exit in IDLE (GH-30936)
    bc7d96e

    @terryjreedy
    Copy link
    Member Author

    New changeset 5acaad0 by Miss Islington (bot) in branch '3.10':
    bpo-45296: Clarify close, quit, and exit in IDLE (GH-30936) (GH-30944)
    5acaad0

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes 3.10 only security fixes 3.11 only security fixes topic-IDLE type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants