nix fmt
This commit is contained in:
parent
50590ecdc4
commit
2fa124f274
@ -2,19 +2,19 @@
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
gi.require_version("Gdk", "3.0")
|
||||
from gi.repository import Gio, Gtk
|
||||
|
||||
from typing import Any, List
|
||||
from pathlib import Path
|
||||
from .constants import constants
|
||||
from .ui.clan_select_list import ClanSelectPage
|
||||
|
||||
class VM():
|
||||
def __init__(self, url:str, autostart: bool, path: Path):
|
||||
|
||||
class VM:
|
||||
def __init__(self, url: str, autostart: bool, path: Path):
|
||||
self.url = url
|
||||
self.autostart = autostart
|
||||
self.path = path
|
||||
@ -24,18 +24,12 @@ vms = [
|
||||
VM("clan://clan.lol", True, "/home/user/my-clan"),
|
||||
VM("clan://lassul.lol", False, "/home/user/my-clan"),
|
||||
VM("clan://mic.lol", False, "/home/user/my-clan"),
|
||||
VM("clan://dan.lol", False, "/home/user/my-clan")
|
||||
VM("clan://dan.lol", False, "/home/user/my-clan"),
|
||||
]
|
||||
|
||||
vms.extend(vms)
|
||||
# vms.extend(vms)
|
||||
# vms.extend(vms)
|
||||
|
||||
import gi
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk
|
||||
from .ui.clan_select_list import ClanSelectPage
|
||||
|
||||
|
||||
class ClanJoinPage(Gtk.Box):
|
||||
def __init__(self):
|
||||
@ -55,7 +49,6 @@ class MainWindow(Gtk.ApplicationWindow):
|
||||
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6, expand=True)
|
||||
self.add(vbox)
|
||||
|
||||
|
||||
# Add a notebook layout
|
||||
# https://python-gtk-3-tutorial.readthedocs.io/en/latest/layout.html#notebook
|
||||
self.notebook = Gtk.Notebook()
|
||||
@ -71,7 +64,6 @@ class MainWindow(Gtk.ApplicationWindow):
|
||||
Gio.Application.quit(self.get_application())
|
||||
|
||||
|
||||
|
||||
class Application(Gtk.Application):
|
||||
def __init__(self):
|
||||
super().__init__(
|
||||
@ -86,7 +78,7 @@ class Application(Gtk.Application):
|
||||
def do_activate(self):
|
||||
win = self.props.active_window
|
||||
if not win:
|
||||
#win = SwitchTreeView(application=self)
|
||||
# win = SwitchTreeView(application=self)
|
||||
win = MainWindow(application=self)
|
||||
win.present()
|
||||
|
||||
|
@ -1,7 +1,3 @@
|
||||
|
||||
|
||||
import gi
|
||||
|
||||
from gi.repository import Gtk
|
||||
|
||||
|
||||
@ -10,7 +6,11 @@ class ClanSelectPage(Gtk.Box):
|
||||
super().__init__(orientation=Gtk.Orientation.VERTICAL, expand=True)
|
||||
|
||||
self.add(ClanSelectList(vms))
|
||||
self.add(ClanSelectButtons(self.on_start_clicked, self.on_stop_clicked, self.on_backup_clicked))
|
||||
self.add(
|
||||
ClanSelectButtons(
|
||||
self.on_start_clicked, self.on_stop_clicked, self.on_backup_clicked
|
||||
)
|
||||
)
|
||||
|
||||
def on_start_clicked(self, widget):
|
||||
print("Start clicked")
|
||||
@ -21,6 +21,7 @@ class ClanSelectPage(Gtk.Box):
|
||||
def on_backup_clicked(self, widget):
|
||||
print("Backup clicked")
|
||||
|
||||
|
||||
class ClanSelectButtons(Gtk.Box):
|
||||
def __init__(self, on_start_clicked, on_stop_clicked, on_backup_clicked):
|
||||
super().__init__(orientation=Gtk.Orientation.HORIZONTAL)
|
||||
@ -48,10 +49,10 @@ class ClanSelectList(Gtk.Box):
|
||||
self.list_store.append(items)
|
||||
|
||||
self.tree_view = Gtk.TreeView(self.list_store, expand=True)
|
||||
for (idx, (key, value)) in enumerate(vm.__dict__.items()):
|
||||
for idx, (key, value) in enumerate(vm.__dict__.items()):
|
||||
if isinstance(value, str):
|
||||
renderer = Gtk.CellRendererText()
|
||||
#renderer.set_property("xalign", 0.5)
|
||||
# renderer.set_property("xalign", 0.5)
|
||||
col = Gtk.TreeViewColumn(key.capitalize(), renderer, text=idx)
|
||||
col.set_property("alignment", 0.5)
|
||||
col.set_sort_column_id(idx)
|
||||
@ -68,7 +69,6 @@ class ClanSelectList(Gtk.Box):
|
||||
selection = self.tree_view.get_selection()
|
||||
selection.connect("changed", self.on_select_row)
|
||||
|
||||
|
||||
self.set_border_width(10)
|
||||
self.add(self.tree_view)
|
||||
|
||||
@ -83,8 +83,7 @@ class ClanSelectList(Gtk.Box):
|
||||
# Print the updated value
|
||||
print("Switched", path, "to", self.list_store[path][1])
|
||||
|
||||
|
||||
def on_select_row(self, selection):
|
||||
model, row = selection.get_selected()
|
||||
if row is not None:
|
||||
print(f"Selected {model[row][0]}")
|
||||
print(f"Selected {model[row][0]}")
|
||||
|
Loading…
Reference in New Issue
Block a user