mirror of
https://github.com/ArchipelagoMW/Archipelago.git
synced 2026-09-03 13:51:56 -07:00
CommonClient: allow worlds to change title of run_gui without rewriting it (#3297)
* moves the title name in CommonContext.run_gui into a parameter defaulted to the normal default so others using it don't have to rewrite everything * Change to using a GameManager attribute instead of a default param * Update CommonClient.py treble suggestion 1 Co-authored-by: Aaron Wagener <[email protected]> * Update CommonClient.py treble suggestion 2 Co-authored-by: Aaron Wagener <[email protected]> * Update CommonClient.py treble suggestion 3 Co-authored-by: Doug Hoskisson <[email protected]> * Use make_gui() instead of a property to push kivy importing back to lazy loading regardless of gui_enabled status * cleanup * almost forgot to type it * change make_gui to be a class so clients can subclass it * clean up code readability --------- Co-authored-by: Aaron Wagener <[email protected]> Co-authored-by: Doug Hoskisson <[email protected]> Co-authored-by: NewSoupVi <[email protected]>
This commit is contained in:
co-authored by
Aaron Wagener
Doug Hoskisson
NewSoupVi
parent
430b71a092
commit
b8c2e14e8b
+8
-6
@@ -662,17 +662,19 @@ class CommonContext:
|
||||
logger.exception(msg, exc_info=exc_info, extra={'compact_gui': True})
|
||||
self._messagebox_connection_loss = self.gui_error(msg, exc_info[1])
|
||||
|
||||
def run_gui(self):
|
||||
"""Import kivy UI system and start running it as self.ui_task."""
|
||||
def make_gui(self) -> type:
|
||||
"""To return the Kivy App class needed for run_gui so it can be overridden before being built"""
|
||||
from kvui import GameManager
|
||||
|
||||
class TextManager(GameManager):
|
||||
logging_pairs = [
|
||||
("Client", "Archipelago")
|
||||
]
|
||||
base_title = "Archipelago Text Client"
|
||||
|
||||
self.ui = TextManager(self)
|
||||
return TextManager
|
||||
|
||||
def run_gui(self):
|
||||
"""Import kivy UI system from make_gui() and start running it as self.ui_task."""
|
||||
ui_class = self.make_gui()
|
||||
self.ui = ui_class(self)
|
||||
self.ui_task = asyncio.create_task(self.ui.async_run(), name="UI")
|
||||
|
||||
def run_cli(self):
|
||||
|
||||
Reference in New Issue
Block a user