From e0756beaea9074a9f21ce7aac55008f4c30f4fa2 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Sun, 27 Jul 2025 01:33:56 +0545 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor(dashboard):=20mov?= =?UTF-8?q?e=20ScrolledWindow=20to=20notification=20component=20for=20bett?= =?UTF-8?q?er=20structure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/dashboard/main.py | 19 +------------------ modules/dashboard/notifications.py | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/modules/dashboard/main.py b/modules/dashboard/main.py index f2a976b..5387b07 100644 --- a/modules/dashboard/main.py +++ b/modules/dashboard/main.py @@ -1,6 +1,5 @@ from fabric.widgets.box import Box from fabric.widgets.revealer import Revealer -from fabric.widgets.scrolledwindow import ScrolledWindow from fabric.core.service import Property from modules.dashboard.bluetooth import Bluetooth @@ -32,22 +31,6 @@ class Dashboard(Box): # Create real notifications component self.dashboard_notifications = DashboardNotifications() - # Create scrolled window for notifications (matching dock notifications style) - self.notifications_scrolled = ScrolledWindow( - name="notification-history-scrolled-window", - child=self.dashboard_notifications, - h_scrollbar_policy="never", - v_scrollbar_policy="automatic", - min_content_size=(400, 200), - max_content_size=(450, 300), - h_expand=True, - v_expand=True, - h_align="fill", - v_align="fill", - propagate_width=False, - propagate_height=False, - ) - self.tiles = Box( children=[ self.wifi, @@ -66,7 +49,7 @@ class Dashboard(Box): spacing=8, h_expand=True, v_expand=True, - children=[self.notifications_scrolled], + children=[self.dashboard_notifications], style_classes=["notification-history-popup"], ), child_revealed=True, diff --git a/modules/dashboard/notifications.py b/modules/dashboard/notifications.py index b5c6256..ceba117 100644 --- a/modules/dashboard/notifications.py +++ b/modules/dashboard/notifications.py @@ -7,6 +7,7 @@ from fabric.widgets.box import Box from fabric.widgets.label import Label from fabric.widgets.button import Button from fabric.widgets.centerbox import CenterBox +from fabric.widgets.scrolledwindow import ScrolledWindow from gi.repository import GLib, Gtk import os import json @@ -238,10 +239,26 @@ class DashboardNotifications(Box): children=[self.no_notifications_label], ) - # Add components to main container + # Create scrolled window for notifications list only + self.notifications_scrolled = ScrolledWindow( + name="notification-history-scrolled-window", + child=self.notifications_list, + h_scrollbar_policy="never", + v_scrollbar_policy="automatic", + min_content_size=(400, 200), + max_content_size=(450, 300), + h_expand=True, + v_expand=True, + h_align="fill", + v_align="fill", + propagate_width=False, + propagate_height=False, + ) + + # Add components to main container - header outside, scrolled list inside self.add(self.history_header) - self.add(self.notifications_list) - + self.add(self.notifications_scrolled) + # Add the no notifications box initially to the notifications list self.notifications_list.add(self.no_notifications_box)