mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Revert "Merge branch '4.7' of github.com:Ultimaker/Cura into 4.7"
This reverts commit7f47f12bf0
, reversing changes made todd42c87da7
.
This commit is contained in:
parent
2fe9ee2cf2
commit
28f4d8513d
13 changed files with 149 additions and 274 deletions
|
@ -1,6 +1,5 @@
|
|||
# Copyright (c) 2020 Ultimaker B.V.
|
||||
# Copyright (c) 2019 Ultimaker B.V.
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import os
|
||||
from typing import Dict, List, Optional, Set
|
||||
|
||||
|
@ -38,7 +37,7 @@ class CloudOutputDeviceManager:
|
|||
SYNC_SERVICE_NAME = "CloudOutputDeviceManager"
|
||||
|
||||
# The translation catalog for this device.
|
||||
i18n_catalog = i18nCatalog("cura")
|
||||
I18N_CATALOG = i18nCatalog("cura")
|
||||
|
||||
# Signal emitted when the list of discovered devices changed.
|
||||
discoveredDevicesChanged = Signal()
|
||||
|
@ -222,7 +221,7 @@ class CloudOutputDeviceManager:
|
|||
)
|
||||
|
||||
message = Message(
|
||||
title = self.i18n_catalog.i18ncp(
|
||||
title = self.I18N_CATALOG.i18ncp(
|
||||
"info:status",
|
||||
"New printer detected from your Ultimaker account",
|
||||
"New printers detected from your Ultimaker account",
|
||||
|
@ -235,7 +234,11 @@ class CloudOutputDeviceManager:
|
|||
message.show()
|
||||
|
||||
for idx, device in enumerate(new_devices):
|
||||
message_text = self.i18n_catalog.i18nc("info:status Filled in with printer name and printer model.", "Adding printer {name} ({model}) from your account").format(name = device.name, model = device.printerTypeName)
|
||||
message_text = self.I18N_CATALOG.i18nc(
|
||||
"info:status", "Adding printer {} ({}) from your account",
|
||||
device.name,
|
||||
device.printerTypeName
|
||||
)
|
||||
message.setText(message_text)
|
||||
if len(new_devices) > 1:
|
||||
message.setProgress((idx / len(new_devices)) * 100)
|
||||
|
@ -252,12 +255,16 @@ class CloudOutputDeviceManager:
|
|||
if len(new_devices) > max_disp_devices:
|
||||
num_hidden = len(new_devices) - max_disp_devices
|
||||
device_name_list = ["<li>{} ({})</li>".format(device.name, device.printerTypeName) for device in new_devices[0:max_disp_devices]]
|
||||
device_name_list.append("<li>" + self.i18n_catalog.i18ncp("info:{0} gets replaced by a number of printers", "... and {0} other", "... and {0} others", num_hidden) + "</li>")
|
||||
device_name_list.append(self.I18N_CATALOG.i18nc("info:hidden list items", "<li>... and {} others</li>", num_hidden))
|
||||
device_names = "".join(device_name_list)
|
||||
else:
|
||||
device_names = "".join(["<li>{} ({})</li>".format(device.name, device.printerTypeName) for device in new_devices])
|
||||
|
||||
message_text = self.i18n_catalog.i18nc("info:status", "Printers added from Digital Factory:") + "<ul>" + device_names + "</ul>"
|
||||
message_text = self.I18N_CATALOG.i18nc(
|
||||
"info:status",
|
||||
"Printers added from Digital Factory:<ul>{}</ul>",
|
||||
device_names
|
||||
)
|
||||
message.setText(message_text)
|
||||
|
||||
def _updateOutdatedMachine(self, outdated_machine: GlobalStack, new_cloud_output_device: CloudOutputDevice) -> None:
|
||||
|
@ -311,7 +318,7 @@ class CloudOutputDeviceManager:
|
|||
|
||||
# Generate message
|
||||
self._removed_printers_message = Message(
|
||||
title = self.i18n_catalog.i18ncp(
|
||||
title = self.I18N_CATALOG.i18ncp(
|
||||
"info:status",
|
||||
"A cloud connection is not available for a printer",
|
||||
"A cloud connection is not available for some printers",
|
||||
|
@ -319,27 +326,26 @@ class CloudOutputDeviceManager:
|
|||
)
|
||||
)
|
||||
device_names = "".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",
|
||||
"This printer is not linked to the Digital Factory:",
|
||||
"These printers are not linked to the Digital Factory:",
|
||||
len(self.reported_device_ids)
|
||||
)
|
||||
message_text += "<br/><ul>{}</ul><br/>".format(device_names)
|
||||
digital_factory_string = self.i18n_catalog.i18nc("info:name", "Ultimaker Digital Factory")
|
||||
|
||||
message_text += self.i18n_catalog.i18nc(
|
||||
message_text += self.I18N_CATALOG.i18nc(
|
||||
"info:status",
|
||||
"To establish a connection, please visit the {website_link}".format(website_link = "<a href='https://digitalfactory.ultimaker.com/'>{}</a>.".format(digital_factory_string))
|
||||
"<ul>{}</ul>To establish a connection, please visit the "
|
||||
"<a href='https://mycloud.ultimaker.com/'>Ultimaker Digital Factory</a>.",
|
||||
device_names
|
||||
)
|
||||
self._removed_printers_message.setText(message_text)
|
||||
self._removed_printers_message.addAction("keep_printer_configurations_action",
|
||||
name = self.i18n_catalog.i18nc("@action:button", "Keep printer configurations"),
|
||||
name = self.I18N_CATALOG.i18nc("@action:button", "Keep printer configurations"),
|
||||
icon = "",
|
||||
description = "Keep cloud printers in Ultimaker Cura when not connected to your account.",
|
||||
button_align = Message.ActionButtonAlignment.ALIGN_RIGHT)
|
||||
self._removed_printers_message.addAction("remove_printers_action",
|
||||
name = self.i18n_catalog.i18nc("@action:button", "Remove printers"),
|
||||
name = self.I18N_CATALOG.i18nc("@action:button", "Remove printers"),
|
||||
icon = "",
|
||||
description = "Remove cloud printer(s) which aren't linked to your account.",
|
||||
button_style = Message.ActionButtonStyle.SECONDARY,
|
||||
|
@ -416,12 +422,13 @@ class CloudOutputDeviceManager:
|
|||
machine.setMetaDataEntry(self.META_HOST_GUID, device.clusterData.host_guid)
|
||||
machine.setMetaDataEntry("group_name", device.name)
|
||||
machine.setMetaDataEntry("group_size", device.clusterSize)
|
||||
digital_factory_string = self.i18n_catalog.i18nc("info:name", "Ultimaker Digital Factory")
|
||||
digital_factory_link = "<a href='https://digitalfactory.ultimaker.com/'>{digital_factory_string}</a>".format(digital_factory_string = digital_factory_string)
|
||||
removal_warning_string = self.i18n_catalog.i18nc("@message {printer_name} is replaced with the name of the printer", "{printer_name} will be removed until the next account sync.").format(printer_name = device.name) \
|
||||
+ "<br>" + self.i18n_catalog.i18nc("@message {printer_name} is replaced with the name of the printer", "To remove {printer_name} permanently, visit {digital_factory_link}").format(printer_name = device.name, digital_factory_link = digital_factory_link) \
|
||||
+ "<br><br>" + self.i18n_catalog.i18nc("@message {printer_name} is replaced with the name of the printer", "Are you sure you want to remove {printer_name} temporarily?").format(printer_name = device.name)
|
||||
machine.setMetaDataEntry("removal_warning", removal_warning_string)
|
||||
machine.setMetaDataEntry("removal_warning", self.I18N_CATALOG.i18nc(
|
||||
"@label ({} is printer name)",
|
||||
"{} will be removed until the next account sync. <br> To remove {} permanently, "
|
||||
"visit <a href='https://mycloud.ultimaker.com/'>Ultimaker Digital Factory</a>. "
|
||||
"<br><br>Are you sure you want to remove {} temporarily?",
|
||||
device.name, device.name, device.name
|
||||
))
|
||||
machine.addConfiguredConnectionType(device.connectionType.value)
|
||||
|
||||
def _connectToOutputDevice(self, device: CloudOutputDevice, machine: GlobalStack) -> None:
|
||||
|
@ -457,15 +464,10 @@ class CloudOutputDeviceManager:
|
|||
remove_printers_ids = {self._um_cloud_printers[i].getId() for i in self.reported_device_ids}
|
||||
all_ids = {m.getId() for m in CuraApplication.getInstance().getContainerRegistry().findContainerStacks(type = "machine")}
|
||||
|
||||
question_title = self.i18n_catalog.i18nc("@title:window", "Remove printers?")
|
||||
question_content = self.i18n_catalog.i18ncp(
|
||||
"@label",
|
||||
"You are about to remove {num_printers} printer from Cura. This action cannot be undone.\nAre you sure you want to continue?",
|
||||
"You are about to remove {num_printers} printers from Cura. This action cannot be undone.\nAre you sure you want to continue?",
|
||||
len(remove_printers_ids)
|
||||
).format(num_printers = len(remove_printers_ids))
|
||||
question_title = self.I18N_CATALOG.i18nc("@title:window", "Remove printers?")
|
||||
question_content = self.I18N_CATALOG.i18nc("@label", "You are about to remove {} printer(s) from Cura. This action cannot be undone. \nAre you sure you want to continue?".format(len(remove_printers_ids)))
|
||||
if remove_printers_ids == all_ids:
|
||||
question_content = self.i18n_catalog.i18nc("@label", "You are about to remove all printers from Cura. This action cannot be undone.\nAre you sure you want to continue?")
|
||||
question_content = self.I18N_CATALOG.i18nc("@label", "You are about to remove all printers from Cura. This action cannot be undone. \nAre you sure you want to continue?")
|
||||
result = QMessageBox.question(None, question_title, question_content)
|
||||
if result == QMessageBox.No:
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue