♻️ refactor(dashboard): use direct method calls instead of fabric-cli for tile menu actions

This commit is contained in:
sankalp committed 2025-07-27 01:58:04 +05:45
1 parent e0756beaea
commit f76533df26
2 files changed
+9 -7

No files matched your search

+4
View File
@@ -28,6 +28,10 @@ class Dashboard(Box):
props=self.mini_player, mini_props=self.mini_player.get_mini_view() props=self.mini_player, mini_props=self.mini_player.get_mini_view()
) )
# Set dashboard instance reference for tiles that need it
self.wifi.dashboard_instance = self
self.bluetooth.dashboard_instance = self
# Create real notifications component # Create real notifications component
self.dashboard_notifications = DashboardNotifications() self.dashboard_notifications = DashboardNotifications()
+5 -7
View File
@@ -5,7 +5,6 @@ from fabric.widgets.stack import Stack
from fabric.widgets.revealer import Revealer from fabric.widgets.revealer import Revealer
from fabric.widgets.centerbox import CenterBox from fabric.widgets.centerbox import CenterBox
import utils.icons as icons import utils.icons as icons
from fabric.utils.helpers import exec_shell_command_async
class Tile(Box): class Tile(Box):
@@ -20,6 +19,7 @@ class Tile(Box):
style_classes="tile-label", label=label, h_align="start" style_classes="tile-label", label=label, h_align="start"
) )
self.toggle = False self.toggle = False
self.dashboard_instance = None # Will be set by the dashboard
self.type_box = Box( self.type_box = Box(
style_classes="tile-type", style_classes="tile-type",
@@ -86,12 +86,10 @@ class Tile(Box):
self.menu.add_style_class("expand") self.menu.add_style_class("expand")
self.menu.remove_style_class("contract") self.menu.remove_style_class("contract")
print(self.toggle, self.get_name()) print(self.toggle, self.get_name())
name = self.get_name()
exec_shell_command_async( # Call dashboard method directly instead of using fabric-cli
f"fabric-cli exec bar-example \"notch.dashboard.handle_tile_menu_expand('{ if self.dashboard_instance:
name self.dashboard_instance.handle_tile_menu_expand(self.get_name(), self.toggle)
}', {self.toggle})\""
)
def mini_view(self): def mini_view(self):
self.content_button.set_reveal_child(False) self.content_button.set_reveal_child(False)