Skip to content

Commit 64b3535

Browse files
committed
Migrate from run_gui to make_gui
1 parent 3f30eb6 commit 64b3535

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

src/ManualClient.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,8 @@ def on_tracker_events(self, events: list[str]):
212212
if events:
213213
self.ui.update_tracker_and_locations_table(update_highlights=True)
214214

215-
def run_gui(self):
216-
"""Import kivy UI system and start running it as self.ui_task."""
217-
from kvui import GameManager
215+
def make_gui(self) -> typing.Type["kvui.GameManager"]:
216+
ui = super().make_gui() # before the kivy imports so kvui gets loaded first
218217

219218
from kivy.metrics import dp
220219
from kivy.uix.button import Button
@@ -246,7 +245,7 @@ class TreeViewButton(Button, TreeViewNode):
246245
class TreeViewScrollView(ScrollView, TreeViewNode):
247246
pass
248247

249-
class ManualManager(GameManager):
248+
class ManualManager(ui):
250249
logging_pairs = [
251250
("Client", "Archipelago"),
252251
("Manual", "Manual"),
@@ -287,9 +286,6 @@ def build(self) -> Layout:
287286

288287
self.build_tracker_and_locations_table()
289288

290-
if tracker_loaded:
291-
self.ctx.build_gui(self)
292-
293289
return self.container
294290

295291
def clear_lists(self):
@@ -663,12 +659,7 @@ def victory_button_callback(self, button):
663659
self.ctx.items_received.append("__Victory__")
664660
self.ctx.syncing = True
665661

666-
self.ui = ManualManager(self)
667-
668-
if tracker_loaded:
669-
self.load_kv()
670-
671-
self.ui_task = asyncio.create_task(self.ui.async_run(), name="UI")
662+
return ManualManager
672663

673664
async def game_watcher_manual(ctx: ManualContext):
674665
while not ctx.exit_event.is_set():

0 commit comments

Comments
 (0)