Skip to content

Add Rename to the Python Editor tab context menu - #670

Closed
horhulenko wants to merge 1 commit into
emsec:masterfrom
horhulenko:feature/python-editor-rename
Closed

horhulenko wants to merge 1 commit into
emsec:masterfrom
horhulenko:feature/python-editor-rename

Conversation

@horhulenko

Copy link
Copy Markdown
Contributor

Resolves #666

Added a Rename button to the context menu of the Python editor tab.

Regarding the potential issues mentioned in #666:

  • File already exists: QFile::rename will not allow an existing file to be overwritten, and the user receives a notification about this in a modal window.
  • Case sensitivity: I tested this on an ext4 filesystem and on a Windows drive mounted in WSL, which is case-insensitive. Renaming the file a.py to B.py while the file b.py already exists fails on the mounted case-insensitive volume but succeeds on ext4, where they are indeed two different files. Renaming where only the case of the name changes (with no name collisions) works in both cases. In neither of these cases was a file that the user did not attempt to rename overwritten. Qt already handles this on a per-platform basis, so no reimplementation is required here.
  • Only a plain filename is accepted, so the dialog cannot be used to move the script to a different directory.
  • The existing snapshot is deleted, so the restored autosaved version cannot appear under the old name.

The whole change is 70 lines including the changelog entry and the doc comments. I don't think that is a lot of code to weigh against a rename that currently takes five steps through two Save as dialogs, with a delete on the wrong file one misclick away.

HAL already decides where these scripts live, creates them, writes them, watches them for external changes and moves them around when you use Save as. Renaming one is not reimplementing the file manager, it is the one operation on that list that is missing.

If there are edge cases I have not covered, I would rather hear which ones and fix them than see the feature dropped over an effort estimate. Happy to extend the tests or the error handling if you name the cases you are worried about.

image

@joern274 joern274 added the wontfix The issue will not be fixed or otherwise handled. When applied, the issue should be closed. label Oct 26, 2026
@joern274 joern274 closed this Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wontfix The issue will not be fixed or otherwise handled. When applied, the issue should be closed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python Editor: add "Rename" to the tab context menu

2 participants