Esempio n. 1
0
    def gtk_startup(self, data=None):
        # Set up the default commands for the interface.
        self.interface.commands.add(
            Command(None,
                    'About ' + self.interface.name,
                    group=toga.Group.HELP),
            Command(None, 'Preferences', group=toga.Group.APP),
            # Quit should always be the last item, in a section on it's own
            Command(lambda widget: self.exit(),
                    'Quit ' + self.interface.name,
                    shortcut=toga.Key.MOD_1 + 'q',
                    group=toga.Group.APP,
                    section=sys.maxsize),
            Command(None, 'Visit homepage', group=toga.Group.HELP))
        self._create_app_commands()

        self.interface.startup()

        # Create the lookup table of menu items,
        # then force the creation of the menus.
        self._actions = {}
        self.create_menus()

        # Now that we have menus, make the app take responsibility for
        # showing the menubar.
        # This is required because of inconsistencies in how the Gnome
        # shell operates on different windowing environments;
        # see #872 for details.
        settings = Gtk.Settings.get_default()
        settings.set_property("gtk-shell-shows-menubar", False)
Esempio n. 2
0
    def startup(self, data=None):
        self.interface.commands.add(
            Command(None, 'About ' + self.interface.name,
                    group=toga.Group.APP),
            Command(None, 'Preferences', group=toga.Group.APP),
            # Quit should always be the last item, in a section on it's own
            Command(lambda s: self.exit(),
                    'Quit ' + self.interface.name,
                    shortcut='q',
                    group=toga.Group.APP,
                    section=sys.maxsize),
            Command(None, 'Visit homepage', group=toga.Group.HELP))

        self.interface.startup()

        # Create the lookup table of menu items,
        # then force the creation of the menus.
        self._actions = {}
        self.create_menus()
Esempio n. 3
0
File: app.py Progetto: obulat/toga
    def gtk_startup(self, data=None):
        # Set up the default commands for the interface.
        self.interface.commands.add(
            Command(lambda _: self.interface.about(),
                    'About ' + self.interface.name,
                    group=toga.Group.HELP),
            Command(None, 'Preferences', group=toga.Group.APP),
            # Quit should always be the last item, in a section on it's own
            Command(lambda _: self.interface.exit(),
                    'Quit ' + self.interface.name,
                    shortcut=toga.Key.MOD_1 + 'q',
                    group=toga.Group.APP,
                    section=sys.maxsize),
        )
        self._create_app_commands()

        self.interface.startup()

        # Create the lookup table of menu items,
        # then force the creation of the menus.
        self.create_menus()

        # Now that we have menus, make the app take responsibility for
        # showing the menubar.
        # This is required because of inconsistencies in how the Gnome
        # shell operates on different windowing environments;
        # see #872 for details.
        settings = Gtk.Settings.get_default()
        settings.set_property("gtk-shell-shows-menubar", False)

        # Set any custom styles
        css_provider = Gtk.CssProvider()
        css_provider.load_from_data(TOGA_DEFAULT_STYLES)

        context = Gtk.StyleContext()
        context.add_provider_for_screen(Gdk.Screen.get_default(), css_provider,
                                        Gtk.STYLE_PROVIDER_PRIORITY_USER)