clan_manager: Implemented machine_icon, machine_description
All checks were successful
checks-impure / test (pull_request) Successful in 1m39s
checks / test (pull_request) Successful in 2m41s

This commit is contained in:
Luis Hebendanz 2024-02-06 20:13:18 +07:00
parent 21443d0647
commit ab05cfde30
2 changed files with 16 additions and 5 deletions

View File

@ -24,6 +24,10 @@ class FlakeConfig:
revision: str | None
vm: VmConfig
def __post_init__(self) -> None:
if isinstance(self.vm, dict):
self.vm = VmConfig(**self.vm)
def run_cmd(cmd: list[str]) -> str:
proc = run(cmd)

View File

@ -109,14 +109,21 @@ class ClanList(Gtk.Box):
row.set_title_selectable(True)
# Subtitle
row.set_subtitle(flake.clan_name)
if flake.vm.machine_description:
row.set_subtitle(flake.vm.machine_description)
else:
row.set_subtitle(flake.clan_name)
row.set_subtitle_lines(1)
# # Avatar
# Avatar
avatar = Adw.Avatar()
if flake.icon:
avatar.set_custom_image(Gdk.Texture.new_from_filename(flake.icon))
if not flake.icon:
machine_icon = flake.vm.machine_icon
if machine_icon:
avatar.set_custom_image(Gdk.Texture.new_from_filename(str(machine_icon)))
elif flake.icon:
avatar.set_custom_image(Gdk.Texture.new_from_filename(str(flake.icon)))
else:
avatar.set_text(flake.clan_name + " " + flake.flake_attr)
avatar.set_show_initials(True)