Inform the Cloud page about new cloud printers

Properly close the welcome screen if the user has signed in and has
cloud printers linked to his/her account. If he doesn't have any, move
to the next page of the welcome wizard.

CURA-7019
This commit is contained in:
Kostas Karmas 2020-04-23 09:59:32 +02:00
parent 1262d1f641
commit 1602b71841
3 changed files with 19 additions and 12 deletions

View file

@ -100,13 +100,6 @@ class CloudOutputDeviceManager:
new_clusters = []
online_clusters = {c.cluster_id: c for c in clusters if c.is_online} # type: Dict[str, CloudClusterResponse]
# If the user signs in from the welcome dialog, then we will search for cloud printers and if any of them are
# found, the welcome screen will close. This way we avoid prompting the user to add printers if he/she already
# has cloud printers
welcome_pages_model = CuraApplication.getInstance().getWelcomePagesModel()
cloud_page_idx = welcome_pages_model.getPageIndexById("cloud") + 1
if welcome_pages_model.currentPageIndex == cloud_page_idx and len(online_clusters) > 0:
welcome_pages_model.atEnd()
for device_id, cluster_data in online_clusters.items():
if device_id not in self._remote_clusters:
new_clusters.append(cluster_data)
@ -115,6 +108,10 @@ class CloudOutputDeviceManager:
self._onDevicesDiscovered(new_clusters)
# Inform whether new cloud printers have been detected. If they have, the welcome wizard can close.
self._account._new_cloud_printers_detected = len(new_clusters) > 0
self._account.cloudPrintersDetectedChanged.emit(len(new_clusters) > 0)
removed_device_keys = set(self._remote_clusters.keys()) - set(online_clusters.keys())
for device_id in removed_device_keys:
self._onDiscoveredDeviceRemoved(device_id)