mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 01:29:00 +08:00
Merge remote-tracking branch 'origin/master' into CURA-6435_new_style_add_machine
This commit is contained in:
commit
7d096e5734
@ -18,6 +18,8 @@ from enum import IntEnum
|
|||||||
import os # To get the username
|
import os # To get the username
|
||||||
import gzip
|
import gzip
|
||||||
|
|
||||||
|
from cura.Settings.CuraContainerRegistry import CuraContainerRegistry
|
||||||
|
|
||||||
|
|
||||||
class AuthState(IntEnum):
|
class AuthState(IntEnum):
|
||||||
NotAuthenticated = 1
|
NotAuthenticated = 1
|
||||||
@ -319,12 +321,27 @@ class NetworkedPrinterOutputDevice(PrinterOutputDevice):
|
|||||||
self._manager.authenticationRequired.connect(self._onAuthenticationRequired)
|
self._manager.authenticationRequired.connect(self._onAuthenticationRequired)
|
||||||
|
|
||||||
if self._properties.get(b"temporary", b"false") != b"true":
|
if self._properties.get(b"temporary", b"false") != b"true":
|
||||||
CuraApplication.getInstance().getMachineManager().checkCorrectGroupName(self.getId(), self.name)
|
self._checkCorrectGroupName(self.getId(), self.name)
|
||||||
|
|
||||||
def _registerOnFinishedCallback(self, reply: QNetworkReply, on_finished: Optional[Callable[[QNetworkReply], None]]) -> None:
|
def _registerOnFinishedCallback(self, reply: QNetworkReply, on_finished: Optional[Callable[[QNetworkReply], None]]) -> None:
|
||||||
if on_finished is not None:
|
if on_finished is not None:
|
||||||
self._onFinishedCallbacks[reply.url().toString() + str(reply.operation())] = on_finished
|
self._onFinishedCallbacks[reply.url().toString() + str(reply.operation())] = on_finished
|
||||||
|
|
||||||
|
## 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) -> None:
|
||||||
|
global_container_stack = CuraApplication.getInstance().getGlobalContainerStack()
|
||||||
|
active_machine_network_name = CuraApplication.getInstance().getMachineManager().activeMachineNetworkKey()
|
||||||
|
if global_container_stack and device_id == active_machine_network_name:
|
||||||
|
# Check if the group_name is correct. If not, update all the containers connected to the same printer
|
||||||
|
if CuraApplication.getInstance().getMachineManager().activeMachineNetworkGroupName != group_name:
|
||||||
|
metadata_filter = {"um_network_key": active_machine_network_name}
|
||||||
|
containers = CuraContainerRegistry.getInstance().findContainerStacks(type="machine",
|
||||||
|
**metadata_filter)
|
||||||
|
for container in containers:
|
||||||
|
container.setMetaDataEntry("group_name", group_name)
|
||||||
|
|
||||||
def _handleOnFinished(self, reply: QNetworkReply) -> None:
|
def _handleOnFinished(self, reply: QNetworkReply) -> None:
|
||||||
# Due to garbage collection, we need to cache certain bits of post operations.
|
# Due to garbage collection, we need to cache certain bits of post operations.
|
||||||
# As we don't want to keep them around forever, delete them if we get a reply.
|
# As we don't want to keep them around forever, delete them if we get a reply.
|
||||||
|
@ -683,11 +683,6 @@ class MachineManager(QObject):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
## Check if a container is read_only
|
|
||||||
@pyqtSlot(str, result = bool)
|
|
||||||
def isReadOnly(self, container_id: str) -> bool:
|
|
||||||
return CuraContainerRegistry.getInstance().isReadOnly(container_id)
|
|
||||||
|
|
||||||
## Copy the value of the setting of the current extruder to all other extruders as well as the global container.
|
## Copy the value of the setting of the current extruder to all other extruders as well as the global container.
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def copyValueToExtruders(self, key: str) -> None:
|
def copyValueToExtruders(self, key: str) -> None:
|
||||||
@ -1065,9 +1060,6 @@ class MachineManager(QObject):
|
|||||||
def _onMaterialNameChanged(self) -> None:
|
def _onMaterialNameChanged(self) -> None:
|
||||||
self.activeMaterialChanged.emit()
|
self.activeMaterialChanged.emit()
|
||||||
|
|
||||||
def _onQualityNameChanged(self) -> None:
|
|
||||||
self.activeQualityChanged.emit()
|
|
||||||
|
|
||||||
def _getContainerChangedSignals(self) -> List[Signal]:
|
def _getContainerChangedSignals(self) -> List[Signal]:
|
||||||
if self._global_container_stack is None:
|
if self._global_container_stack is None:
|
||||||
return []
|
return []
|
||||||
@ -1463,31 +1455,6 @@ class MachineManager(QObject):
|
|||||||
if self.hasUserSettings and self._application.getPreferences().getValue("cura/active_mode") == 1:
|
if self.hasUserSettings and self._application.getPreferences().getValue("cura/active_mode") == 1:
|
||||||
self._application.discardOrKeepProfileChanges()
|
self._application.discardOrKeepProfileChanges()
|
||||||
|
|
||||||
## Find all container stacks that has the pair 'key = value' in its metadata and replaces the value with 'new_value'
|
|
||||||
def replaceContainersMetadata(self, key: str, value: str, new_value: str) -> None:
|
|
||||||
machines = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine")
|
|
||||||
for machine in machines:
|
|
||||||
if machine.getMetaDataEntry(key) == 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) -> None:
|
|
||||||
if self._global_container_stack and device_id == self.activeMachineNetworkKey():
|
|
||||||
# Check if the 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()}
|
|
||||||
containers = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine", **metadata_filter)
|
|
||||||
for container in containers:
|
|
||||||
container.setMetaDataEntry("group_name", group_name)
|
|
||||||
|
|
||||||
## This method checks if there is an instance connected to the given network_key
|
|
||||||
def existNetworkInstances(self, network_key: str) -> bool:
|
|
||||||
metadata_filter = {"um_network_key": network_key}
|
|
||||||
containers = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine", **metadata_filter)
|
|
||||||
return bool(containers)
|
|
||||||
|
|
||||||
@pyqtSlot("QVariant")
|
@pyqtSlot("QVariant")
|
||||||
def setGlobalVariant(self, container_node: "ContainerNode") -> None:
|
def setGlobalVariant(self, container_node: "ContainerNode") -> None:
|
||||||
self.blurSettings.emit()
|
self.blurSettings.emit()
|
||||||
|
@ -155,7 +155,7 @@ class WorkspaceDialog(QObject):
|
|||||||
|
|
||||||
def setNumSettingsOverriddenByQualityChanges(self, num_settings_overridden_by_quality_changes):
|
def setNumSettingsOverriddenByQualityChanges(self, num_settings_overridden_by_quality_changes):
|
||||||
self._num_settings_overridden_by_quality_changes = num_settings_overridden_by_quality_changes
|
self._num_settings_overridden_by_quality_changes = num_settings_overridden_by_quality_changes
|
||||||
self.numSettingsOverriddenByQualityChangesChanged.emit()
|
self.numSettingsOverridenByQualityChangesChanged.emit()
|
||||||
|
|
||||||
@pyqtProperty(str, notify=qualityNameChanged)
|
@pyqtProperty(str, notify=qualityNameChanged)
|
||||||
def qualityName(self):
|
def qualityName(self):
|
||||||
|
@ -177,7 +177,6 @@ Cura.ExpandableComponent
|
|||||||
height: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height
|
height: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height
|
||||||
width: parent.width
|
width: parent.width
|
||||||
visible: !UM.SimulationView.compatibilityMode
|
visible: !UM.SimulationView.compatibilityMode
|
||||||
enabled: index < 4
|
|
||||||
|
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@ UM.Dialog
|
|||||||
minimumWidth: 450 * screenScaleFactor
|
minimumWidth: 450 * screenScaleFactor
|
||||||
minimumHeight: 150 * screenScaleFactor
|
minimumHeight: 150 * screenScaleFactor
|
||||||
|
|
||||||
modality: UM.Application.platform == "linux" ? Qt.NonModal : Qt.WindowModal
|
modality: Qt.WindowModal
|
||||||
|
|
||||||
Column
|
Column
|
||||||
{
|
{
|
||||||
|
@ -115,7 +115,7 @@ class DiscoverUM3Action(MachineAction):
|
|||||||
previous_connect_group_name = meta_data["group_name"]
|
previous_connect_group_name = meta_data["group_name"]
|
||||||
global_container_stack.setMetaDataEntry("group_name", group_name)
|
global_container_stack.setMetaDataEntry("group_name", group_name)
|
||||||
# Find all the places where there is the same group name and change it accordingly
|
# Find all the places where there is the same group name and change it accordingly
|
||||||
CuraApplication.getInstance().getMachineManager().replaceContainersMetadata(key = "group_name", value = previous_connect_group_name, new_value = group_name)
|
self._replaceContainersMetadata(key = "group_name", value = previous_connect_group_name, new_value = group_name)
|
||||||
else:
|
else:
|
||||||
global_container_stack.setMetaDataEntry("group_name", group_name)
|
global_container_stack.setMetaDataEntry("group_name", group_name)
|
||||||
# Set the default value for "hidden", which is used when you have a group with multiple types of printers
|
# Set the default value for "hidden", which is used when you have a group with multiple types of printers
|
||||||
@ -125,6 +125,13 @@ class DiscoverUM3Action(MachineAction):
|
|||||||
# Ensure that the connection states are refreshed.
|
# Ensure that the connection states are refreshed.
|
||||||
self._network_plugin.refreshConnections()
|
self._network_plugin.refreshConnections()
|
||||||
|
|
||||||
|
## Find all container stacks that has the pair 'key = value' in its metadata and replaces the value with 'new_value'
|
||||||
|
def _replaceContainersMetadata(self, key: str, value: str, new_value: str) -> None:
|
||||||
|
machines = CuraContainerRegistry.getInstance().findContainerStacks(type="machine")
|
||||||
|
for machine in machines:
|
||||||
|
if machine.getMetaDataEntry(key) == value:
|
||||||
|
machine.setMetaDataEntry(key, new_value)
|
||||||
|
|
||||||
# Associates the currently active machine with the given printer device. The network connection information will be
|
# Associates the currently active machine with the given printer device. The network connection information will be
|
||||||
# stored into the metadata of the currently active machine.
|
# stored into the metadata of the currently active machine.
|
||||||
@pyqtSlot(QObject)
|
@pyqtSlot(QObject)
|
||||||
@ -150,7 +157,9 @@ class DiscoverUM3Action(MachineAction):
|
|||||||
|
|
||||||
@pyqtSlot(str, result = bool)
|
@pyqtSlot(str, result = bool)
|
||||||
def existsKey(self, key: str) -> bool:
|
def existsKey(self, key: str) -> bool:
|
||||||
return CuraApplication.getInstance().getMachineManager().existNetworkInstances(network_key = key)
|
metadata_filter = {"um_network_key": key}
|
||||||
|
containers = CuraContainerRegistry.getInstance().findContainerStacks(type="machine", **metadata_filter)
|
||||||
|
return bool(containers)
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def loadConfigurationFromPrinter(self) -> None:
|
def loadConfigurationFromPrinter(self) -> None:
|
||||||
|
@ -282,7 +282,7 @@ Item
|
|||||||
{
|
{
|
||||||
id: groupObjectsAction
|
id: groupObjectsAction
|
||||||
text: catalog.i18nc("@action:inmenu menubar:edit","&Group Models");
|
text: catalog.i18nc("@action:inmenu menubar:edit","&Group Models");
|
||||||
enabled: UM.Scene.numObjectsSelected > 1 ? true: false
|
enabled: UM.Selection.selectionCount > 1 ? true: false
|
||||||
iconName: "object-group"
|
iconName: "object-group"
|
||||||
shortcut: "Ctrl+G";
|
shortcut: "Ctrl+G";
|
||||||
onTriggered: CuraApplication.groupSelected();
|
onTriggered: CuraApplication.groupSelected();
|
||||||
@ -302,7 +302,7 @@ Item
|
|||||||
{
|
{
|
||||||
id: unGroupObjectsAction
|
id: unGroupObjectsAction
|
||||||
text: catalog.i18nc("@action:inmenu menubar:edit","Ungroup Models");
|
text: catalog.i18nc("@action:inmenu menubar:edit","Ungroup Models");
|
||||||
enabled: UM.Scene.isGroupSelected
|
enabled: UM.Selection.isGroupSelected
|
||||||
iconName: "object-ungroup"
|
iconName: "object-ungroup"
|
||||||
shortcut: "Ctrl+Shift+G";
|
shortcut: "Ctrl+Shift+G";
|
||||||
onTriggered: CuraApplication.ungroupSelected();
|
onTriggered: CuraApplication.ungroupSelected();
|
||||||
@ -312,7 +312,7 @@ Item
|
|||||||
{
|
{
|
||||||
id: mergeObjectsAction
|
id: mergeObjectsAction
|
||||||
text: catalog.i18nc("@action:inmenu menubar:edit","&Merge Models");
|
text: catalog.i18nc("@action:inmenu menubar:edit","&Merge Models");
|
||||||
enabled: UM.Scene.numObjectsSelected > 1 ? true: false
|
enabled: UM.Selection.selectionCount > 1 ? true: false
|
||||||
iconName: "merge";
|
iconName: "merge";
|
||||||
shortcut: "Ctrl+Alt+G";
|
shortcut: "Ctrl+Alt+G";
|
||||||
onTriggered: CuraApplication.mergeSelected();
|
onTriggered: CuraApplication.mergeSelected();
|
||||||
|
@ -563,7 +563,7 @@ UM.MainWindow
|
|||||||
|
|
||||||
//: File open dialog title
|
//: File open dialog title
|
||||||
title: catalog.i18nc("@title:window","Open file(s)")
|
title: catalog.i18nc("@title:window","Open file(s)")
|
||||||
modality: UM.Application.platform == "linux" ? Qt.NonModal : Qt.WindowModal;
|
modality: Qt.WindowModal
|
||||||
selectMultiple: true
|
selectMultiple: true
|
||||||
nameFilters: UM.MeshFileHandler.supportedReadFileTypes;
|
nameFilters: UM.MeshFileHandler.supportedReadFileTypes;
|
||||||
folder: CuraApplication.getDefaultPath("dialog_load_path")
|
folder: CuraApplication.getDefaultPath("dialog_load_path")
|
||||||
|
@ -26,7 +26,7 @@ UM.Dialog
|
|||||||
minimumHeight: maximumHeight
|
minimumHeight: maximumHeight
|
||||||
minimumWidth: maximumWidth
|
minimumWidth: maximumWidth
|
||||||
|
|
||||||
modality: UM.Application.platform == "linux" ? Qt.NonModal : Qt.WindowModal
|
modality: Qt.WindowModal
|
||||||
|
|
||||||
property var fileUrl
|
property var fileUrl
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ UM.Dialog
|
|||||||
minimumHeight: height
|
minimumHeight: height
|
||||||
minimumWidth: width
|
minimumWidth: width
|
||||||
|
|
||||||
modality: UM.Application.platform == "linux" ? Qt.NonModal : Qt.WindowModal;
|
modality: Qt.WindowModal
|
||||||
|
|
||||||
property var fileUrls: []
|
property var fileUrls: []
|
||||||
property int spacerHeight: 10 * screenScaleFactor
|
property int spacerHeight: 10 * screenScaleFactor
|
||||||
|
Loading…
x
Reference in New Issue
Block a user