refactor: remove commented-out code in PlayerBox class

This commit is contained in:
tr1x_em authored and tr1x_em (aider) committed 2025-08-05 23:35:03 +05:30
1 parent 57593f8c10
commit 3c0193411c
1 file changed
+52 -50
+52 -50
View File
@@ -200,6 +200,7 @@ class PlayerBoxStack(Box):
else len(self.player_stack.get_children()) - 1 else len(self.player_stack.get_children()) - 1
) )
# set new active button # set new active button
print(f"[PlayerBoxStack] Switching to player at index {self.current_stack_pos}")
self.player_buttons[self.current_stack_pos].add_style_class("active") self.player_buttons[self.current_stack_pos].add_style_class("active")
self.player_stack.set_visible_child( self.player_stack.set_visible_child(
self.player_stack.get_children()[self.current_stack_pos], self.player_stack.get_children()[self.current_stack_pos],
@@ -544,56 +545,57 @@ class PlayerBox(Box):
pass # Ignore errors during cleanup in destructor pass # Ignore errors during cleanup in destructor
def update_buttons(self, player_buttons, show_buttons): def update_buttons(self, player_buttons, show_buttons):
"""Update the stack switcher buttons in this player box""" # """Update the stack switcher buttons in this player box"""
logger.info( pass
f"[PlayerBox] update_buttons called: show_buttons={ # logger.info(
show_buttons # f"[PlayerBox] update_buttons called: show_buttons={
}, num_buttons={len(player_buttons)}" # show_buttons
) # }, num_buttons={len(player_buttons)}"
# )
# Clear existing buttons #
for child in self.stack_buttons_box.get_children(): # # Clear existing buttons
child.destroy() # for child in self.stack_buttons_box.get_children():
# child.destroy()
if show_buttons and len(player_buttons) > 1: #
logger.info(f"[PlayerBox] Creating {len(player_buttons)} stack buttons") # if show_buttons and len(player_buttons) > 1:
# Create simple dot indicators for each player # logger.info(f"[PlayerBox] Creating {len(player_buttons)} stack buttons")
for i, button in enumerate(player_buttons): # # Create simple dot indicators for each player
# Create a more visible dot button # for i, button in enumerate(player_buttons):
dot_button = Button( # # Create a more visible dot button
name="player-stack-button", # dot_button = Button(
style="min-width: 16px; min-height: 16px; border-radius: 8px; margin: 4px; background-color: #666; border: 1px solid #999;", # name="player-stack-button",
) # style="min-width: 16px; min-height: 16px; border-radius: 8px; margin: 4px; background-color: #666; border: 1px solid #999;",
# )
# Set active state based on original button #
if button.get_style_context().has_class("active"): # # Set active state based on original button
dot_button.add_style_class("active") # if button.get_style_context().has_class("active"):
dot_button.set_style( # dot_button.add_style_class("active")
"min-width: 16px; min-height: 16px; border-radius: 8px; margin: 4px; background-color: #fff; border: 1px solid #ccc;" # dot_button.set_style(
) # "min-width: 16px; min-height: 16px; border-radius: 8px; margin: 4px; background-color: #fff; border: 1px solid #ccc;"
# )
# Connect click handler to switch to this player #
def make_click_handler(index): # # Connect click handler to switch to this player
return lambda *_: self.player_stack.on_player_clicked_by_index( # def make_click_handler(index):
index # return lambda *_: self.player_stack.on_player_clicked_by_index(
) # index
# )
dot_button.connect("clicked", make_click_handler(i)) #
self.stack_buttons_box.children = [ # dot_button.connect("clicked", make_click_handler(i))
*self.stack_buttons_box.children, # self.stack_buttons_box.children = [
dot_button, # *self.stack_buttons_box.children,
] # dot_button,
logger.info( # ]
f"[PlayerBox] Added dot button {i}, total children: { # logger.info(
len(self.stack_buttons_box.get_children()) # f"[PlayerBox] Added dot button {i}, total children: {
}" # len(self.stack_buttons_box.get_children())
) # }"
# )
self.stack_buttons_box.show_all() #
logger.info("[PlayerBox] Stack buttons box shown") # self.stack_buttons_box.show_all()
else: # logger.info("[PlayerBox] Stack buttons box shown")
self.stack_buttons_box.hide() # else:
logger.info("[PlayerBox] Stack buttons box hidden") # self.stack_buttons_box.hide()
# logger.info("[PlayerBox] Stack buttons box hidden")
def _on_metadata(self, *_): def _on_metadata(self, *_):
self._set_image() self._set_image()