Skip to content

gh-158067: Keep Python files first in IDLE Open dialog from Shell - #158071

Merged
terryjreedy merged 2 commits into
python:mainfrom
lazerg:fix-issue-158067
Sep 24, 2026
Merged

terryjreedy merged 2 commits into
python:mainfrom
lazerg:fix-issue-158067

Conversation

@lazerg

@lazerg lazerg commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

gh-65339 made Shell and Output windows save as text by setting io.filetypes to the text-first list, but askopenfile reads the same attribute. Since Shell is usually the first window, File > Open started with "Text files (*.txt)" selected and hid .py files.

The save dialog now reads a separate save_filetypes attribute, which Output windows override, so File > Open keeps listing Python files first.

Fixes #158067

@terryjreedy terryjreedy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See below.

self.assertEqual(io.filetypes[0][0], 'Text files')
self.assertEqual(io.save_filetypes[0][0], 'Text files')

def test_open_defaults_to_python(self):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not really test what we want to know, which is what the user sees when the select the menu item or give the shortcut key. The same is true of the test above. Both would require generating the event and mocking the dialog call. Possible, but I tested this in live IDLE and want to fix the regression now, before the next releases in a week. And I have other pr to review for inclusion. So I will merge as is.

@terryjreedy
terryjreedy merged commit e08b0d4 into python:main Sep 24, 2026
56 checks passed
@terryjreedy terryjreedy added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Sep 24, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @lazerg for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @lazerg for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @lazerg for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Sep 24, 2026

Copy link
Copy Markdown

GH-158141 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Sep 24, 2026
@bedevere-app

bedevere-app Bot commented Sep 24, 2026

Copy link
Copy Markdown

GH-158142 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Sep 24, 2026
@bedevere-app

bedevere-app Bot commented Sep 24, 2026

Copy link
Copy Markdown

GH-158143 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Sep 24, 2026
terryjreedy pushed a commit that referenced this pull request Sep 25, 2026
…ell (GH-158071) (#158141)

gh-158067: Keep Python files first in IDLE Open dialog from Shell (GH-158071)

Fix regression in July releases.
(cherry picked from commit e08b0d4)

Co-authored-by: Lazizbek Ergashev <lazerg2@gmail.com>
terryjreedy pushed a commit that referenced this pull request Sep 25, 2026
…ell (GH-158071) (#158142)

gh-158067: Keep Python files first in IDLE Open dialog from Shell (GH-158071)

Fix regression in July releases.
(cherry picked from commit e08b0d4)

Co-authored-by: Lazizbek Ergashev <lazerg2@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IDLE 3.14.7 FileOpenDialog preselection is Text files (*.txt)

2 participants