All checks were successful
buildbot/nix-build .#checks.x86_64-linux.clan-dep-bash Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-dep-fakeroot Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-app-no-breakpoints Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-dep-e2fsprogs Build done.
buildbot/nix-build .#checks.x86_64-linux.check-for-breakpoints Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-dep-age Build done.
buildbot/nix-build .#checks.aarch64-darwin.nixos-test_install_machine Build done.
buildbot/nix-build .#checks.x86_64-linux.devShell-webview-ui Build done.
buildbot/nix-build .#checks.x86_64-linux.borgbackup Build done.
buildbot/nix-build .#checks.x86_64-linux.package-clan-cli Build done.
buildbot/nix-build .#checks.x86_64-linux.package-default Build done.
buildbot/nix-build .#checks.x86_64-linux.package-clan-ts-api Build done.
buildbot/nix-build .#checks.x86_64-linux.package-clan-cli-docs Build done.
buildbot/nix-build .#checks.aarch64-darwin.nixos-flash-installer Build done.
buildbot/nix-build .#checks.x86_64-linux.devShell-docs Build done.
buildbot/nix-build .#checks.x86_64-linux.package-gui-installer-apk Build done.
buildbot/nix-build .#checks.x86_64-linux.package-gui-installer-deb Build done.
buildbot/nix-build .#checks.x86_64-linux.package-gui-installer-archlinux Build done.
buildbot/nix-build .#checks.aarch64-darwin.nixos-iso-installer Build done.
buildbot/nix-build .#checks.x86_64-linux.package-gui-installer-rpm Build done.
buildbot/nix-build .#checks.x86_64-linux.package-module-docs Build done.
buildbot/nix-build .#checks.aarch64-linux.nixos-test_install_machine Build done.
buildbot/nix-build .#checks.aarch64-linux.nixos-flash-installer Build done.
buildbot/nix-build .#checks.aarch64-linux.nixos-iso-installer Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-app-pytest Build done.
buildbot/nix-build .#checks.x86_64-linux.nixos-test-backup Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-dep-nix Build done.
buildbot/nix-build .#checks.aarch64-darwin.nixos-test-backup Build done.
buildbot/nix-build .#checks.x86_64-linux.renderClanOptions Build done.
buildbot/nix-build .#checks.x86_64-linux."clan-dep-python3.11-mypy" Build done.
buildbot/nix-build .#checks.x86_64-linux."clan-dep-python3.11-qemu" Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-dep-rsync Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-dep-sops Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-dep-sshpass Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-dep-tor Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-dep-git Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-dep-openssh Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-dep-zbar Build done.
buildbot/nix-build .#checks.x86_64-linux.devShell-clan-cli Build done.
buildbot/nix-build .#checks.x86_64-linux.lib-jsonschema-example-valid Build done.
buildbot/nix-build .#checks.x86_64-linux.container Build done.
buildbot/nix-build .#checks.x86_64-linux.devShell-default Build done.
buildbot/nix-build .#checks.x86_64-linux.deltachat Build done.
buildbot/nix-build .#checks.x86_64-linux.matrix-synapse Build done.
buildbot/nix-build .#checks.x86_64-linux.module-schema Build done.
buildbot/nix-build .#checks.x86_64-linux.package-editor Build done.
buildbot/nix-build .#checks.x86_64-linux.nixos-test_install_machine Build done.
buildbot/nix-build .#checks.aarch64-linux.nixos-test-backup Build done.
buildbot/nix-build .#checks.x86_64-linux.package-impure-checks Build done.
buildbot/nix-build .#checks.x86_64-linux.package-merge-after-ci Build done.
buildbot/nix-build .#checks.x86_64-linux.package-moonlight-sunshine-accept Build done.
buildbot/nix-build .#checks.x86_64-linux.package-pending-reviews Build done.
buildbot/nix-build .#checks.x86_64-linux.treefmt Build done.
buildbot/nix-build .#checks.x86_64-linux.package-tea-create-pr Build done.
buildbot/nix-build .#checks.x86_64-linux.package-zerotier-members Build done.
buildbot/nix-build .#checks.x86_64-linux.package-zt-tcp-relay Build done.
buildbot/nix-build .#checks.x86_64-linux.lib-jsonschema-nix-unit-tests Build done.
buildbot/nix-build .#checks.x86_64-linux.package-zerotierone Build done.
buildbot/nix-build .#checks.x86_64-linux.nixos-flash-installer Build done.
buildbot/nix-build .#checks.x86_64-linux.secrets Build done.
buildbot/nix-build .#checks.x86_64-linux.package-module-schema Build done.
buildbot/nix-build .#checks.x86_64-linux.package-deploy-docs Build done.
buildbot/nix-build .#checks.x86_64-linux.nixos-iso-installer Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-pytest-with-core Build done.
buildbot/nix-build .#checks.x86_64-linux.package-function-schema Build done.
buildbot/nix-build .#checks.x86_64-linux.zt-tcp-relay Build done.
buildbot/nix-build .#checks.x86_64-linux.wayland-proxy-virtwl Build done.
buildbot/nix-build .#checks.x86_64-linux.package-iso-installer Build done.
buildbot/nix-build .#checks.x86_64-linux.syncthing Build done.
buildbot/nix-build .#checks.x86_64-linux.package-webview-ui Build done.
buildbot/nix-build .#checks.x86_64-linux.devShell-clan-app Build done.
buildbot/nix-build .#checks.x86_64-linux.package-docs Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-pytest-without-core Build done.
buildbot/nix-build .#checks.x86_64-linux.package-clan-app Build done.
buildbot/nix-build .#checks.x86_64-linux.package-gui-install-test-ubuntu-22-04 Build done.
buildbot/nix-build .#checks.x86_64-linux.test-backups Build done.
buildbot/nix-build .#checks.x86_64-linux.flash Build done.
buildbot/nix-build .#checks.x86_64-linux.test-installation Build done.
buildbot/nix-eval Build done.
checks / checks-impure (pull_request) Successful in 2m3s
86 lines
2.6 KiB
Python
86 lines
2.6 KiB
Python
import logging
|
|
import threading
|
|
|
|
import gi
|
|
from clan_cli.api import API
|
|
from clan_cli.history.list import list_history
|
|
|
|
from clan_app.components.interfaces import ClanConfig
|
|
from clan_app.singletons.toast import ToastOverlay
|
|
from clan_app.singletons.use_views import ViewStack
|
|
from clan_app.singletons.use_vms import ClanStore
|
|
from clan_app.views.details import Details
|
|
from clan_app.views.list import ClanList
|
|
from clan_app.views.logs import Logs
|
|
from clan_app.views.webview import WebView, open_file
|
|
|
|
gi.require_version("Adw", "1")
|
|
|
|
from gi.repository import Adw, Gio, GLib
|
|
|
|
from clan_app.components.trayicon import TrayIcon
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
class MainWindow(Adw.ApplicationWindow):
|
|
def __init__(self, config: ClanConfig) -> None:
|
|
super().__init__()
|
|
self.set_title("Clan Manager")
|
|
self.set_default_size(980, 850)
|
|
|
|
# Overlay for GTK side exclusive toasts
|
|
overlay = ToastOverlay.use().overlay
|
|
view = Adw.ToolbarView()
|
|
overlay.set_child(view)
|
|
|
|
self.set_content(overlay)
|
|
|
|
header = Adw.HeaderBar()
|
|
view.add_top_bar(header)
|
|
|
|
app = Gio.Application.get_default()
|
|
assert app is not None
|
|
self.tray_icon: TrayIcon = TrayIcon(app)
|
|
|
|
# Initialize all ClanStore
|
|
threading.Thread(target=self._populate_vms).start()
|
|
|
|
stack_view = ViewStack.use().view
|
|
stack_view.add_named(ClanList(config), "list")
|
|
stack_view.add_named(Details(), "details")
|
|
stack_view.add_named(Logs(), "logs")
|
|
|
|
# Override platform specific functions
|
|
API.register(open_file)
|
|
|
|
webview = WebView(methods=API._registry)
|
|
|
|
stack_view.add_named(webview.get_webview(), "webview")
|
|
stack_view.set_visible_child_name(config.initial_view)
|
|
|
|
view.set_content(stack_view)
|
|
|
|
self.connect("destroy", self.on_destroy)
|
|
|
|
def _set_clan_store_ready(self) -> bool:
|
|
ClanStore.use().emit("is_ready")
|
|
return GLib.SOURCE_REMOVE
|
|
|
|
def _populate_vms(self) -> None:
|
|
# Execute `clan flakes add <path>` to democlan for this to work
|
|
# TODO: Make list_history a generator function
|
|
for entry in list_history():
|
|
GLib.idle_add(ClanStore.use().create_vm_task, entry)
|
|
|
|
GLib.idle_add(self._set_clan_store_ready)
|
|
|
|
def kill_vms(self) -> None:
|
|
log.debug("Killing all VMs")
|
|
ClanStore.use().kill_all()
|
|
|
|
def on_destroy(self, source: "Adw.ApplicationWindow") -> None:
|
|
log.info("====Destroying Adw.ApplicationWindow===")
|
|
ClanStore.use().kill_all()
|
|
self.tray_icon.destroy()
|