-
-
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
Allow the use of toga.Window as the main window #2649
Conversation
On macOS, which is the platform where this makes the greatest difference, doesn't this remove commands which are needed for basic functionality like window management (Hide, Minimize, etc.), and text editing (Cut, Paste, etc.)? More generally, it looks to me like the existing set of commands is already minimalist enough, so introducing these two variants seems to add a lot of complexity for no clear benefit. Also, the |
My original thinking was that a minimal app should be truly as minimal as possible - but you make a good point about Hide, Minimise, Cut, Paste et al. Looking over the list, the only ones that could be considered completely optional are Preferences and Visit Homepage. Visit homepage should arguably exist by default, as the Apple HIG suggests apps should always provide help; "visit homepage" isn't the best manifestation of help, but we need something to provide the default help menu that has the "search" option to find menu items. We will still need the "minimal vs standard" API for other platforms, because we don't want to create command instances that literally won't (or can't) be used. I think we can roll this into the description of MainWindow - pointing out that if the platform uses app-level menus, using a MainWindow as the main window may add extra menu items. That then means we can hide the "preferences" item from bare bones apps, and provides a lead in for the introduction of DocumentMainWindow, which will introduce document management commands (new, open, save etc).
Agreed - this is a distinction that matters for internal reasons, but doesn't really matter from the perspective of the external API surface. I've simplified the docs to reflect this. |
Even if a platform shows no menu bar with a base class
This still seems like a needless coupling between the app and the initial
I think all the goals of this change can be achieved in other, more flexible ways:
|
As discussed in person:
|
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.
I've modified the "Preferences" menu item to only be installed if the user overrides the
preferences()
method.
This should be documented at App.preferences
and Command.PREFERENCES
.
It should also be mentioned in the existing 90.feature.rst change note, which should probably be renamed to removal
, because if anyone was using the command before, it will disappear until they implement App.preferences
.
Builds on #2646; that PR should be reviewed and merged before reviewing this one.
Derived from #2244.
Adds the ability to use
toga.Window
as the main window of an app. Astoga.Window
cannot have a toolbar, this is a good indicator that the user wants a minimalist "Simple" app, so the set of menu commands that are installed is also reduced. A SimpleApp example has been added to demonstrate this capability.We need to know the type of the main window before we create the app commands; this means the app commands must be created after
startup()
has been invoked. However, app commands are currently created before startup so that thestartup()
method can customise the default commands.To allow for customisation,
create_app_commands()
has been promoted to a public interface method so that users can overridecreate_app_commands()
in their apps; but this method is invoke afterstartup()
so that it has sufficient context to create the right set of default commands.Fixes #1870.
PR Checklist: