From b0b0c3c1c478d653df1f4c4b13db58b7755dd04a Mon Sep 17 00:00:00 2001 From: SimplifiedPrivacy Date: Thu, 29 Oct 2026 12:51:14 -0400 Subject: [PATCH] Sync screen goes through actions module to core via plumbing --- gui/v2/ui/pages/sync_screen.py | 45 ++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/gui/v2/ui/pages/sync_screen.py b/gui/v2/ui/pages/sync_screen.py index 49d52e8..a1cf827 100755 --- a/gui/v2/ui/pages/sync_screen.py +++ b/gui/v2/ui/pages/sync_screen.py @@ -64,6 +64,30 @@ class SyncScreen(Page): def go_back(self): self.custom_window.navigator.navigate("menu") + @mainthread + def post_sync(self, result: Result): + print("Sync coming back to the mainthread UI.") + + if not result.valid: + self.update_status('Sync failed. Please try again later.') + return + + self.perform_update_check() + + self.update_status.update_status('Sync complete') + + update_available = ClientController.can_be_updated() + + if update_available: + menu_page = self.find_menu_page() + if menu_page is not None: + menu_page.on_update_check_finished() + + self.button_go.setEnabled(True) + self.button_back.setEnabled(True) + self.custom_window.navigator.navigate("protocol") + + def perform_sync(self): if self.connection_manager.is_synced(): self.button_go.setVisible(True) @@ -76,15 +100,20 @@ class SyncScreen(Page): self.button_go.setEnabled(False) self.button_back.setEnabled(False) self.update_status.update_status('Sync in progress...') - if self.main_window.get_current_connection() == 'tor': - self.worker_thread = WorkerThread('SYNC_TOR') - else: - self.worker_thread = WorkerThread('SYNC') - self.worker_thread.sync_output.connect(self.update_output) - self.worker_thread.sync_error.connect( - self.update_status.update_status) - self.worker_thread.start() + + sync_now(ui_caller=self.post_sync) + + + # if self.main_window.get_current_connection() == 'tor': + # self.worker_thread = WorkerThread('SYNC_TOR') + # else: + # self.worker_thread = WorkerThread('SYNC') + + # self.worker_thread.sync_output.connect(self.update_output) + # self.worker_thread.sync_error.connect( + # self.update_status.update_status) + # self.worker_thread.start() def update_output(self, available_locations, available_browsers, status, is_tor, locations, all_browsers): if isinstance(all_browsers, bool) and not all_browsers: