mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 15:07:28 -06:00
CURA-4870 Move the checkCorrectGroupName to the machine manager, where
it must belong to.
This commit is contained in:
parent
1e9a1f2668
commit
dcb68bb33e
2 changed files with 15 additions and 14 deletions
|
@ -4,6 +4,7 @@
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
from UM.Settings.ContainerRegistry import ContainerRegistry
|
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||||
|
from cura.CuraApplication import CuraApplication
|
||||||
|
|
||||||
from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState
|
from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState
|
||||||
|
|
||||||
|
@ -255,20 +256,8 @@ class NetworkedPrinterOutputDevice(PrinterOutputDevice):
|
||||||
self._last_manager_create_time = time()
|
self._last_manager_create_time = time()
|
||||||
self._manager.authenticationRequired.connect(self._onAuthenticationRequired)
|
self._manager.authenticationRequired.connect(self._onAuthenticationRequired)
|
||||||
|
|
||||||
self._checkCorrectGroupName()
|
machine_manager = CuraApplication.getInstance().getMachineManager()
|
||||||
|
machine_manager.checkCorrectGroupName(self.getId(), self.name)
|
||||||
## This method checks if the name of the group stored in the definition container is correct.
|
|
||||||
# After updating from 3.2 to 3.3 some group names may be temporary. If there is a mismatch in the name of the group
|
|
||||||
# then all the container stacks are updated, both the current and the hidden ones.
|
|
||||||
def _checkCorrectGroupName(self):
|
|
||||||
global_container_stack = Application.getInstance().getGlobalContainerStack()
|
|
||||||
if global_container_stack and self.getId() == global_container_stack.getMetaDataEntry("um_network_key"):
|
|
||||||
# Check if the connect_group_name is correct. If not, update all the containers connected to the same printer
|
|
||||||
if global_container_stack.getMetaDataEntry("connect_group_name") != self.name:
|
|
||||||
metadata_filter = {"um_network_key": global_container_stack.getMetaDataEntry("um_network_key")}
|
|
||||||
hidden_containers = ContainerRegistry.getInstance().findContainerStacks(type = "machine", **metadata_filter)
|
|
||||||
for container in hidden_containers:
|
|
||||||
container.setMetaDataEntry("connect_group_name", self.name)
|
|
||||||
|
|
||||||
def _registerOnFinishedCallback(self, reply: QNetworkReply, onFinished: Optional[Callable[[Any, QNetworkReply], None]]) -> None:
|
def _registerOnFinishedCallback(self, reply: QNetworkReply, onFinished: Optional[Callable[[Any, QNetworkReply], None]]) -> None:
|
||||||
if onFinished is not None:
|
if onFinished is not None:
|
||||||
|
|
|
@ -1201,6 +1201,18 @@ class MachineManager(QObject):
|
||||||
if machine.getMetaDataEntry(key) == value:
|
if machine.getMetaDataEntry(key) == value:
|
||||||
machine.setMetaDataEntry(key, new_value)
|
machine.setMetaDataEntry(key, new_value)
|
||||||
|
|
||||||
|
## This method checks if the name of the group stored in the definition container is correct.
|
||||||
|
# After updating from 3.2 to 3.3 some group names may be temporary. If there is a mismatch in the name of the group
|
||||||
|
# then all the container stacks are updated, both the current and the hidden ones.
|
||||||
|
def checkCorrectGroupName(self, device_id: str, group_name: str):
|
||||||
|
if self._global_container_stack and device_id == self.activeMachineNetworkKey:
|
||||||
|
# Check if the connect_group_name is correct. If not, update all the containers connected to the same printer
|
||||||
|
if self.activeMachineNetworkGroupName != group_name:
|
||||||
|
metadata_filter = {"um_network_key": self.activeMachineNetworkKey}
|
||||||
|
hidden_containers = ContainerRegistry.getInstance().findContainerStacks(type = "machine", **metadata_filter)
|
||||||
|
for container in hidden_containers:
|
||||||
|
container.setMetaDataEntry("connect_group_name", group_name)
|
||||||
|
|
||||||
@pyqtSlot("QVariant")
|
@pyqtSlot("QVariant")
|
||||||
def setGlobalVariant(self, container_node):
|
def setGlobalVariant(self, container_node):
|
||||||
self.blurSettings.emit()
|
self.blurSettings.emit()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue