move ctx.ui to CommonClient.py

This commit is contained in:
Fabian Dill
2021-07-31 01:53:06 +02:00
parent f5c62a82ac
commit 7f8617d639
3 changed files with 12 additions and 15 deletions

View File

@@ -88,6 +88,7 @@ class CommonContext():
current_reconnect_delay = starting_reconnect_delay
command_processor = ClientCommandProcessor
game: None
ui: None
def __init__(self, server_address, password):
# server state
@@ -204,7 +205,11 @@ class CommonContext():
logger.info(args["text"])
def on_print_json(self, args: dict):
logger.info(self.jsontotextparser(args["data"]))
if self.ui:
self.ui.print_json(args["data"])
else:
text = self.jsontotextparser(args["data"])
logger.info(text)
async def server_loop(ctx: CommonContext, address=None):