fix formatting
This commit is contained in:
parent
e7fa998241
commit
09cf4a9ff4
@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
|
||||
import gi
|
||||
|
||||
@ -20,6 +19,7 @@ class ClanWindows:
|
||||
join: type[JoinWindow]
|
||||
overview: type[OverviewWindow]
|
||||
|
||||
|
||||
@dataclass
|
||||
class ClanConfig:
|
||||
initial_window: str
|
||||
@ -35,11 +35,14 @@ class Application(Gtk.Application):
|
||||
self.windows = windows
|
||||
initial = windows.__dict__[config.initial_window]
|
||||
|
||||
if(issubclass(initial,JoinWindow)):
|
||||
if issubclass(initial, JoinWindow):
|
||||
# see JoinWindow constructor
|
||||
self.window = initial(initial_values=InitialJoinValues(url=config.url or ""), cbs=Callbacks(show_list=self.show_list, show_join=self.show_join))
|
||||
self.window = initial(
|
||||
initial_values=InitialJoinValues(url=config.url or ""),
|
||||
cbs=Callbacks(show_list=self.show_list, show_join=self.show_join),
|
||||
)
|
||||
|
||||
if(issubclass(initial,OverviewWindow)):
|
||||
if issubclass(initial, OverviewWindow):
|
||||
# see OverviewWindow constructor
|
||||
self.window = initial()
|
||||
|
||||
@ -49,7 +52,6 @@ class Application(Gtk.Application):
|
||||
self.do_activate()
|
||||
prev.hide()
|
||||
|
||||
|
||||
def show_join(self, initial_values: InitialJoinValues) -> None:
|
||||
prev = self.window
|
||||
self.window = self.windows.__dict__["join"]()
|
||||
@ -79,7 +81,10 @@ class Application(Gtk.Application):
|
||||
|
||||
def show_join(args: argparse.Namespace) -> None:
|
||||
print(f"Joining clan {args.clan_uri}")
|
||||
app = Application(windows=ClanWindows(join=JoinWindow, overview=OverviewWindow), config=ClanConfig(url=args.clan_uri, initial_window="join") )
|
||||
app = Application(
|
||||
windows=ClanWindows(join=JoinWindow, overview=OverviewWindow),
|
||||
config=ClanConfig(url=args.clan_uri, initial_window="join"),
|
||||
)
|
||||
return app.run()
|
||||
|
||||
|
||||
@ -89,7 +94,10 @@ def register_join_parser(parser: argparse.ArgumentParser) -> None:
|
||||
|
||||
|
||||
def show_overview(args: argparse.Namespace) -> None:
|
||||
app = Application(windows=ClanWindows(join=JoinWindow, overview=OverviewWindow), config=ClanConfig(url=None, initial_window="overview") )
|
||||
app = Application(
|
||||
windows=ClanWindows(join=JoinWindow, overview=OverviewWindow),
|
||||
config=ClanConfig(url=None, initial_window="overview"),
|
||||
)
|
||||
return app.run()
|
||||
|
||||
|
||||
|
@ -28,8 +28,9 @@ class JoinWindow(Gtk.ApplicationWindow):
|
||||
vbox.add(self.stack)
|
||||
vbox.add(Gtk.Entry(text=str(initial_values.url)))
|
||||
|
||||
|
||||
button = Gtk.Button(label="To List", )
|
||||
button = Gtk.Button(
|
||||
label="To List",
|
||||
)
|
||||
button.connect("clicked", self.switch)
|
||||
vbox.add(button)
|
||||
|
||||
@ -41,5 +42,3 @@ class JoinWindow(Gtk.ApplicationWindow):
|
||||
|
||||
def on_quit(self, *args: Any) -> None:
|
||||
Gio.Application.quit(self.get_application())
|
||||
|
||||
|
||||
|
@ -84,4 +84,3 @@ class OverviewWindow(Gtk.ApplicationWindow):
|
||||
|
||||
def on_quit(self, *args: Any) -> None:
|
||||
Gio.Application.quit(self.get_application())
|
||||
|
Loading…
Reference in New Issue
Block a user