mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Change variable names (available -> updatable)
CURA-7609
This commit is contained in:
parent
98cc87d1cf
commit
52ea3e8fcc
3 changed files with 27 additions and 31 deletions
|
@ -133,12 +133,10 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||
# In Cura 2.5 and 2.6, the empty profiles used to have those long names
|
||||
self._old_empty_profile_id_dict = {"empty_%s" % k: "empty" for k in ["material", "variant"]}
|
||||
|
||||
# self._is_same_machine_type = False
|
||||
self._old_new_materials = {} # type: Dict[str, str]
|
||||
self._machine_info = None
|
||||
|
||||
def _clearState(self):
|
||||
# self._is_same_machine_type = False
|
||||
self._id_mapping = {}
|
||||
self._old_new_materials = {}
|
||||
self._machine_info = None
|
||||
|
@ -229,7 +227,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||
# Read definition containers
|
||||
#
|
||||
machine_definition_id = None
|
||||
available_machines = []
|
||||
updatable_machines = []
|
||||
machine_definition_container_count = 0
|
||||
extruder_definition_container_count = 0
|
||||
definition_container_files = [name for name in cura_file_names if name.endswith(self._definition_container_suffix)]
|
||||
|
@ -246,9 +244,9 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||
definition_container_type = definition_container.get("type")
|
||||
if definition_container_type == "machine":
|
||||
machine_definition_id = container_id # TODO
|
||||
my_definition_containers = self._container_registry.findDefinitionContainers(id = machine_definition_id)
|
||||
available_machines = [i.name for i in self._container_registry.findContainerStacks(type = "machine") if
|
||||
i.definition == my_definition_containers[0]]
|
||||
machine_definition_containers = self._container_registry.findDefinitionContainers(id = machine_definition_id)
|
||||
if machine_definition_containers:
|
||||
updatable_machines = [machine.name for machine in self._container_registry.findContainerStacks(type = "machine") if machine.definition == machine_definition_containers[0]]
|
||||
machine_type = definition_container["name"]
|
||||
variant_type_name = definition_container.get("variants_name", variant_type_name)
|
||||
|
||||
|
@ -390,7 +388,6 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||
machine_definition_id = id_list[7]
|
||||
|
||||
stacks = self._container_registry.findContainerStacks(name = machine_name, type = "machine")
|
||||
# self._is_same_machine_type = True
|
||||
existing_global_stack = None
|
||||
global_stack = None
|
||||
|
||||
|
@ -405,9 +402,9 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||
if global_stack.getContainer(index).getId() != container_id:
|
||||
machine_conflict = True
|
||||
break
|
||||
elif available_machines:
|
||||
|
||||
if updatable_machines and not containers_found_dict["machine"]:
|
||||
containers_found_dict["machine"] = True
|
||||
# self._is_same_machine_type = global_stack.definition.getId() == machine_definition_id
|
||||
|
||||
# Get quality type
|
||||
parser = ConfigParser(interpolation = None)
|
||||
|
@ -555,9 +552,6 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||
self._machine_info.custom_quality_name = quality_name
|
||||
self._machine_info.intent_category = intent_category
|
||||
|
||||
# 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("group_name")
|
||||
|
@ -578,7 +572,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||
self._dialog.setNumSettingsOverriddenByQualityChanges(num_settings_overridden_by_quality_changes)
|
||||
self._dialog.setNumUserSettings(num_user_settings)
|
||||
self._dialog.setActiveMode(active_mode)
|
||||
self._dialog.setAvailableMachines(available_machines)
|
||||
self._dialog.setUpdatableMachines(updatable_machines)
|
||||
self._dialog.setMachineName(machine_name)
|
||||
self._dialog.setMaterialLabels(material_labels)
|
||||
self._dialog.setMachineType(machine_type)
|
||||
|
@ -659,8 +653,8 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||
|
||||
application.expandedCategoriesChanged.emit() # Notify the GUI of the change
|
||||
|
||||
# If a machine with the same name is of a different type, always create a new one.
|
||||
if self._resolve_strategies["machine"] != "override" or not self._dialog.availableMachines:
|
||||
# If there are no machines of the same type, create a new machine.
|
||||
if self._resolve_strategies["machine"] != "override" or not self._dialog.updatableMachines:
|
||||
# We need to create a new machine
|
||||
machine_name = self._container_registry.uniqueName(self._machine_info.name)
|
||||
|
||||
|
@ -673,7 +667,9 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||
# Find the machine which will be overridden
|
||||
global_stacks = self._container_registry.findContainerStacks(name = self._dialog.getMachineToOverride(), type = "machine")
|
||||
if not global_stacks:
|
||||
message = Message(i18n_catalog.i18nc("@info:error Don't translate the XML tag <filename>!", "Project file <filename>{0}</filename> is made using profiles that are unknown to this version of Ultimaker Cura.", file_name))
|
||||
message = Message(i18n_catalog.i18nc("@info:error Don't translate the XML tag <filename>!",
|
||||
"Project file <filename>{0}</filename> is made using profiles that"
|
||||
" are unknown to this version of Ultimaker Cura.", file_name))
|
||||
message.show()
|
||||
self.setWorkspaceName("")
|
||||
return [], {}
|
||||
|
|
|
@ -46,7 +46,7 @@ class WorkspaceDialog(QObject):
|
|||
self._quality_type = ""
|
||||
self._intent_name = ""
|
||||
self._machine_name = ""
|
||||
self._available_machines = []
|
||||
self._updatable_machines = []
|
||||
self._machine_type = ""
|
||||
self._variant_type = ""
|
||||
self._material_labels = []
|
||||
|
@ -65,7 +65,7 @@ class WorkspaceDialog(QObject):
|
|||
qualityTypeChanged = pyqtSignal()
|
||||
intentNameChanged = pyqtSignal()
|
||||
machineNameChanged = pyqtSignal()
|
||||
availableMachinesChanged = pyqtSignal()
|
||||
updatableMachinesChanged = pyqtSignal()
|
||||
materialLabelsChanged = pyqtSignal()
|
||||
objectsOnPlateChanged = pyqtSignal()
|
||||
numUserSettingsChanged = pyqtSignal()
|
||||
|
@ -145,18 +145,18 @@ class WorkspaceDialog(QObject):
|
|||
self._machine_name = machine_name
|
||||
self.machineNameChanged.emit()
|
||||
|
||||
@pyqtProperty("QVariantList", notify = availableMachinesChanged)
|
||||
def availableMachines(self):
|
||||
return self._available_machines
|
||||
@pyqtProperty("QVariantList", notify = updatableMachinesChanged)
|
||||
def updatableMachines(self):
|
||||
return self._updatable_machines
|
||||
|
||||
def setAvailableMachines(self, available_machines):
|
||||
if self._available_machines != available_machines:
|
||||
self._available_machines = sorted(available_machines)
|
||||
self.availableMachinesChanged.emit()
|
||||
def setUpdatableMachines(self, updatable_machines):
|
||||
if self._updatable_machines != updatable_machines:
|
||||
self._updatable_machines = sorted(updatable_machines)
|
||||
self.updatableMachinesChanged.emit()
|
||||
|
||||
@pyqtProperty(int, notify = availableMachinesChanged)
|
||||
def availableMachinesCount(self):
|
||||
return len(self._available_machines)
|
||||
@pyqtProperty(int, notify = updatableMachinesChanged)
|
||||
def updatableMachinesCount(self):
|
||||
return len(self._updatable_machines)
|
||||
|
||||
@pyqtProperty(str, notify=qualityTypeChanged)
|
||||
def qualityType(self):
|
||||
|
|
|
@ -105,7 +105,7 @@ UM.Dialog
|
|||
id: machineResolveStrategyTooltip
|
||||
width: (parent.width / 3) | 0
|
||||
height: visible ? comboboxHeight : 0
|
||||
visible: manager.availableMachinesCount != 0
|
||||
visible: manager.updatableMachinesCount != 0
|
||||
text: catalog.i18nc("@info:tooltip", "How should the conflict in the machine be resolved?")
|
||||
ComboBox
|
||||
{
|
||||
|
@ -163,12 +163,12 @@ UM.Dialog
|
|||
id: machineResolveTooltip
|
||||
width: (parent.width / 3) | 0
|
||||
height: visible ? comboboxHeight : 0
|
||||
visible: base.visible && manager.availableMachinesCount != 0 && machineResolveStrategyCurrentKey == "override"
|
||||
visible: base.visible && manager.updatableMachinesCount != 0 && machineResolveStrategyCurrentKey == "override"
|
||||
text: catalog.i18nc("@info:tooltip", "Which machine of the same type should be overriden?")
|
||||
ComboBox
|
||||
{
|
||||
id: selectMachineComboBox
|
||||
model: manager.availableMachines
|
||||
model: manager.updatableMachines
|
||||
width: parent.width
|
||||
onCurrentIndexChanged:
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue