Skip to content

Closes #107 - Display loaded .pmr file somewhere#141

Open
Mineeagle wants to merge 4 commits into
LOUDO56:mainfrom
Mineeagle:display-pmr-file-name
Open

Closes #107 - Display loaded .pmr file somewhere#141
Mineeagle wants to merge 4 commits into
LOUDO56:mainfrom
Mineeagle:display-pmr-file-name

Conversation

@Mineeagle

@Mineeagle Mineeagle commented Jun 2, 2026

Copy link
Copy Markdown

Recently, I saw this issue sitting in the repository and had to agree. It'd be pretty handy to view the name of the currently opened file.

So I looked a little bit into the coding, and added it to the best of my understanding:

The main window class MainApp received a new method (update_title), which sets the title of the window, to the currently loaded file (self.current_file), indicating a star if the file is unsaved (self.macro_saved).
This class is called everywhere, where either variable is changed, to adapt the title of the main app window.
The only exception are the save and save_as method in class RecordFileManagement. As either redirect to the save method, I only adapted the save method, right after the macro contents has been written into the current file.

Last, I also added a new translation option ("content" -> "global" -> "untitled_file_name"), which stores the name of untitled files, and also provided the translations for English, German and Esperanto.
If this translation is not maintained, "Untitled.pmr" will be used as a default, so no language version breaks.

Here we have the unsaved and untitled file; so right after opening PyMacroRecord:

bildo

Here it has been saved:

bildo

And here, a new macro has been recorded, making the file unsaved again:

bildo

Of course, saving now makes the star disappear, indicating that the file has been properly saved.

I hope this approach is fine or at least may serve as some kind of reference.

@Mineeagle

Copy link
Copy Markdown
Author

Just as a note: during the first commit, I accidentally committed changes to the initial size of the main window, as it was a little bit difficult for me to see the full file path. This change has been reversed by the commit Reset window size.

@LOUDO56

LOUDO56 commented Jun 14, 2026

Copy link
Copy Markdown
Owner

closes #107

if self.current_file != None:
file_name = self.current_file
else:
file_name = self.text_content.get("global",{}).get("untitled_file_name","Untitled.pmr")

@LOUDO56 LOUDO56 Jun 14, 2026

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

"Untilted" should have a translation key

is_saved = self.macro_saved if is_saved == None else is_saved

if self.current_file != None:
file_name = self.current_file

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I'm not a big fan of displaying the absolute path, just the file name is better, because a pmr file can be placed in a long path and we can't see the name

e.g. /home/user/macros/test.pmr should only give test.pmr

@LOUDO56 LOUDO56 linked an issue Jun 17, 2026 that may be closed by this pull request
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.

Display loaded .pmr file somewhere

2 participants