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.
This commit is contained in:
LemonNexus 2026-02-14 19:53:51 +00:00
parent 539f07e713
commit de63d8895a
2 changed files with 7 additions and 5 deletions

View File

@ -557,9 +557,11 @@ class OverlayWindow(QMainWindow):
# Get icon name # Get icon name
icon_name = get_plugin_icon_name(plugin.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 = 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 # Insert before stretch
self.sidebar_buttons_layout.insertWidget(idx, btn) self.sidebar_buttons_layout.insertWidget(idx, btn)

View File

@ -159,7 +159,7 @@ class DashboardPlugin(BasePlugin):
QPushButton {{ QPushButton {{
background-color: {EU_COLORS['bg_secondary']}; background-color: {EU_COLORS['bg_secondary']};
color: {EU_COLORS['text_secondary']}; color: {EU_COLORS['text_secondary']};
border: 1px solid {EU_COLORS['border_subtle']}; border: 1px solid {EU_COLORS['border_default']};
border-radius: 4px; border-radius: 4px;
padding: 8px 16px; padding: 8px 16px;
}} }}
@ -223,7 +223,7 @@ class DashboardPlugin(BasePlugin):
card.setStyleSheet(f""" card.setStyleSheet(f"""
QFrame {{ QFrame {{
background-color: {EU_COLORS['bg_secondary']}; background-color: {EU_COLORS['bg_secondary']};
border: 1px solid {EU_COLORS['border_subtle']}; border: 1px solid {EU_COLORS['border_default']};
border-radius: 8px; border-radius: 8px;
}} }}
""") """)
@ -287,7 +287,7 @@ class DashboardPlugin(BasePlugin):
QListWidget {{ QListWidget {{
background-color: {EU_COLORS['bg_secondary']}; background-color: {EU_COLORS['bg_secondary']};
color: white; color: white;
border: 1px solid {EU_COLORS['border_subtle']}; border: 1px solid {EU_COLORS['border_default']};
}} }}
QListWidget::item {{ QListWidget::item {{
padding: 10px; padding: 10px;