Skip to content

IDLE: Document SaveAs dialog extension handling #65802

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

Closed
rhettinger opened this issue May 29, 2014 · 12 comments
Closed

IDLE: Document SaveAs dialog extension handling #65802

rhettinger opened this issue May 29, 2014 · 12 comments
Assignees
Labels
3.7 (EOL) end of life topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@rhettinger
Copy link
Contributor

BPO 21603
Nosy @rhettinger, @terryjreedy, @taleinat, @ned-deily

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 2014-05-29.07:41:12.584>
labels = ['expert-IDLE', 'type-bug', '3.7']
title = 'IDLE: Document SaveAs extension display on Mac'
updated_at = <Date 2018-11-12.06:55:45.778>
user = 'https://github.com/rhettinger'

bugs.python.org fields:

activity = <Date 2018-11-12.06:55:45.778>
actor = 'taleinat'
assignee = 'terry.reedy'
closed = False
closed_date = None
closer = None
components = ['IDLE']
creation = <Date 2014-05-29.07:41:12.584>
creator = 'rhettinger'
dependencies = []
files = []
hgrepos = []
issue_num = 21603
keywords = []
message_count = 11.0
messages = ['219338', '219355', '219424', '229117', '229128', '229131', '229136', '229178', '229199', '329656', '329720']
nosy_count = 4.0
nosy_names = ['rhettinger', 'terry.reedy', 'taleinat', 'ned.deily']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'test needed'
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue21603'
versions = ['Python 3.6', 'Python 3.7']

@rhettinger
Copy link
Contributor Author

In IDLE, edit and save a file foo.py.
Then choose File SaveAs.
The dialog box only shows "foo", not "foo.py"
which is irritating when renaming a file or saving a variant of a file.

@rhettinger rhettinger added topic-IDLE type-bug An unexpected behavior, bug, or error labels May 29, 2014
@ned-deily
Copy link
Member

There are known differences among the various Tk implementations with regard to how file extensions are handled in Tk file dialogs, like IDLE uses; see bpo-4832. Can you say which version of Tk was in use (it should be in the About IDLE display) and on what platform? I was not able to reproduce this behavior on any of the current OS X IDLEs and Tks with Save As.

@terryjreedy
Copy link
Member

On Win 7, I also see x.py in the save dialog, both 2.7 and 3.4 as installed.

@terryjreedy
Copy link
Member

I agree that having .py not visible but written would be obnoxious. Hoever, without more information, I am inclined to close this as a 3rd parth (OS) issue. Saimadhav, can you quickly try Save As with x.py on Linux?

@rhettinger
Copy link
Contributor Author

Can you say which version of Tk was in use
(it should be in the About IDLE display) and on what platform?

I am using ActiveTcl8.5.15.1 and a latest Python for Macs taken from the python.org download page. I'm running OS X 10.9.5.

@ned-deily
Copy link
Member

Thanks, Raymond. Upon further investigation, I think you are running into a user-wide behavior of OS X rather than specifically a Tk or IDLE issue. By tradition and by default, OS X tries to hide file extensions in file Open or Save dialogs; this dates back to the days of Classic Mac OS when there was no concept of file extensions. There is a (non-obvious) user preference in the OS X Finder's preferences (Finder -> Preferences -> Advanced -> Show all filename extensions) that appears to control whether extensions are displayed by default in standard Open and Save dialogs in all applications, not just the Finder. (This is with OS X 10.9.x; I believe recent earlier systems behave similarly although the details might be slightly different). When the preference is unchecked (the default), then in "Save As" dialogs (in IDLE and other apps) a "Hide Extension" option box appears in the lower-left corner of the "Save As" popup window and, if enabled, the extension is not displayed as part of the file name. Unchecking the "Hide Extension" box causes the extension to appear. If the Finder "Show all filename extensions" advanced preference is checked, then the "Hide Extension" box does not appear on the "Save As" popup and the extension is always displayed. I always have the "Show all filename extensions" preference checked so I forgot it was there and its effect on all file dialogs. My guess is that you will want to have it enabled as well and then you should always see extensions.

Note that for the initial "Save" of a file in IDLE (as opposed to a "Save As"), Python 3.4 supplies a default extension of ".py" which is displayed regardless of the Finder preference setting; but Python 2.7 up through the current 2.7.8 does not supply the default. That changes in 2.7.9 as Terry has recently backported the 3.x change to 2.7 (bpo-4832, although the commit message for the backport appears in bpo-3832 due to a typo).

@terryjreedy
Copy link
Member

(I moved the commit message)

I am assuming that Ned is correct. I think we should start documenting system peculiarities like this. I changed the title and will leave this open for this purpose.

@terryjreedy terryjreedy changed the title IDLE SaveAs drops the extension in the prompted filename IDLE: Document SaveAs extension display on Mac Oct 12, 2014
@SaimadhavHeblikar
Copy link
Mannequin

SaimadhavHeblikar mannequin commented Oct 12, 2014

>Saimadhav, can you quickly try Save As with x.py on Linux?

with files of type python: filename stored on disk -> x.py
with all files type : filename stored on disk -> x.py

@ned-deily
Copy link
Member

If Raymond concurs that either unchecking the Hide Extensions option or checking the Show All Filenmame Extensions preference solves the problem for him, we should just close this issue. In this particular case, the file is actually saved with a .py extension; it's just that the extension part is not displayed in the standard OS file dialogs. It is visible via, say, "ls" in a UNIX shell. This is standard OS X application behavior and caters to two different styles of file interaction. All OS X applications that use the standard file save dialogs work this way. See, for example, http://support.apple.com/kb/PH13920?viewlocale=en_US&locale=en_US.

@terryjreedy terryjreedy added the 3.7 (EOL) end of life label Jun 30, 2017
@terryjreedy terryjreedy self-assigned this Jun 30, 2017
@terryjreedy
Copy link
Member

I should have mentioned before, but forgot, that Windows, by default, hides file name extensions in File Explorer. (The 'type' column supposedly makes them redundant.) If they are hidden, they are also hidden in the Save As name box, as described for MacOS. So I think this is worth a sentence in the doc.

After 4 years, I want to close this with or without an edit (for this and/or bpo-4832). The current SaveAs entry is

Save the current window with a Save As dialog. The file saved becomes the
new associated file for the window.

(Ned has previously said leave this alone for both issues.) Proposal:

Save the contents of the current window with a Save As dialog. (If your file manager is set to hide extensions, the current extension will be omitted in the file name box.) If the new filename has no '.', '.py' and '.txt' will be added for Python and text files. (On MacOS Aqua, '.py' is added for any type.) The file saved becomes the new associated file for the window.

Opinions?

@taleinat
Copy link
Contributor

+1 for closing this either way, preferably with a note in the docs.

I'd add the notes about extensions in one set of parenthesis at the end, but that's likely just a matter of taste.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
terryjreedy added a commit to terryjreedy/cpython that referenced this issue Aug 5, 2022
File name extensions may or may not be shown for the current name
and are added in an OS-dependent manner if not given for the new
name.
@terryjreedy terryjreedy changed the title IDLE: Document SaveAs extension display on Mac IDLE: Document SaveAs dialog extension handling Aug 5, 2022
@terryjreedy
Copy link
Member

PR follows Tal's suggestion.

terryjreedy added a commit that referenced this issue Aug 5, 2022
File name extensions may or may not be shown for the current name
and are added in an OS-dependent manner if not given for the new
name.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Aug 5, 2022
File name extensions may or may not be shown for the current name
and are added in an OS-dependent manner if not given for the new
name.
(cherry picked from commit 9890f86)

Co-authored-by: Terry Jan Reedy <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Aug 5, 2022
File name extensions may or may not be shown for the current name
and are added in an OS-dependent manner if not given for the new
name.
(cherry picked from commit 9890f86)

Co-authored-by: Terry Jan Reedy <[email protected]>
miss-islington added a commit that referenced this issue Aug 5, 2022
File name extensions may or may not be shown for the current name
and are added in an OS-dependent manner if not given for the new
name.
(cherry picked from commit 9890f86)

Co-authored-by: Terry Jan Reedy <[email protected]>
ambv pushed a commit that referenced this issue Aug 5, 2022
File name extensions may or may not be shown for the current name
and are added in an OS-dependent manner if not given for the new
name.
(cherry picked from commit 9890f86)

Co-authored-by: Terry Jan Reedy <[email protected]>
@terryjreedy terryjreedy moved this to Done in IDLE Issues Aug 5, 2022
iritkatriel pushed a commit to iritkatriel/cpython that referenced this issue Aug 11, 2022
File name extensions may or may not be shown for the current name
and are added in an OS-dependent manner if not given for the new
name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.7 (EOL) end of life topic-IDLE type-bug An unexpected behavior, bug, or error
Projects
Status: Done
Development

No branches or pull requests

4 participants