Ejemplo n.º 1
0
 def app_startup(app):
     try:
         Application.init()
         apply_application_actions(Application, app)
     except Exception:
         app.quit()
         raise
Ejemplo n.º 2
0
 def app_startup(gtk_app):
     nonlocal application
     try:
         application = Application()
         apply_application_actions(application, gtk_app)
     except Exception:
         gtk_app.quit()
         raise
Ejemplo n.º 3
0
def test_application_actions(component_registry):
    action_group = apply_application_actions(
        component_registry, Gio.SimpleActionGroup.new()
    )

    assert not action_group.lookup_action("new")
    assert action_group.lookup_action("quit")
Ejemplo n.º 4
0
def test_activate_application_action(component_registry, dummy_action_provider):

    action_group = apply_application_actions(
        component_registry, Gio.SimpleActionGroup.new()
    )
    action_group.lookup_action("quit").activate(None)

    assert dummy_action_provider.quit_called
Ejemplo n.º 5
0
    def app_startup(gtk_app):
        nonlocal application

        @event_handler(SessionCreated)
        def on_session_created(event):
            main_window = event.session.get_service("main_window")
            main_window.open(gtk_app)

        @event_handler(ApplicationShutdown)
        def on_quit(event):
            gtk_app.quit()

        try:
            application = Application()
            apply_application_actions(application, gtk_app)
            if macos_init:
                macos_init(application)
            event_manager = application.get_service("event_manager")
            event_manager.subscribe(on_session_created)
            event_manager.subscribe(on_quit)
        except Exception:
            gtk_app.quit()
            raise
Ejemplo n.º 6
0
    def app_startup(app):
        application.init()

        component_registry = application.get_service("component_registry")
        apply_application_actions(component_registry, app)