From 4ccfceda0103e27398320c1f1a659e4fed210666 Mon Sep 17 00:00:00 2001 From: Hauke Platte Date: Tue, 19 Mar 2024 19:08:43 +0100 Subject: [PATCH 1/2] fix(UI-UX): removed additional arguments from __new__ methods of Prfile, Muliplayer and Singleplayer --- UI/multi.py | 2 +- UI/profile.py | 2 +- UI/single.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/UI/multi.py b/UI/multi.py index 7360c00..de763cf 100644 --- a/UI/multi.py +++ b/UI/multi.py @@ -264,7 +264,7 @@ class Multiplayer(base_frame): def __new__(cls, master, *args, **kwargs): if(len(master.players) == 0 or master.player == None): return Profile(master, *args, return_to=Multiplayer, **kwargs) - return super().__new__(cls, *args, **kwargs) + return super().__new__(cls) def __init__(self, master, *args): super().__init__(master) diff --git a/UI/profile.py b/UI/profile.py index 879efd4..cf24588 100644 --- a/UI/profile.py +++ b/UI/profile.py @@ -96,7 +96,7 @@ class Profile(base_frame): def __new__(cls, master, *args, **kwargs): if len(master.players) == 0: return NewProfile(master, *args, **kwargs) - return super().__new__(cls, *args, **kwargs) + return super().__new__(cls) def __init__(self, master, *args, **kwargs): super().__init__(master) diff --git a/UI/single.py b/UI/single.py index d0d44fb..f449402 100644 --- a/UI/single.py +++ b/UI/single.py @@ -15,7 +15,7 @@ class Singleplayer(base_frame): def __new__(cls, master, *args, **kwargs): if(len(master.players) == 0 or master.player == None): return Profile(master, *args, return_to=Singleplayer, **kwargs) - return super().__new__(cls, *args, **kwargs) + return super().__new__(cls) def __init__(self, master, *args, **kwargs): super().__init__(master) From cb8a9e3b0e2bd68458b64041ba7d3fd21fbf366d Mon Sep 17 00:00:00 2001 From: Hauke Platte Date: Tue, 19 Mar 2024 19:09:21 +0100 Subject: [PATCH 2/2] fix(UI-UX): removed index-out-of-range error when deleting profiles --- UI/profile.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/UI/profile.py b/UI/profile.py index cf24588..ab390b9 100644 --- a/UI/profile.py +++ b/UI/profile.py @@ -79,6 +79,7 @@ def _create(self): self.master.players[i] = Player.with_color_str(self.etrName.val, self.color_str) else: self.master.players.append(Player.with_color_str(self.etrName.val, self.color_str)) + self.master.player = len(self.master.players) - 1 ProfileIO.set_profiles(self.master.players, self.master.player) self.master.show(self.next) @@ -146,9 +147,9 @@ def _display_widgets(self): def _delete(self): del self.master.players[self.master.player] - self.master.player = 0 - self.master.show(Profile) + self.master.player = 0 if(len(self.master.players) > 0) else None ProfileIO.set_profiles(self.master.players, self.master.player) + self.master.show(Profile) def _dropdown_changed(self, *args): for i, player in enumerate(self.master.players):