36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
# Copyright 2022 (c) Anna Schumaker.
|
|
"""Set up our Application."""
|
|
from . import gsetup
|
|
from . import options
|
|
from gi.repository import GLib
|
|
from gi.repository import Adw
|
|
|
|
MAJOR_VERSION = 3
|
|
MINOR_VERSION = 0
|
|
VERSION_STRING = f"Emmental {MAJOR_VERSION}.{MINOR_VERSION}{gsetup.DEBUG_STR}"
|
|
|
|
|
|
class Application(Adw.Application):
|
|
"""Our custom Adw.Application."""
|
|
|
|
def __init__(self):
|
|
"""Initialize an Application."""
|
|
super().__init__(application_id=gsetup.APPLICATION_ID)
|
|
self.add_main_option_entries([options.Version])
|
|
|
|
def do_handle_local_options(self, opts: GLib.VariantDict) -> int:
|
|
"""Handle any command line options."""
|
|
if opts.contains("version"):
|
|
print(VERSION_STRING)
|
|
gsetup.print_versions()
|
|
return 0
|
|
return -1
|
|
|
|
def do_startup(self) -> None:
|
|
"""Handle the Adw.Application::startup signal."""
|
|
Adw.Application.do_startup(self)
|
|
|
|
def do_activate(self) -> None:
|
|
"""Handle the Adw.Application::activate signal."""
|
|
Adw.Application.do_activate(self)
|