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 Autocomplete and Call Tips Do Not Pop Up on OS X with ActiveTcl 8.5.18 #68758

Closed
AlessandroRosa mannequin opened this issue Jul 5, 2015 · 16 comments
Closed

IDLE Autocomplete and Call Tips Do Not Pop Up on OS X with ActiveTcl 8.5.18 #68758

AlessandroRosa mannequin opened this issue Jul 5, 2015 · 16 comments
Assignees
Labels
OS-mac topic-IDLE topic-tkinter type-bug An unexpected behavior, bug, or error

Comments

@AlessandroRosa
Copy link
Mannequin

AlessandroRosa mannequin commented Jul 5, 2015

BPO 24570
Nosy @terryjreedy, @ronaldoussoren, @taleinat, @ned-deily, @roseman
Files
  • calltip.patch
  • 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 2015-09-27.00:19:20.520>
    created_at = <Date 2015-07-05.20:48:27.583>
    labels = ['OS-mac', 'expert-IDLE', 'type-bug', 'expert-tkinter']
    title = 'IDLE Autocomplete and Call Tips Do Not Pop Up on OS X with ActiveTcl 8.5.18'
    updated_at = <Date 2015-10-26.15:53:02.642>
    user = 'https://bugs.python.org/AlessandroRosa'

    bugs.python.org fields:

    activity = <Date 2015-10-26.15:53:02.642>
    actor = 'jmas'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2015-09-27.00:19:20.520>
    closer = 'terry.reedy'
    components = ['IDLE', 'macOS', 'Tkinter']
    creation = <Date 2015-07-05.20:48:27.583>
    creator = 'Alessandro Rosa'
    dependencies = []
    files = ['40173']
    hgrepos = []
    issue_num = 24570
    keywords = ['patch']
    message_count = 16.0
    messages = ['246337', '246341', '246345', '246348', '246376', '246589', '246713', '248487', '248493', '248494', '248524', '248794', '251673', '251674', '253370', '253477']
    nosy_count = 9.0
    nosy_names = ['terry.reedy', 'ronaldoussoren', 'taleinat', 'wordtech', 'ned.deily', 'markroseman', 'python-dev', 'Alessandro Rosa', 'jmas']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue24570'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5', 'Python 3.6']

    @AlessandroRosa
    Copy link
    Mannequin Author

    AlessandroRosa mannequin commented Jul 5, 2015

    I recently upgraded to Python 2.7.10 on my MacOSX Yosemite computer. I also added a Python 3.4.3 installation. At the time I upgraded Tcl/Tk with ActiveTcl 8.5.18 as was suggested on the Python for MacOSX installation page.

    At this point, Autocomplete and Call Tips stopped popping up. I checked the preferences and it seemed to be turned on. The delay was set to 2000, so I changed that to 2, but nothing happened. Pressing <ctrl>-Spacebar and then using the down arrow key lets me cycle through the the available functions, but putting a dot after an object has no effect, and if I open parentheses, I get no tips. This is both in the IDLE Shell and Editor windows.

    I tried to redo everything by deleting all instances of Python from my drive. I reinstalled them, reloaded all packages, and Autocomplete and call tips still are not popping up. Is there any known issues or is there a workaround? Do I possibly need to add or change the new Tk path somewhere so that IDLE can find what it needs to popup autocomplete? Is there a way that I can initiate IDLE Autocomplete and Call Tips during the coding session to manually get them to work?

    I am somewhat new to Python, and I often rely on the autocomplete tips to remind me of what I need to do or what methods are available for an object. I really like IDLE but it is hard for me to use without this functionality. Any help would be greatly appreciated.

    Thank you,

    @AlessandroRosa AlessandroRosa mannequin added topic-IDLE OS-mac topic-tkinter type-bug An unexpected behavior, bug, or error labels Jul 5, 2015
    @ned-deily
    Copy link
    Member

    Thanks for the report. Taking a quick look at it, it appears that the problem was introduced with the most recently releases of ActiveTcl on OS X, 8.5.18 and 8.6.4. The autocomplete popups seem to work fine with the previous OS X release of ActiveTcl 8.5 (8.5.17) and with a MacPorts +quartz build of Tcl/Tk 8.6.3. I know that Kevin Walzer added a lot of fixes to the native OS X version of Tk that were first released with 8.6.4 and 8.5.18 and I think there have been additional fixes since then but are not yet in an official Tcl/Tk release. I'm cc-ing Kevin here; perhaps this will look familiar.

    As workarounds, if you have access to ActiveTcl 8.5.17, you could install that. Or, if you feel up to building your own framework version of 8.5.17, you could try that. You *could* also remove 8.5.18 and fall back to the Apple-supplied system Tcl/Tk 8.5.9 but I would strongly recommend not doing that as that version has critical problems, most notably the bug that causes Tk to crash (and, thus, crash IDLE with no opportunity for saving work) by typing multi-character compose codes in text boxes (like option-u on US keyboard layouts).

    So it should first be established whether this problem still exists with current trunk of 8.5.x (for that's what the OS X installers link with) and, if so, try to get a new version of ActiveTcl 8.5.x released. It might help to file an issue with ActiveState (https://bugs.activestate.com/index.cgi) and/or on the Tk issue tracker (https://core.tcl.tk/tk/reportlist). And it would be even better to have a pure Tcl/Tk test case using wish so that Python is not a factor. Unfortunately, I'm not going to have much time for the immediate future to shepherd that activity.

    @ned-deily ned-deily changed the title IDLE Autocomplete and Call Tips Do Not Pop Up IDLE Autocomplete and Call Tips Do Not Pop Up on OS X with ActiveTcl 8.5.18 Jul 5, 2015
    @wordtech
    Copy link
    Mannequin

    wordtech mannequin commented Jul 6, 2015

    Where in the IDLE source code tree is this code housed? Is it possible to provide a Python script that reproduces the issue?

    @AlessandroRosa
    Copy link
    Mannequin Author

    AlessandroRosa mannequin commented Jul 6, 2015

    Thank you for the reply. I raised a bug with ActiveState. I am a Community User, so I can't access prior builds of ActiveTcl, and I am no where near competent enough to build up a framework.

    @ned-deily
    Copy link
    Member

    Kevin, I think that Autocomplete is implemented as an IDLE extension in:
    Lib/idlelib/AutoComplete.py
    Lib/idlelib/AutoCompleteWindow.py

    and configured in:
    Lib/idlelib/config-extensions.def
    -> force-open-completions=<Control-Key-space>

    Perhaps someone could try to reduce it to smaller test case; I will likely not have time to work on it myself for the immediate future. Tal, can you reproduce this issue when using ActiveTcl 8.5.18?

    @terryjreedy
    Copy link
    Member

    More tests might help pin down the bug. Here is the complete config for completions.
    [AutoComplete]
    enable=True
    popupwait=2000
    [AutoComplete_cfgBindings]
    force-open-completions=<Control-Key-space>
    [AutoComplete_bindings]
    autocomplete=<Key-Tab>
    try-open-completions=<KeyRelease-period> <KeyRelease-slash> <KeyRelease-backslash>

    Notes: config-extensions.def is initially opened and generically processed in various methods of configHandler.IdleConf, and on request, the config-extentions section of EditorWindow.py. cfgBindings can be (sensibly) reconfigured, the others not. Names that follow, before '=', become pseudoevents handles by methods in the

    Alessandro, you said <Control-Key-space> works, <KeyRelease-period> does not. How about <Key-Tab> and <KeyRelease-(back)slash>. The latter pair work within path strings when the preceding chars begin a path that exist on your system. For instance, on Win 7, './ lists options in the current directory.

    I have no idea why KeyRelease instead of Key is used above and below. There is no key equivalent of releasing a mouse button in a different location than where pressed. Kevin, could there be a bug with KeyRelease on Mac? Alessandro, you could test by making a backup of configextensions.def and removing 'Release' for 'period'.

    The calltip files are
    CallTips.py
    CallTipWindow.py
    and in config-extensions.def,

    [CallTips]
    enable=True
    [CallTips_cfgBindings]
    force-open-calltip=<Control-Key-backslash>
    [CallTips_bindings]
    try-open-calltip=<KeyRelease-parenleft>
    refresh-calltip=<KeyRelease-parenright> <KeyRelease-0>

    Alessandro, you said <KeyRelease-parenleft> does not work. How abut <Control-Key-backslash> (after '(') to open? Does <KeyRelease-parenright> close properly?

    I do not know what <KeyRelease-0> (zero) is about. It does not work for me.

    For both boxes, clicking on the box should also close. Does it?
    What about Edit -> Show Completions and Edit -> Show calltips for opening?

    @AlessandroRosa
    Copy link
    Mannequin Author

    AlessandroRosa mannequin commented Jul 14, 2015

    Hi Terry,

    I will try my best to answer your questions.

    To update you, I decided to completely uninstall the ActiveState frameworks from my Mac. This brought me back to the dreaded Apple version of Tcl/Tk 8.5.9 with the IDLE warning about it. At this point Autocomplete and Call Tips worked again. If I initialized a list and then typed a_list. then the pop up menu would appear for the methods associated with list. If I typed a_list.append( then the Call Tip with the docstring information for list.append would appear. (I didn't try some of the other methods that we talk about in the questions as I was not aware of them at the time).

    I then downloaded a new installer from ActiveState for Tcl/Tk 8.5.18 and ran the install. I tested IDLE again, and at this point the Autocomplete pop up menu does not display, and the Call Tips no longer appear when I open a methods parenthesis.

    Questions:
    ======================
    "Alessandro, you said <Control-Key-space> works, <KeyRelease-period> does not. How about <Key-Tab> and <KeyRelease-(back)slash>. The latter pair work within path strings when the preceding chars begin a path that exist on your system."

    • <Control-Key-space>
      If I type a_list. and then <Control-Key-space> no pop up menu appears, however when I press the Up or Down arrow keys, it cycles through the methods available for that object. The Autocompletes display inline, one at a time and not as a popup.

    To expand on this, if I press <Control-Key-space> at the prompt of the IDLE shell or at a blank line in an editor screen the Up and Down arrow keys will cycle through any builtin functions, keyword arguments (mostly errors), or declared variables available, plus True and False.

    • <KeyRelease-period>
      This has no effect. There is no popup window, and unlike with <Control-Key-space> the arrow keys move the cursor around the screen and do not cycle through any of the Autocomplete options.

    • <Key-Tab>
      For the sake of brevity, <Key-Tab> works the same as <Control-Key-space> does after a dot, so a_list. and <Key-Tab> lets the Up and Down arrow keys cycle through available methods.

    • <KeyRelease-(back)slash>
      Within a path string, <KeyRelease-(back)slash> allows for the cycling through of the directories at that level of the path using the Up and Down arrow keys. As with the others, no popup menu is visible when pressing <KeyRelease-(back)slash>. (That is a handy tip I didn't know about... Thanks!)

    ------------------------

    "Alessandro, you could test by making a backup of configextensions.def and removing 'Release' for 'period'."

    • When I do this and restart IDLE, the only difference in behavior is that placing a period after an object, a_list., acts like pressing <Key-Tab> or <Control-Key-space> did prior to the change. It allows for the cycling through of methods with the arrow keys, but no popup menu.

    ------------------------

    "Alessandro, you said <KeyRelease-parenleft> does not work. How abut <Control-Key-backslash> (after '(') to open? Does <KeyRelease-parenright> close properly?"

    • <KeyRelease-parenleft>
      Correct. There is no Call Tips popup when I open a parenthesis after an object method.

    • <Control-Key-backslash>
      This has no effect.

    • <KeyRelease-parenright>
      I am not sure what your question means. It works as a normal close parenthesis would in any text editor. If you mean does <KeyRelease-parenright> close the Call Tips popup properly, then I can't say as there is no Call Tip popup displaying.

    One thing to note, something is happening with <KeyRelease-0> after a closed parenthesis, it is just that nothing is visible. So if I enter a_list.append() and then press and release the 0 key and then press the Up or Down arrow key, the cursor is frozen in place for the first press. Then is starts to move with subsequent presses. It seems like IDLE is trying to get the Call Tip, but no window appears to display the information.

    ------------------------

    "For both boxes, clicking on the box should also close. Does it?
    What about Edit -> Show Completions and Edit -> Show calltips for opening?"

    • The popup boxes do not display at all. Going through the answers I have given so far, it seems like IDLE is accessing the information that it needs to for Autocomplete (and possibly Call Tips, though I cannot see it as it is never displayed on screen), it is just that the display boxes do not display. Maybe the problem is not Autocomplete or Call Tips at all, but in the module that is called to display the information that they return, or a command in that module was renamed or deprecated?

    • Edit -> Show Completions
      After reverting back to the backup version of config-extensions.def, this has the same behavior as <Key-Tab> and <Control-Key-space> have. Up and Down Arrow allows cycling through of methods, but there is no popup window visible.

    • Edit -> Show calltips
      This has no effect, whether it is with an open parenthesis or after the parenthesis has been closed.

    Thank you for the reply and trying to find a solution.

    ~ A

    @roseman
    Copy link
    Mannequin

    roseman mannequin commented Aug 12, 2015

    I did some followup on this today, and could reproduce it with a few lines of Tcl/Tk code. As Ned noted, it seems particular to the ActiveTcl build, as when I built my own 8.5.18 it also worked fine.

    (If you're curious, the thing that is failing is the MacWindowStyle call to set the window to type "help". If you use that, the window just doesn't show up. Oddly, other types, e.g. "utility" work properly).

    I tried various introspection techniques to see if I could detect that this problem had occurred from code, but no luck. As far as Tk was concerned, the window was there.

    Will send a message to tcl-core list regarding this. For reference, Tcl script to reproduce is:

    wm geometry . +32+32
    toplevel .t
    wm geometry .t +60+60
    tk::unsupported::MacWindowStyle style .t help "noActivates"
    grid [label .t.l -bg yellow -text "tooltip window"]

    @wordtech
    Copy link
    Mannequin

    wordtech mannequin commented Aug 13, 2015

    I experimented with Mark's sample code (thanks for that, BTW), and found that the window with the "help" tag applied would display with this simple addition:

    raise .t

    I believe the equivalent call in Tinter is lift(), because raise() is for error handling? Perhaps someone can experiment with appropriate calls to lift() in the relevant sections of IDLE.

    The "help" style is excluded from becoming a frontmost window by default in OS X. Here is the relevant code in tkMacOSXWm.c:

    • (BOOL) canBecomeKeyWindow
      {
      TkWindow *winPtr = TkMacOSXGetTkWindow(self);

      return (winPtr && winPtr->wmInfoPtr && (winPtr->wmInfoPtr->macClass ==
      kHelpWindowClass || winPtr->wmInfoPtr->attributes &
      kWindowNoActivatesAttribute)) ? NO : YES;
      }

    Therefore, an explicit call to raise may be helpful in displaying the window.

    I realize that such calls are not present in the current IDLE code, and did not seem to be required previously--there likely was some change in recent Tk-Cocoa commits in event loop handling, memory management, window display, and drawing that caused this new bug to crop up. Tracking the actual source of the bug at the C level is likely to prove very difficult because there have been so many changes. However, since the fix at the script level is trivial, I do not think a major effort is necessary to step through the code at the C level.

    @terryjreedy
    Copy link
    Member

    Yes, *raise* is a keyword and .lift() is the substitute.

    @roseman
    Copy link
    Mannequin

    roseman mannequin commented Aug 13, 2015

    Awesome, thanks Kevin. Have attached calltip.patch. The extra lift() call doesn't seem to hurt on Windows or X11, so didn't make it conditional.

    @roseman
    Copy link
    Mannequin

    roseman mannequin commented Aug 18, 2015

    Alessandro, would you have a chance to test this one line patch, which makes calltips work again on OS X?

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 27, 2015

    New changeset b5bc7e9dab77 by Terry Jan Reedy in branch '2.7':
    Issue bpo-24570: Idle: make calltip and completion boxes appear on Macs
    https://hg.python.org/cpython/rev/b5bc7e9dab77

    New changeset 6687630e201a by Terry Jan Reedy in branch '3.4':
    Issue bpo-24570: Idle: make calltip and completion boxes appear on Macs
    https://hg.python.org/cpython/rev/6687630e201a

    @terryjreedy
    Copy link
    Member

    Added equivalent completion window patch. Would have preferred confirmation that Idle versions work, but 3.4.4rc1 is only a week away and I think having bug confirmed and fixed in tcl is enough to go with.

    @terryjreedy terryjreedy self-assigned this Sep 27, 2015
    @jmas
    Copy link
    Mannequin

    jmas mannequin commented Oct 23, 2015

    This issue continues unfixed.

    After uninstalling ActiveTcl 8.5.18 and then installing ActiveTcl 8.5.17, IDLE completion and call tips work again.

    Tested with Python 3.5 and 3.4.1.

    @jmas
    Copy link
    Mannequin

    jmas mannequin commented Oct 26, 2015

    My previous comment was incorrect, sorry.

    I thought that this issue was fixed in time for the release of Python 3.5, but it wasn't (fix was committed on Sep 26, two weeks after 3.5's release).

    My apologies.

    @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
    OS-mac topic-IDLE topic-tkinter type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants