Closes #107 - Display loaded .pmr file somewhere#141
Open
Mineeagle wants to merge 4 commits into
Open
Conversation
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. |
Owner
|
closes #107 |
LOUDO56
requested changes
Jun 14, 2026
| if self.current_file != None: | ||
| file_name = self.current_file | ||
| else: | ||
| file_name = self.text_content.get("global",{}).get("untitled_file_name","Untitled.pmr") |
Owner
There was a problem hiding this comment.
"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 |
Owner
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
MainAppreceived 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
saveandsave_asmethod in classRecordFileManagement. As either redirect to thesavemethod, I only adapted thesavemethod, 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:
Here it has been saved:
And here, a new macro has been recorded, making the file unsaved again:
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.