Merge branch 'CURA-7438_Show_cloud_connection_not_available_printer_removed_from_account' into CURA-7455_Keep_printer_configurations_when_cloud_printer_removed_from_account

This commit is contained in:
Kostas Karmas 2020-06-05 11:28:35 +02:00
commit da49d49d3c

View File

@ -260,8 +260,10 @@ class CloudOutputDeviceManager:
for device_id in removed_device_ids: for device_id in removed_device_ids:
if not parseBool(self._um_cloud_printers[device_id].getMetaDataEntry(self.META_LINKED_TO_ACCOUNT, "true")): if not parseBool(self._um_cloud_printers[device_id].getMetaDataEntry(self.META_LINKED_TO_ACCOUNT, "true")):
ignored_device_ids.add(device_id) ignored_device_ids.add(device_id)
report_device_ids = removed_device_ids - ignored_device_ids # Keep the reported_device_ids list in a class variable, so that the message button actions can access it and
if len(report_device_ids) == 0: # take the necessary steps to fulfill their purpose.
self.reported_device_ids = removed_device_ids - ignored_device_ids
if len(self.reported_device_ids) == 0:
return return
# Generate message # Generate message
@ -270,16 +272,16 @@ class CloudOutputDeviceManager:
"info:status", "info:status",
"Cloud connection is not available for a printer", "Cloud connection is not available for a printer",
"Cloud connection is not available for some printers", "Cloud connection is not available for some printers",
len(report_device_ids) len(self.reported_device_ids)
), ),
lifetime = 0 lifetime = 0
) )
device_names = "\n".join(["<li>{} ({})</li>".format(self._um_cloud_printers[device].name, self._um_cloud_printers[device].definition.name) for device in report_device_ids]) device_names = "\n".join(["<li>{} ({})</li>".format(self._um_cloud_printers[device].name, self._um_cloud_printers[device].definition.name) for device in self.reported_device_ids])
message_text = self.I18N_CATALOG.i18ncp( message_text = self.I18N_CATALOG.i18ncp(
"info:status", "info:status",
"The following cloud printer is not linked to your account:\n", "The following cloud printer is not linked to your account:\n",
"The following cloud printers are not linked to your account:\n", "The following cloud printers are not linked to your account:\n",
len(report_device_ids) len(self.reported_device_ids)
) )
message_text += self.I18N_CATALOG.i18nc( message_text += self.I18N_CATALOG.i18nc(
"info:status", "info:status",