Sync screen goes through actions module to core via plumbing

This commit is contained in:
SimplifiedPrivacy 2026-10-29 12:51:14 -04:00
parent 798821cf2a
commit b0b0c3c1c4

View file

@ -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: