clan-vm-manager: rename "Online" to "Status"
online means connected to some network, which is not what this field shows.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
from enum import StrEnum
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
@@ -16,12 +17,17 @@ from gi.repository import GdkPixbuf
|
|||||||
from clan_vm_manager import assets
|
from clan_vm_manager import assets
|
||||||
|
|
||||||
|
|
||||||
|
class VMStatus(StrEnum):
|
||||||
|
RUNNING = "Running"
|
||||||
|
STOPPED = "Stopped"
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
class VMBase:
|
class VMBase:
|
||||||
icon: Path | GdkPixbuf.Pixbuf
|
icon: Path | GdkPixbuf.Pixbuf
|
||||||
name: str
|
name: str
|
||||||
url: str
|
url: str
|
||||||
status: bool
|
status: VMStatus
|
||||||
_flake_attr: str
|
_flake_attr: str
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -31,7 +37,7 @@ class VMBase:
|
|||||||
"Icon": GdkPixbuf.Pixbuf,
|
"Icon": GdkPixbuf.Pixbuf,
|
||||||
"Name": str,
|
"Name": str,
|
||||||
"URL": str,
|
"URL": str,
|
||||||
"Online": bool,
|
"Status": str,
|
||||||
"_FlakeAttr": str,
|
"_FlakeAttr": str,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -46,7 +52,7 @@ class VMBase:
|
|||||||
"Icon": str(self.icon),
|
"Icon": str(self.icon),
|
||||||
"Name": self.name,
|
"Name": self.name,
|
||||||
"URL": self.url,
|
"URL": self.url,
|
||||||
"Online": self.status,
|
"Status": self.status,
|
||||||
"_FlakeAttr": self._flake_attr,
|
"_FlakeAttr": self._flake_attr,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -75,9 +81,9 @@ def get_initial_vms(
|
|||||||
if entry.flake.icon is not None:
|
if entry.flake.icon is not None:
|
||||||
icon = entry.flake.icon
|
icon = entry.flake.icon
|
||||||
|
|
||||||
status = False
|
status = VMStatus.STOPPED
|
||||||
if entry.flake.flake_url in running_vms:
|
if entry.flake.flake_url in running_vms:
|
||||||
status = True
|
status = VMStatus.RUNNING
|
||||||
|
|
||||||
base = VMBase(
|
base = VMBase(
|
||||||
icon=icon,
|
icon=icon,
|
||||||
|
|||||||
Reference in New Issue
Block a user