Merge branch 'master' into CURA-7438_Show_cloud_connection_not_available_printer_removed_from_account

This commit is contained in:
Kostas Karmas 2020-06-03 17:32:04 +02:00
commit 07bbee7cb9
4 changed files with 19 additions and 3 deletions

View file

@ -9,6 +9,7 @@ from PyQt5.QtNetwork import QNetworkReply
from UM import i18nCatalog from UM import i18nCatalog
from UM.Logger import Logger # To log errors talking to the API. from UM.Logger import Logger # To log errors talking to the API.
from UM.Message import Message from UM.Message import Message
from UM.Settings.Interfaces import ContainerInterface
from UM.Signal import Signal from UM.Signal import Signal
from cura.API import Account from cura.API import Account
from cura.API.Account import SyncState from cura.API.Account import SyncState
@ -49,6 +50,8 @@ class CloudOutputDeviceManager:
self._syncing = False self._syncing = False
CuraApplication.getInstance().getContainerRegistry().containerRemoved.connect(self._printerRemoved)
def start(self): def start(self):
"""Starts running the cloud output device manager, thus periodically requesting cloud data.""" """Starts running the cloud output device manager, thus periodically requesting cloud data."""
@ -287,3 +290,16 @@ class CloudOutputDeviceManager:
output_device_manager = CuraApplication.getInstance().getOutputDeviceManager() output_device_manager = CuraApplication.getInstance().getOutputDeviceManager()
if device.key not in output_device_manager.getOutputDeviceIds(): if device.key not in output_device_manager.getOutputDeviceIds():
output_device_manager.addOutputDevice(device) output_device_manager.addOutputDevice(device)
def _printerRemoved(self, container: ContainerInterface) -> None:
"""
Callback connected to the containerRemoved signal. Invoked when a cloud printer is removed from Cura to remove
the printer's reference from the _remote_clusters.
:param container: The ContainerInterface passed to this function whenever the ContainerRemoved signal is emitted
:return: None
"""
if isinstance(container, GlobalStack):
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]

View file

@ -18,7 +18,7 @@ class AutoDetectBaudJob(Job):
def __init__(self, serial_port: int) -> None: def __init__(self, serial_port: int) -> None:
super().__init__() super().__init__()
self._serial_port = serial_port self._serial_port = serial_port
self._all_baud_rates = [115200, 250000, 500000, 230400, 57600, 38400, 19200, 9600] self._all_baud_rates = [115200, 250000, 500000, 230400, 76800, 57600, 38400, 19200, 9600]
def run(self) -> None: def run(self) -> None:
Logger.log("d", "Auto detect baud rate started.") Logger.log("d", "Auto detect baud rate started.")

View file

@ -58,7 +58,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
self._baud_rate = baud_rate self._baud_rate = baud_rate
self._all_baud_rates = [115200, 250000, 500000, 230400, 57600, 38400, 19200, 9600] self._all_baud_rates = [115200, 250000, 500000, 230400, 76800, 57600, 38400, 19200, 9600]
# Instead of using a timer, we really need the update to be as a thread, as reading from serial can block. # Instead of using a timer, we really need the update to be as a thread, as reading from serial can block.
self._update_thread = Thread(target = self._update, daemon = True, name = "USBPrinterUpdate") self._update_thread = Thread(target = self._update, daemon = True, name = "USBPrinterUpdate")

View file

@ -4219,7 +4219,7 @@
"default_value": 1, "default_value": 1,
"minimum_value": "0", "minimum_value": "0",
"minimum_value_warning": "1 if support_pattern == 'concentric' else 0", "minimum_value_warning": "1 if support_pattern == 'concentric' else 0",
"maximum_value_warning": "3", "maximum_value_warning": "0 if (support_skip_some_zags and support_pattern == 'zigzag') else 3",
"type": "int", "type": "int",
"value": "1 if support_tree_enable else (1 if (support_pattern == 'grid' or support_pattern == 'triangles' or support_pattern == 'concentric') else 0)", "value": "1 if support_tree_enable else (1 if (support_pattern == 'grid' or support_pattern == 'triangles' or support_pattern == 'concentric') else 0)",
"enabled": "support_enable or support_tree_enable", "enabled": "support_enable or support_tree_enable",