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 uses common tkinter variables across all editor windows #57388

Open
serwy mannequin opened this issue Oct 14, 2011 · 4 comments
Open

IDLE uses common tkinter variables across all editor windows #57388

serwy mannequin opened this issue Oct 14, 2011 · 4 comments
Assignees
Labels
3.10 only security fixes topic-IDLE type-feature A feature request or enhancement

Comments

@serwy
Copy link
Mannequin

serwy mannequin commented Oct 14, 2011

BPO 13179
Nosy @terryjreedy, @serwy
Files
  • patch_EditorWindow.diff
  • 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 = None
    created_at = <Date 2011-10-14.15:52:27.670>
    labels = ['expert-IDLE', 'type-feature', '3.10']
    title = 'IDLE uses common tkinter variables across all editor windows'
    updated_at = <Date 2020-06-09.04:09:03.404>
    user = 'https://github.com/serwy'

    bugs.python.org fields:

    activity = <Date 2020-06-09.04:09:03.404>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = False
    closed_date = None
    closer = None
    components = ['IDLE']
    creation = <Date 2011-10-14.15:52:27.670>
    creator = 'roger.serwy'
    dependencies = []
    files = ['23406']
    hgrepos = []
    issue_num = 13179
    keywords = ['patch']
    message_count = 4.0
    messages = ['145539', '145578', '145601', '226373']
    nosy_count = 2.0
    nosy_names = ['terry.reedy', 'roger.serwy']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue13179'
    versions = ['Python 3.10']

    @serwy
    Copy link
    Mannequin Author

    serwy mannequin commented Oct 14, 2011

    IDLE's EditorWindow.py relies on using FileList.py's "vars" dictionary to store Tkinter variables instead of using its own. As a consequence,
    toggling a checked menu item in one editor window toggles the menu item in ALL editor windows.

    To reproduce this error, open two editor windows with Code Context initially disabled. Enable Code Context in one window and then click "Options" in the other. You'll see Code Context checked when it shouldn't be.

    Attached is a patch to fix this problem. It causes EditorWindow to have its own dictionary for handling these Tkinter variables instead of using the flist's "vars". The comment in FileList.py suggests that this design is a relic from an old version of IDLE, since getrawvar is no longer a function.

        self.vars = {} # For EditorWindow.getrawvar (shared Tcl variables)

    @serwy serwy mannequin added type-bug An unexpected behavior, bug, or error topic-IDLE labels Oct 14, 2011
    @terryjreedy
    Copy link
    Member

    This is more of a feature request than a bug report, in that the behavior appear intentional. But that is a moot point in that new IDLE features do not have to wait for a new release. The proposed new behavior seems plausibly better. I just wonder if anything in flist.vars *should* carry over (maybe as a copy) to all edit windows, but I do not know its contents.

    Also, I can imagine that someone who knows about (I did not before) and likes the 'code context' option (I might start using it) would want it to be always on once turned on. That suggests that it should be added to the configure dialog before being made local with this patch. I might feel the same about at least some of the other vars also.

    @terryjreedy terryjreedy added type-feature A feature request or enhancement and removed type-bug An unexpected behavior, bug, or error labels Oct 15, 2011
    @serwy
    Copy link
    Mannequin Author

    serwy mannequin commented Oct 15, 2011

    For Code Context, the behavior is a bug since the menu item check can be
    changed independently of the actual status of Code Context.

    As far as I can tell, flist.vars mostly contains variables created by
    EditorWindow.py's "get_var_obj". A quick grep for ".vars" in idlelib can
    confirm that.

    It also contains variables created by PyShell.py, particularly
    '<<toggle-jit-stack-viewer>>' and '<<toggle-debugger>>'. Since the
    shell can only have one instance, its tkinter variables can be held
    local to the EditorWindow instance.

    @terryjreedy
    Copy link
    Member

    There has been more discussion of code context toggling in bpo-17535, msg225411 2014-8-16 and following messages. The code context button toggles both the state of the current window and the default for new windows.

    PEP-434 ratified my comment about new Idle features not having to wait. bpo-3068 is about adding an extension configuration dialog that will be needed to uncouple the local and global effects of option buttons for extension features.

    @terryjreedy terryjreedy added the 3.7 (EOL) end of life label Jun 30, 2017
    @terryjreedy terryjreedy self-assigned this Jun 30, 2017
    @terryjreedy terryjreedy added 3.10 only security fixes and removed 3.7 (EOL) end of life labels Jun 9, 2020
    @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.10 only security fixes topic-IDLE type-feature A feature request or enhancement
    Projects
    Status: No status
    Development

    No branches or pull requests

    1 participant