nix fmt
This commit is contained in:
@@ -73,4 +73,4 @@ import the glade file through GTK template
|
||||
- [GTK3 Python] https://github.com/sam-m888/python-gtk3-tutorial/tree/master
|
||||
- https://gnome.pages.gitlab.gnome.org/libhandy/doc/1.8/index.html
|
||||
- https://github.com/geigi/cozy
|
||||
- https://github.com/lutris/lutris/blob/2e9bd115febe08694f5d42dabcf9da36a1065f1d/lutris/gui/widgets/cellrenderers.py#L92
|
||||
- https://github.com/lutris/lutris/blob/2e9bd115febe08694f5d42dabcf9da36a1065f1d/lutris/gui/widgets/cellrenderers.py#L92
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, Optional
|
||||
from collections import OrderedDict
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
@@ -15,10 +16,18 @@ from .ui.clan_select_list import ClanSelectPage
|
||||
|
||||
|
||||
class VM:
|
||||
def __init__(self, icon: Path, name: str, url: str, path: Path, running: bool = False, autostart: bool = False) -> None:
|
||||
def __init__(
|
||||
self,
|
||||
icon: Path,
|
||||
name: str,
|
||||
url: str,
|
||||
path: Path,
|
||||
running: bool = False,
|
||||
autostart: bool = False,
|
||||
) -> None:
|
||||
self.icon = icon.resolve()
|
||||
assert(self.icon.exists())
|
||||
assert(self.icon.is_file())
|
||||
assert self.icon.exists()
|
||||
assert self.icon.is_file()
|
||||
self.url = url
|
||||
self.autostart = autostart
|
||||
self.running = running
|
||||
@@ -26,23 +35,41 @@ class VM:
|
||||
self.path = path
|
||||
|
||||
def list_display(self) -> OrderedDict[str, Any]:
|
||||
return OrderedDict({
|
||||
"Icon": str(self.icon),
|
||||
"Name": self.name,
|
||||
"URL": self.url,
|
||||
"Running": self.running,
|
||||
})
|
||||
return OrderedDict(
|
||||
{
|
||||
"Icon": str(self.icon),
|
||||
"Name": self.name,
|
||||
"URL": self.url,
|
||||
"Running": self.running,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
assets = Path(__file__).parent / "assets"
|
||||
assert(assets.is_dir())
|
||||
assert assets.is_dir()
|
||||
|
||||
vms = [
|
||||
VM(assets / "cybernet.jpeg", "Cybernet Clan", "clan://cybernet.lol", "/home/user/w-clan", True),
|
||||
VM(assets / "zenith.jpeg","Zenith Clan", "clan://zenith.lol", "/home/user/lassulus-clan"),
|
||||
VM(assets / "firestorm.jpeg" ,"Firestorm Clan","clan://firestorm.lol", "/home/user/mic-clan"),
|
||||
VM(
|
||||
assets / "cybernet.jpeg",
|
||||
"Cybernet Clan",
|
||||
"clan://cybernet.lol",
|
||||
"/home/user/w-clan",
|
||||
True,
|
||||
),
|
||||
VM(
|
||||
assets / "zenith.jpeg",
|
||||
"Zenith Clan",
|
||||
"clan://zenith.lol",
|
||||
"/home/user/lassulus-clan",
|
||||
),
|
||||
VM(
|
||||
assets / "firestorm.jpeg",
|
||||
"Firestorm Clan",
|
||||
"clan://firestorm.lol",
|
||||
"/home/user/mic-clan",
|
||||
),
|
||||
]
|
||||
#vms.extend(vms)
|
||||
# vms.extend(vms)
|
||||
# vms.extend(vms)
|
||||
# vms.extend(vms)
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
from collections.abc import Callable
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from gi.repository import Gtk, GdkPixbuf
|
||||
from gi.repository import GdkPixbuf, Gtk
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..app import VM
|
||||
|
||||
|
||||
|
||||
class ClanSelectPage(Gtk.Box):
|
||||
def __init__(self, vms: list["VM"]) -> None:
|
||||
super().__init__(orientation=Gtk.Orientation.VERTICAL, expand=True)
|
||||
@@ -81,7 +80,7 @@ class ClanSelectList(Gtk.Box):
|
||||
for vm in vms:
|
||||
items = list(vm.list_display().values())
|
||||
items[0] = GdkPixbuf.Pixbuf.new_from_file_at_size(items[0], 64, 64)
|
||||
assert(len(items) == 4)
|
||||
assert len(items) == 4
|
||||
self.list_store.append(items)
|
||||
|
||||
self.tree_view = Gtk.TreeView(self.list_store, expand=True)
|
||||
@@ -90,7 +89,7 @@ class ClanSelectList(Gtk.Box):
|
||||
case "Icon":
|
||||
renderer = Gtk.CellRendererPixbuf()
|
||||
col = Gtk.TreeViewColumn(key, renderer, pixbuf=idx)
|
||||
#col.add_attribute(renderer, "pixbuf", idx)
|
||||
# col.add_attribute(renderer, "pixbuf", idx)
|
||||
col.set_resizable(True)
|
||||
col.set_expand(True)
|
||||
col.set_property("sizing", Gtk.TreeViewColumnSizing.AUTOSIZE)
|
||||
|
||||
Reference in New Issue
Block a user