-
-
Notifications
You must be signed in to change notification settings - Fork 685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for user-defined New, Save, Save As and Save All commands #2688
Closed
Conversation
This file contains 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
9 tasks
4 tasks
mhsmith
reviewed
Jul 12, 2024
suggested_path = ( | ||
self.doc.path | ||
if self.doc.path | ||
else f"Untitled{self.doc.default_extension}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't there be a dot before the extension? And there should be a test for this.
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.
Builds on #2666; that PR should be reviewed and merged before this one.
This is the last of the PRs derived from #2244. It adds the rest of the APIs needed by a real Document-based app: New, Save, Save As, and Save All.
There are app-level entry points for these commands that can be overridden to activate the corresponding menu items; or, they will all be installed if there is at least one document type registered.
The save commands all trigger file dialogs to pick filenames (and check for overwriting existing files) as required.
On GTK/Windows, the
new
document handling is used to generate an empty document when there are no command line arguments.One area for future improvement - the save/save as menu items are always active, but only save the current window. Making the menu items enabled/disabled depends on having either gain/lost focus events for windows (#2009), and/or window-based menus (#2210). In the meantime, if the current window defines a
save()
/save_as()
method, that method will be invoked; if the current window doesn't define those methods, the save request will be ignored.PR Checklist: