From de63d8895ac17e0cceb48c41c004d6a1db014c6d Mon Sep 17 00:00:00 2001 From: LemonNexus Date: Sat, 14 Feb 2026 19:53:51 +0000 Subject: [PATCH] fix: Fix sidebar plugin switching and Dashboard border color BUG 1: Sidebar buttons clicked wrong plugin - Lambda captured idx by reference, always using last value - Fixed by using functools.partial to capture by value BUG 2: Dashboard plugin KeyError 'border_subtle' - Changed to 'border_default' which exists in EU_COLORS The sidebar should now correctly switch to the clicked plugin. --- core/overlay_window.py | 6 ++++-- plugins/dashboard/plugin.py | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/overlay_window.py b/core/overlay_window.py index 97c182f..7820b1c 100644 --- a/core/overlay_window.py +++ b/core/overlay_window.py @@ -557,9 +557,11 @@ class OverlayWindow(QMainWindow): # Get icon name icon_name = get_plugin_icon_name(plugin.name) - # Create sidebar button + # Create sidebar button with proper callback capture btn = SidebarButton(plugin.name, icon_name, self.icon_manager) - btn.clicked.connect(lambda i=idx: self._on_plugin_selected(i)) + # Use functools.partial to properly capture idx by value + from functools import partial + btn.clicked.connect(partial(self._on_plugin_selected, idx)) # Insert before stretch self.sidebar_buttons_layout.insertWidget(idx, btn) diff --git a/plugins/dashboard/plugin.py b/plugins/dashboard/plugin.py index d514940..b8f8a88 100644 --- a/plugins/dashboard/plugin.py +++ b/plugins/dashboard/plugin.py @@ -159,7 +159,7 @@ class DashboardPlugin(BasePlugin): QPushButton {{ background-color: {EU_COLORS['bg_secondary']}; color: {EU_COLORS['text_secondary']}; - border: 1px solid {EU_COLORS['border_subtle']}; + border: 1px solid {EU_COLORS['border_default']}; border-radius: 4px; padding: 8px 16px; }} @@ -223,7 +223,7 @@ class DashboardPlugin(BasePlugin): card.setStyleSheet(f""" QFrame {{ background-color: {EU_COLORS['bg_secondary']}; - border: 1px solid {EU_COLORS['border_subtle']}; + border: 1px solid {EU_COLORS['border_default']}; border-radius: 8px; }} """) @@ -287,7 +287,7 @@ class DashboardPlugin(BasePlugin): QListWidget {{ background-color: {EU_COLORS['bg_secondary']}; color: white; - border: 1px solid {EU_COLORS['border_subtle']}; + border: 1px solid {EU_COLORS['border_default']}; }} QListWidget::item {{ padding: 10px;