Show printer group and which machine to update in project loading

CURA-5125
This commit is contained in:
Lipu Fei 2018-03-20 16:19:40 +01:00
parent 363166bbb7
commit 6d21a6bddb
3 changed files with 38 additions and 2 deletions

View file

@ -358,8 +358,10 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
machine_name = self._getMachineNameFromSerializedStack(serialized)
stacks = self._container_registry.findContainerStacks(name = machine_name, type = "machine")
self._is_same_machine_type = True
existing_global_stack = None
if stacks:
global_stack = stacks[0]
existing_global_stack = global_stack
containers_found_dict["machine"] = True
# Check if there are any changes at all in any of the container stacks.
id_list = self._getContainerIdListFromSerialized(serialized)
@ -495,8 +497,16 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
if machine_conflict and not self._is_same_machine_type:
machine_conflict = False
is_printer_group = False
if machine_conflict:
group_name = existing_global_stack.getMetaDataEntry("connect_group_name")
if group_name is not None:
is_printer_group = True
machine_name = group_name
# Show the dialog, informing the user what is about to happen.
self._dialog.setMachineConflict(machine_conflict)
self._dialog.setIsPrinterGroup(is_printer_group)
self._dialog.setQualityChangesConflict(quality_changes_conflict)
self._dialog.setMaterialConflict(material_conflict)
self._dialog.setHasVisibleSettingsField(has_visible_settings_string)

View file

@ -49,6 +49,7 @@ class WorkspaceDialog(QObject):
self._material_labels = []
self._extruders = []
self._objects_on_plate = False
self._is_printer_group = False
machineConflictChanged = pyqtSignal()
qualityChangesConflictChanged = pyqtSignal()
@ -66,6 +67,16 @@ class WorkspaceDialog(QObject):
machineTypeChanged = pyqtSignal()
variantTypeChanged = pyqtSignal()
extrudersChanged = pyqtSignal()
isPrinterGroupChanged = pyqtSignal()
@pyqtProperty(bool, notify = isPrinterGroupChanged)
def isPrinterGroup(self) -> bool:
return self._is_printer_group
def setIsPrinterGroup(self, value: bool):
if value != self._is_printer_group:
self._is_printer_group = value
self.isPrinterGroupChanged.emit()
@pyqtProperty(str, notify=variantTypeChanged)
def variantType(self):

View file

@ -108,7 +108,22 @@ UM.Dialog
text: catalog.i18nc("@info:tooltip", "How should the conflict in the machine be resolved?")
ComboBox
{
model: resolveStrategiesModel
model: ListModel
{
Component.onCompleted:
{
append({"key": "override", "label": catalog.i18nc("@action:ComboBox option", "Update") + " " + manager.machineName});
append({"key": "new", "label": catalog.i18nc("@action:ComboBox option", "Create new")});
}
}
Connections
{
target: manager
onMachineNameChanged:
{
machineResolveComboBox.model.get(0).label = catalog.i18nc("@action:ComboBox option", "Update") + " " + manager.machineName;
}
}
textRole: "label"
id: machineResolveComboBox
width: parent.width
@ -141,7 +156,7 @@ UM.Dialog
height: childrenRect.height
Label
{
text: catalog.i18nc("@action:label", "Name")
text: catalog.i18nc("@action:label", manager.isPrinterGroup ? "Printer Group" : "Printer Name")
width: (parent.width / 3) | 0
}
Label