Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Save as forces ".py" extension #1

@xbecas

Description

@xbecas

What were you trying to do?

Save file with custom extension, other than ".py"

What steps did you take to trigger the issue?

Double click on file tab to perform a "save file as".

What did you expect to happen?

Save file with custom extension, other than ".py"

What actually happened?

Mu forces ".py" extension on the file, even if file pattern/filter is "Others (.)"

Operating System Version

macOS 12.6.2

Mu Version

1.2.1

Other Info

Follow

There are several snippets in both main.py and logic.py related to managing save filenames and managing/forcing extensions.

main.py : Windows.get_save_path():

# The file is not a . (dot) file and there's no extension, so add
# .py as default.
path += ".py"

logic.py: Editor.rename_tab():

if not self.has_python_extension(os.path.basename(new_path)):
    # No extension given, default to .
    new_path += ".pyl"

logic.py: Editor --> python_extensions defined in several places

self.python_extensions = [".py", ".pyw"]

and

pyextensions = [".pyw", ".PYW", ".py", ".PY"]

and

for mode_name, mode in self.modes.items():
    if mode.file_extensions:
    extensions += mode.file_extensions

Editor Log

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions