From 27b733fe3db6541626c7b0d75034ddca08b9eb88 Mon Sep 17 00:00:00 2001 From: Kostas Karmas Date: Fri, 5 Jun 2020 11:39:26 +0200 Subject: [PATCH] Add "Keep printer configurations" button in removed printers message Since keeping the printers as local ones is the default action, this button behaves the same way as the "X" button, hiding the message. CURA-7455 --- .../src/Cloud/CloudOutputDeviceManager.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py index 2b3e6e3a60..b74fa236c1 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py @@ -290,6 +290,12 @@ class CloudOutputDeviceManager: device_names ) removed_printers_message.setText(message_text) + removed_printers_message.addAction("keep_printer_configurations_action", + name = self.I18N_CATALOG.i18nc("@action:button", "Keep printer configurations"), + icon = "", + description = "Keep the configuration of the cloud printer(s) synced with Cura which are not linked to your account.", + button_align = Message.ActionButtonAlignment.ALIGN_RIGHT) + removed_printers_message.actionTriggered.connect(self._onRemovedPrintersMessageActionTriggered) # Remove the output device from the printers for device_id in removed_device_ids: @@ -391,3 +397,8 @@ class CloudOutputDeviceManager: container_cluster_id = container.getMetaDataEntry(self.META_CLUSTER_ID, None) if container_cluster_id in self._remote_clusters.keys(): del self._remote_clusters[container_cluster_id] + + @staticmethod + def _onRemovedPrintersMessageActionTriggered(removed_printers_message: Message, action: str) -> None: + if action == "keep_printer_configurations_action": + removed_printers_message.hide()