Skip to content
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

Window center position, Remove and Customize Menu #2030

Closed
milen-prg opened this issue Jul 12, 2023 · 5 comments
Closed

Window center position, Remove and Customize Menu #2030

milen-prg opened this issue Jul 12, 2023 · 5 comments
Labels
enhancement New features, or improvements to existing features.

Comments

@milen-prg
Copy link

What is the problem or limitation you are having?

  • I did not find option to center the Main Window on the Desktop, even where to read the Desktop size to calculate manually the window position.

  • I did not find option to remove the Main Window default Menus and how to customize it.

(I find this magick trick #733:
self._impl.create_menus = lambda *x, **y: None # remove menus
but it is not in documentation, there are even more black magick with factory... And this not allows menu customization).

Describe the solution you'd like

Add Desktop size property.
Add menu menu widgets settings.

Describe alternatives you've considered

Other GUI packages?

Additional context

No response

@milen-prg milen-prg added the enhancement New features, or improvements to existing features. label Jul 12, 2023
@freakboy3742
Copy link
Member

There isn't currently any API to "centre" a window on a desktop. You can set the position of a window, but there's no cross-platform way to get the size of the screen. There has been some discussion on #1884 (and a preliminary PR #1930) that has been working on this as a feature.

It's also worth noting that on some platforms, centering like this is impossible. iOS/Android don't have any concept of window positioning; and GTK considers window position the realm of the desktop manager. GTK4 goes as a far as removing all the "set position" APIs from it's Window class. And, as a user, my experience has been that apps that have Opinions about where they are positioned on the screen are almost universally wrong. In general, I'd strongly advise against trying to enforce a window position on the screen.

As for removing the menu from the main window - this is by design; a Toga app is intended to be a fully HIG compliant desktop app, and on most platforms, having a "File/Quit" and "Help/About" menus is a bare minimum requirement. On macOS, removing the menubar isn't an option at all - menus are required by the HIG specification.

However, one idea that has been suggested is a "SimpleApp" - an app that doesn't provide any of the "extras" that a fully HIG compliant app would provide. This would be the menubar on a Windows app; or the in-app titlebar on iOS and Android; on macOS it would be the barest allowed app menu, with no allowance for additional menus being added. #1870 is tracking this feature request.

I'm going to close this ticket on the basis that the two ideas that have been raised are pre-existing.

For future reference, it's also preferable to raise "one idea per ticket". If you have 2 suggestions for 2 new APIs or features, open 2 tickets. Or, if you're not sure, open a discussion, rather than a ticket. Tickets are designed to be atomic; a PR can close a ticket. If a ticket describes 2 features, it's impossible to know which of the two features is implemented by the PR.

@freakboy3742 freakboy3742 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 12, 2023
@golemme
Copy link

golemme commented Dec 19, 2023

Why force everyone to have a menu in the the main window but provide no way to modify or use that menu? How do I make the Preferences option under the File menu functional? How do I add additional options to the File menu? Under the Help menu, how do I change the wording of "Visit homepage" to something else, or remove it completely? How do I add other options to the Help menu? Why isn't any of this covered in the documentation?

@freakboy3742
Copy link
Member

Toga's version number is 0.4. In most cases, the answer to "Why isn't this possible" or "why isn't this documented" is "we haven't implemented it yet".

Removing the menu bar entirely has been the raised many times in the past; a cursory search of the ticket tracker (including, but not limited to, reading this thread) will lead you to #1870, and the proposed fix #2244. So - this is on our radar, and will likely be addressed in the not-too-distant future.

As for customizing the default menu items - the default menu items are defaults for a reason - they're the menu items that a "well behaved" app on a given platform must have. "Preferences" is currently disabled because there isn't an implementation for that feature - we're flagging our intention to add a generic preferences management infrastructure (and, again, a cursory search will reveal #90).

The wording of menu items like "Visit homepage" isn't customizable - and that's by design. The goal of Toga is that will adhere to platform design guidelines with no effort from the developer. Including a link to the project is a widely followed convention on many projects; Toga has access to the homepage by way of project metadata; so we're in a position to auto-populate that menu item. If you've got suggestions for a better way to frame that feature, we're open to specific suggestions - but "allow everything to be customised" isn't a great suggestion, because at some level, arbitrary customisation isn't a goal of Toga.

However, adding new items to the File/Help menu is covered in the docs: see the documentation for Command, which is the API you'll use to add new menu items. It's also covered in Tutorial 2. Is this documentation perfect? No. Once again, see the comment about the version number. If you'd like to contribute improvements, feel free to do so.

@golemme
Copy link

golemme commented Dec 20, 2023

I'm sorry, but everything you just wrote is complete nonsense.

It is not true that "a 'well behaved' app on a given platform must have" your default menu with File and Help. The overwhelming majority of apps on all platforms have no such thing. The Windows guidelines for application development certainly contains no such requirement. The four example apps that Microsoft uses to illustrate good design practices are RSSReader, Lunch Scheduler, Customers Orders Database, and WinUI 3 Gallery -- none of which have anything resembling your default menu.

It is impossible to have a useful generic implementation of Preference, since that function is, by definition, application-specific. The developer knows what type of navigation system his app and his end users require -- you have no idea. Likewise, the developer knows what sort of preferences and customization his app should offer -- you have no idea.

Although it's possible to add additional commands to the default menu, there is no way to remove the permanently disabled Preferences command or the File and Help menus. You needlessly force everyone to include a broken link in their menu. That is simply indefensible.

There is no platform design guideline which requires a "Visit homepage" link in every app -- because such a requirement would be insane. You say that "arbitrary customisation isn't a goal of Toga" -- that makes you a psychopath and control-freak, not a good software developer.

I could easily correct these problems in one day -- as you could have done years ago -- but then I would have to interact with you some more, which I have no intention of doing.

Thankfully, the people running kivy and kivymd do not share your derangement. I will immediately begin porting my application to kivymd and not take up any more of your time.

@mhsmith
Copy link
Member

mhsmith commented Jan 10, 2024

You're unlikely to get good results from any project if you insult the developers.

But I agree we should remove the Preferences menu item for now. We're not planning to implement it in the near future, and including it as disabled will just cause developers to waste their time searching for how to enable a feature that doesn't exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features, or improvements to existing features.
Projects
None yet
Development

No branches or pull requests

4 participants