diff --git a/main.py b/main.py index 976dba1e..8cb6c64e 100644 --- a/main.py +++ b/main.py @@ -192,6 +192,11 @@ class MainWindow(QMainWindow): self.dashboard_page.add_activity_item ) + # --- ADD THESE TWO LINES TO FIX THE UI UPDATE --- + self.sync_page.database_updated_externally.connect(self.dashboard_page.database_updated_externally) + self.artists_page.database_updated_externally.connect(self.dashboard_page.database_updated_externally) + # ------------------------------------------------ + self.stacked_widget.addWidget(self.dashboard_page) self.stacked_widget.addWidget(self.sync_page) self.stacked_widget.addWidget(self.downloads_page) diff --git a/ui/pages/__pycache__/artists.cpython-312.pyc b/ui/pages/__pycache__/artists.cpython-312.pyc index afc7f9d3..b4276721 100644 Binary files a/ui/pages/__pycache__/artists.cpython-312.pyc and b/ui/pages/__pycache__/artists.cpython-312.pyc differ diff --git a/ui/pages/__pycache__/sync.cpython-312.pyc b/ui/pages/__pycache__/sync.cpython-312.pyc index 582ac5a2..b3f5f387 100644 Binary files a/ui/pages/__pycache__/sync.cpython-312.pyc and b/ui/pages/__pycache__/sync.cpython-312.pyc differ diff --git a/ui/pages/artists.py b/ui/pages/artists.py index a33d0eb2..8bfe1ffb 100644 --- a/ui/pages/artists.py +++ b/ui/pages/artists.py @@ -2950,6 +2950,7 @@ class DownloadMissingAlbumTracksModal(QDialog): self.update_failed_matches_button() class ArtistsPage(QWidget): + database_updated_externally = pyqtSignal() def __init__(self, downloads_page=None, parent=None): super().__init__(parent) @@ -3069,10 +3070,9 @@ class ArtistsPage(QWidget): else: logger.info("💡 Automatic database update completed - no new content found") - # Refresh database statistics in the dashboard to update live display - if hasattr(self, 'main_window') and hasattr(self.main_window, 'dashboard_page'): - self.main_window.dashboard_page.refresh_database_statistics() - logger.info("📊 Refreshed dashboard database statistics after auto update") + # Emit the signal to notify the dashboard to refresh its statistics + self.database_updated_externally.emit() + logger.info("📊 Emitted signal to refresh dashboard database statistics after auto update") # Clean up the worker if hasattr(self, '_auto_database_worker'): diff --git a/ui/pages/dashboard.py b/ui/pages/dashboard.py index 5e50726b..07a13cf4 100644 --- a/ui/pages/dashboard.py +++ b/ui/pages/dashboard.py @@ -2294,6 +2294,7 @@ class ActivityItem(QWidget): layout.addWidget(time_label) class DashboardPage(QWidget): + database_updated_externally = pyqtSignal() def __init__(self, parent=None): super().__init__(parent) @@ -2319,7 +2320,8 @@ class DashboardPage(QWidget): self.stats_cards = {} self.setup_ui() - + self.database_updated_externally.connect(self.refresh_database_statistics) + # Initialize list to track active stats workers self._active_stats_workers = [] diff --git a/ui/pages/sync.py b/ui/pages/sync.py index 2c2976f1..39749b3d 100644 --- a/ui/pages/sync.py +++ b/ui/pages/sync.py @@ -1963,6 +1963,7 @@ class SyncOptionsPanel(QFrame): class SyncPage(QWidget): # Signals for dashboard activity tracking sync_activity = pyqtSignal(str, str, str, str) # icon, title, subtitle, time + database_updated_externally = pyqtSignal() def __init__(self, spotify_client=None, plex_client=None, soulseek_client=None, downloads_page=None, parent=None): super().__init__(parent) @@ -2080,10 +2081,9 @@ class SyncPage(QWidget): else: logger.info("💡 Automatic database update completed - no new content found") - # Refresh database statistics in the dashboard to update live display - if hasattr(self, 'main_window') and hasattr(self.main_window, 'dashboard_page'): - self.main_window.dashboard_page.refresh_database_statistics() - logger.info("📊 Refreshed dashboard database statistics after auto update") + # Emit the signal to notify the dashboard to refresh its statistics + self.database_updated_externally.emit() + logger.info("📊 Emitted signal to refresh dashboard database statistics after auto update") # Clean up the worker if hasattr(self, '_auto_database_worker'):