cpython icon indicating copy to clipboard operation
cpython copied to clipboard

Windows IDLE taskbar icon jump list fails to open recent files

Open d009eb67-2b4f-4621-8997-8c3e222ae3f4 opened this issue 4 years ago • 10 comments

BPO 43236
Nosy @terryjreedy, @pfmoore, @tjguk, @ned-deily, @zware, @eryksun, @zooba, @veganaiZe
Files
  • jumplist.png: PNG image of jump list
  • 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 = None
    closed_at = None
    created_at = <Date 2021-02-16.01:53:24.349>
    labels = ['3.8', 'type-bug', 'expert-installation', 'OS-windows']
    title = 'Windows IDLE taskbar icon jump list fails to open recent files'
    updated_at = <Date 2021-02-16.18:55:34.560>
    user = 'https://github.com/veganaiZe'
    

    bugs.python.org fields:

    activity = <Date 2021-02-16.18:55:34.560>
    actor = 'ned.deily'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Installation', 'Windows']
    creation = <Date 2021-02-16.01:53:24.349>
    creator = 'veganaiZe'
    dependencies = []
    files = ['49812']
    hgrepos = []
    issue_num = 43236
    keywords = []
    message_count = 6.0
    messages = ['387082', '387084', '387085', '387098', '387123', '387126']
    nosy_count = 8.0
    nosy_names = ['terry.reedy', 'paul.moore', 'tim.golden', 'ned.deily', 'zach.ware', 'eryksun', 'steve.dower', 'veganaiZe']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue43236'
    versions = ['Python 3.8']
    

    OS: Windows 8.1 (x86-64) Python: 3.8.7

    When I right-click on IDLE's rectangle/icon in the Windows taskbar it displays a "jump list" which contains recent/pinned filenames.

    A program will typically open a file when it's selected from the list.

    IDLE doesn't open the file, nor does it switch to the corresponding editor window if the file is already open. It seems to ignore the selection entirely.

    If IDLE is going to display a "Recent" list, within the jump list, then it would be nice if it actually opened the file(s).

    This is a Windows installer code issue rather than an IDLE code issue. On Win10, I do not see jump lists for IDLE icons but do for several others. Perhaps the installer was changed to disable the non-functional lists. I will let the installer people comment further.

    terryjreedy avatar Feb 16 '21 03:02 terryjreedy

    I will just note that the IDLE File menu has a Recent Files list, which is the same thing. (Notepad++ does also, in addition to a working icon jump list.)

    terryjreedy avatar Feb 16 '21 03:02 terryjreedy

    The IDLE shortcut that's installed by the development distribution runs "<installation_path>\pythonw.exe" "<installation_path>\Lib\idlelib\idle.pyw". Thus opening a file that's pinned to the jumplist will execute it as a script via "pythonw.exe".

    To integrate better with the Windows shell, IDLE would need its own executable. Moreover, AFAICT, it isn't enough to use a launcher that executes "pythonw.exe", such as a distlib launcher installed by pip for an entrypoint script. Using a launcher disassociates the executable that the shell runs to open a file from the application that creates the UI. It needs to be a simple C application that hard codes executing the idlelib module, similar in spirit to what's implemented in PC/python_uwp.cpp for the store app. I created a test app that implements this, and I can confirm that pinned and recent files in the jumplist open as desired in IDLE.

    The development distribution would install the new binary (e.g. "idle3.10.exe") in the installation directory beside the DLL. That's the simplest way to link with the interpreter DLL and find the standard library. The IDLE shortcut target and "Edit with IDLE" command would be updated to use the new executable instead of "pythonw.exe".

    eryksun avatar Feb 16 '21 08:02 eryksun

    Eryk, thank you for the research. Our macOS installer already adds an 'idlex.y' executable. Ned, do you have any comments, pro or con, about doing so.

    (I worry a bit about reinforcing the beginner delusion that IDLE is Python or that IDLE executes Python code. But this appears to already be as common for Windows beginners as for Mac beginners.)

    terryjreedy avatar Feb 16 '21 18:02 terryjreedy

    Ned, do you have any comments, pro or con, about doing so.

    I don't think there is a conflict here and I don't really have an opinion as I don't use Windows regularly. From a bit of web research, it looks like the closest thing to Windows jump lists on macOS are control-clicking on an app icon (like IDLE.app) in the dock which then may show some recent files used with the app. As you note, IDLE's recent file list is also available, a good cross-platform choice.

    ned-deily avatar Feb 16 '21 18:02 ned-deily

    @zooba Do you have any opinion about Eryk Sun's solution?

    Looking at my taskbar, the Windows Explorer list looks useful and truly recent. The Notepad++ list is 13 instead of the 30 items in N++'s own list. The Thunderbird list is useless, comprising mostly old items, some over two years, moved to archive directories.

    I am more interested in expanding IDLE's Recent Files list and giving it a hotkey for quicker access.

    terryjreedy avatar Nov 03 '22 04:11 terryjreedy

    It's the right solution. Best implemented by copying Programs\python.c/PCbuild\python.vcxproj and using the initialization API to always make it launch IDLE rather than parsing the whole command line for Python stuff.

    Interestingly, if I pin the Store installed IDLE icon, it doesn't seem to get jump list items from the Open dialog. But maybe there's something else breaking that association?

    zooba avatar Nov 03 '22 14:11 zooba

    I am not quite sure what 'it' in 'make it launch IDLE' refers to.

    I ran IDLE 3.8.10 and did not pin the taskbar icon. I opened files with the tk-wrapped file dialog (IDLE's Open), the recent files list, and IDLE's recent files and nothing got pinned. Right clicking x.py in Explorer and Edit with IDLE only had entries for 3.11 and 3.12, not for 3.8 to 3.10. Neither of those entries work. The only thing non-standard about those python.org installer installs is the install directory.

    terryjreedy avatar Nov 03 '22 16:11 terryjreedy

    Some of those operations probably need a manual API call to add the file to the recently opened files list. I don't remember the exact rules, but generally double-clicking and standard open file dialogs will add automatically, but non-standard dialogs and other context-menu commands will not.

    When you say "neither of those entries work" does that mean they don't even launch IDLE? Or they don't add to the recently used files?

    zooba avatar Nov 07 '22 17:11 zooba