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

Option for hide App menubar #733

Closed
2 of 14 tasks
UncleGoogle opened this issue Aug 26, 2019 · 5 comments
Closed
2 of 14 tasks

Option for hide App menubar #733

UncleGoogle opened this issue Aug 26, 2019 · 5 comments
Labels
enhancement New features, or improvements to existing features. not quite right The idea or PR has been reviewed, but more work is needed.

Comments

@UncleGoogle
Copy link
Contributor

Expected Behavior

Option to remove menubar. If workaround works for all systems, I can live with current implementation, if not IMO it is still a minor issue

Current Workaround

(tested on windows10 only)
Overwrite toga.App method

def _create_impl(self):
        factory_app = self.factory.App
        factory_app.create_menus = lambda _: None
        return factory_app(interface=self)

Your Environment

  • Python Version (list the specific version number)
    3.7.2

  • Operating System and Version (select from the following and list the specific version number; if your OS is not listed, list that as well)

Know about Windows but probably all systems have kind of menus.

  • macOS - version:
  • Linux - distro: - version:
  • Windows - version:
  • Other - name: - version:
  • Toga Version (list the specific version number or git hash)
    0.3.0.dev14

  • Toga Target (the type of app you are trying to generate)

    • android
    • cocoa
    • django
    • gtk
    • iOS
    • tvOS
    • watchOS
    • winforms
    • win32
    • Other (please specify)
@freakboy3742
Copy link
Member

Thanks for the suggestion! This is an interesting idea, but it has some complications.

In particular, in the macOS context, it's impossible for an application to not have a menu. At the very least, every application has an Application menu (with an About and Quit item). This is required by the macOS style guide. Part of the broader Toga "idea" is to build applications that appear native, and adhere to local platform style guides; any API design we come up with needs to ultimately be rendered as an application that still adheres to those style guides.

One thought is that we have a concept of a Toga "SimpleApp" - an application that has no special capabilities (like toolbars and menus); On Windows and Linux, that means no toolbar is created; on macOS, you get the minimal legal menu. Any attempt to define and add additional commands would raise an error (as the API endpoints won't exist).

An alternative approach would be to adapt to usage, and (on Windows/Linux) only create a menubar if the user manually adds commands. That is, if you don't add a command to your app, you don't get a menubar; as soon as you do, you get a menu (including the extra "default" menu items like Quit and Help). On macOS, you'll always have the menubar, so there's no real change.

Thoughts? Which of these makes more sense to you as an end user of the API? Or can you think of something else?

@freakboy3742 freakboy3742 added enhancement New features, or improvements to existing features. not quite right The idea or PR has been reviewed, but more work is needed. labels Aug 26, 2019
@UncleGoogle
Copy link
Contributor Author

UncleGoogle commented Aug 27, 2019 via email

@tritium21
Copy link

tritium21 commented Apr 28, 2020

A workaround that works on windows...currently...

import toga

class MainWindow(toga.App):
    def startup(self):
        self._impl.create_menus = lambda *x, **y: None
        # Rest of application setup....

MainWindow('Name', 'com.oracle.java.nameing').main_loop()

@underdoeg
Copy link

The above also works on linux (gtk)

@freakboy3742
Copy link
Member

Closing in favour of #1870 so that there's a clearer description of the feature request in a form that is likely to be merged.

@freakboy3742 freakboy3742 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 15, 2023
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. not quite right The idea or PR has been reviewed, but more work is needed.
Projects
None yet
Development

No branches or pull requests

4 participants