new: dev: initialize the GTK client #11
This commit is contained in:
47
gtk-client/main.py
Normal file
47
gtk-client/main.py
Normal file
@@ -0,0 +1,47 @@
|
||||
"""
|
||||
This file is part of the SplendidBear Websites' projects.
|
||||
|
||||
Copyright (c) 2026 @ www.splendidbear.org
|
||||
|
||||
For the full copyright and license information, please view the LICENSE
|
||||
file that was distributed with this source code.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import logging
|
||||
|
||||
import gi
|
||||
gi.require_version("Gtk", "4.0")
|
||||
gi.require_version("Adw", "1")
|
||||
gi.require_version("Gst", "1.0")
|
||||
from gi.repository import Gtk, Adw, Gst, GLib
|
||||
|
||||
# Validate config early (raises EnvironmentError if .env is missing)
|
||||
from mineseeker import config # noqa: F401
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
|
||||
)
|
||||
|
||||
|
||||
class MineSeekerApp(Adw.Application):
|
||||
def __init__(self) -> None:
|
||||
super().__init__(application_id="org.splendidbear.mineseeker")
|
||||
self.connect("activate", self._on_activate)
|
||||
|
||||
def _on_activate(self, app: Adw.Application) -> None:
|
||||
# Import here so GTK/Adw is already initialised before building widgets
|
||||
from mineseeker.ui.app_window import AppWindow
|
||||
window = AppWindow(application=app)
|
||||
window.present()
|
||||
|
||||
|
||||
def main() -> int:
|
||||
Gst.init(None)
|
||||
app = MineSeekerApp()
|
||||
return app.run(sys.argv)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user