Skip to content

Commit 4daf5c0

Browse files
authored
Merge pull request #99 from ManualForArchipelago/make-gui
Backport 0.5.1's run_gui function
2 parents a50cff0 + fbac66a commit 4daf5c0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/ManualClient.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,18 @@ def on_tracker_events(self, events: list[str]):
213213
if events:
214214
self.ui.update_tracker_and_locations_table(update_highlights=True)
215215

216+
def run_gui(self):
217+
"""Import kivy UI system from make_gui() and start running it as self.ui_task."""
218+
if hasattr(SuperContext, "make_gui"):
219+
# Call the real one if it exists
220+
return super().run_gui()
221+
222+
# This is a copy of 0.5.1's run_gui, because backporting is easier than the alternative.
223+
# This entire function can be removed once 0.5.1 is the old enough.
224+
ui_class = self.make_gui()
225+
self.ui = ui_class(self)
226+
self.ui_task = asyncio.create_task(self.ui.async_run(), name="UI")
227+
216228
def make_gui(self) -> typing.Type["kvui.GameManager"]:
217229
ui = super().make_gui() # before the kivy imports so kvui gets loaded first
218230

0 commit comments

Comments
 (0)