Issue 9222: IDLE: Fix open/saveas 'Files of type' choices (original) (raw)

Created on 2010-07-11 00:44 by terry.reedy, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (11)

msg109951 - (view)

Author: Terry J. Reedy (terry.reedy) * (Python committer)

Date: 2010-07-11 00:44

In the open and save-as dialog boxes, the choices for the 'Files of type' field are governed by the filetypes list in Lib\idlelib\IOBinding.py, about line 225 (found by a friend).

filetypes = [
    ("Python and text files", "*.py *.pyw *.txt", "TEXT"),
    ("All text files", "*", "TEXT"),
    ("All files", "*"),
    ]

I see multiple problems with this:

  1. The first line, which for me is the default, mixes Python and text files, while one nearly only wants to only search through Python files. I propose to remove 'and text' and '*.txt'.

  2. The second line, which would currently be redundant with the first if it did what it said (but would not be with the first fix), has a bug in the file spec, '' instead of '.txt', that makes it redundant with the third line. I propose to fix that bug.

The following is copied from my patched and tested version of the file:

filetypes = [
    ("Python files", "*.py *.pyw", "TEXT"),
    ("Text files", "*.txt", "TEXT"),
    ("All files", "*"),
    ]

So this is a trivial 2 line patch.

msg110032 - (view)

Author: Marco Donato Torsello (md1512)

Date: 2010-07-11 17:42

My fix for IDLE of Python3.1 .

This is the first time for me, so I didn't know what i have to do , sorry

msg110057 - (view)

Author: Terry J. Reedy (terry.reedy) * (Python committer)

Date: 2010-07-11 23:58

The upload still needed is a .diff patch file. This is most easily done with a VCS, in particular svn or possibly hg. I have asked someone with the proper setup to make one.

msg110120 - (view)

Author: Eli Bendersky (eli.bendersky) * (Python committer)

Date: 2010-07-12 18:17

Attaching a patch file for Lib/idlelib/IOBinding.py, diffed against the latest SVN trunk.

msg110494 - (view)

Author: Terry J. Reedy (terry.reedy) * (Python committer)

Date: 2010-07-16 20:58

gp, do you see any reason not to commit this? If not, could you do so?

msg110507 - (view)

Author: Guilherme Polo (gpolo) * (Python committer)

Date: 2010-07-16 21:44

I remember about another issue regarding extensions and save-as/open dialog boxes. Let me try to find it, just to be sure that the problem described here is different.

msg110514 - (view)

Author: Guilherme Polo (gpolo) * (Python committer)

Date: 2010-07-16 22:10

I was thinking of . The patch provided here seems fine to me, although the behavior remains the same in Mac.

msg110909 - (view)

Author: Tal Einat (taleinat) * (Python committer)

Date: 2010-07-20 15:20

On Windows, I can't think of any common reason to want to save a file edited in IDLE without the .py extension. On the other hand, accidentally forgetting the .py extension is annoying, and users have come to expect a default extension being added by applications (e.g. MS Office).

Guilherme's patch (applied manually) works fine here on Windows7. I'm all for committing this if it has been tested to work as expected on Linux and OSX.

(minor nit-pick: could use sys.platform.startswith('win') instead of slicing)

msg110942 - (view)

Author: Terry J. Reedy (terry.reedy) * (Python committer)

Date: 2010-07-20 18:21

Tal, I agree with your comment, but I believe it applies to #4832 and should be moved there. The patch here fixes (and only fixes) an obvious bug in the filetypes list.

msg110961 - (view)

Author: Tal Einat (taleinat) * (Python committer)

Date: 2010-07-20 20:12

You're right Terry, my bad, I got the issues mixed up.

msg122194 - (view)

Author: Terry J. Reedy (terry.reedy) * (Python committer)

Date: 2010-11-23 06:49

3.2, 3.1, 2.7: r86702, r86703, r86704

History

Date

User

Action

Args

2022-04-11 14:57:03

admin

set

github: 53468

2010-11-23 06:49:14

terry.reedy

set

status: open -> closed
resolution: fixed
messages: +

stage: commit review -> resolved

2010-07-20 20:12:44

taleinat

set

messages: +

2010-07-20 18:21:28

terry.reedy

set

messages: +

2010-07-20 15:20:29

taleinat

set

nosy: + taleinat
messages: +

2010-07-16 22:10:54

gpolo

set

messages: +

2010-07-16 21:44:48

gpolo

set

messages: +

2010-07-16 20:58:18

terry.reedy

set

nosy: + gpolo
messages: +

2010-07-13 03:32:12

terry.reedy

set

nosy: + kbk

2010-07-12 19:55:08

terry.reedy

set

stage: commit review

2010-07-12 18:17:55

eli.bendersky

set

files: + issue9122.1.patch

nosy: + eli.bendersky
messages: +

keywords: + patch

2010-07-11 23:58:15

terry.reedy

set

messages: +

2010-07-11 17:42:41

md1512

set

files: + IOBinding.py
nosy: + md1512
messages: +

2010-07-11 00:44:09

terry.reedy

create