From 13b016a87c242b7dfb07d99d3deddf5c731b0f2b Mon Sep 17 00:00:00 2001 From: Petzys <87223648+Petzys@users.noreply.github.com> Date: Thu, 29 Feb 2024 12:05:27 +0100 Subject: [PATCH 1/3] Fix(ui-client): TTTK-52 Fixed tk element passed to thread --- UI/multi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UI/multi.py b/UI/multi.py index 1595ac7..d946a8c 100644 --- a/UI/multi.py +++ b/UI/multi.py @@ -83,7 +83,7 @@ def manually(self): def _connect(self): root = self.master.master - root.network_client = client_thread(self, in_queue=root.out_queue, out_queue=root.in_queue, player=root.player, ip=self.etrAddress.get()) + root.network_client = client_thread(root, in_queue=root.out_queue, out_queue=root.in_queue, player=root.player, ip=self.etrAddress.get()) root.show(Join) class Multiplayer(base_frame): From 7b67182d6052bb1a67f7c091429973ffbbea336b Mon Sep 17 00:00:00 2001 From: Petzys <87223648+Petzys@users.noreply.github.com> Date: Thu, 29 Feb 2024 13:48:03 +0100 Subject: [PATCH 2/3] Fix(client): TTTK-52 Fixed type annotation for chat messages --- Client/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Client/client.py b/Client/client.py index 76731ec..5ce7b57 100644 --- a/Client/client.py +++ b/Client/client.py @@ -29,7 +29,7 @@ class GameClient: _lobby_status (list[str]): The status of the lobby. Contains all players in the lobby. _game_status (list[list[int]]): The status of the game. Contains the current playfield. _statistics: The statistics of the game. TODO - _chat_history (list[str]): The chat history of the game. Contains all messages sent in the game. + _chat_history (list[tuple[Player, str]]): The chat history of the game. Contains all messages sent in the game. _winner (Player): The winner of the game. None if the game is not finished yet or it is a draw. _error_history (list[str]): The error history of the game. Contains all errors that occurred for this client. _json_schema (dict): The JSON schema that is used to validate incoming messages. @@ -67,7 +67,7 @@ def __init__(self, ip:str, port:int, player:Player) -> None: self._lobby_status: list[str] = [] self._playfield: list[list[int]] = [[0,0,0],[0,0,0],[0,0,0]] self._statistics = None # TODO - self._chat_history: list[str] = [] + self._chat_history: list[tuple[Player, str]] = [] self._winner: Player = None self._error_history: list[str] = [] From 86764f6e296ff42b05fcf276163e9123cdc18474 Mon Sep 17 00:00:00 2001 From: Petzys <87223648+Petzys@users.noreply.github.com> Date: Sun, 3 Mar 2024 20:16:16 +0100 Subject: [PATCH 3/3] Fix(client): TTTK-52 Fixed type annotation for some methods --- Client/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Client/client.py b/Client/client.py index 5ce7b57..66abb43 100644 --- a/Client/client.py +++ b/Client/client.py @@ -145,13 +145,13 @@ async def listen(self): await self._message_handler(message_type) - def get_player_by_uuid(self, uuid:str): + def get_player_by_uuid(self, uuid:str) -> Player: for player in self._lobby_status: if str(player.uuid) == uuid: return player return None - async def _preprocess_message(self, message:str): + async def _preprocess_message(self, message:str) -> str: message_json = json.loads(message) try: