mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-10-10 15:27:53 -06:00
Merge branch 'master' of github.com:ultimaker/Cura
* 'master' of github.com:ultimaker/Cura: Determine readonly state from location in filesystem instead of a metadata property Change focus upon extruder switch Fix extruder number attached to extruders Fix duplicating the first item on the Profiles page Fix spelling Document setActiveExtruderIndex Inheritance button now works if instance containers contain functions JSON cleanup: removed settable_per_x when they were obvious and default (CURA-1560) feat: use settable_per_[mesh|extruder|meshgroup|globally] instead of global_only (CURA-1560) JSON feat: replaced global_only with four properties settable_per_[mesh|extruder|meshgroup] and settable_globally for fdmextruder settings (CURA-1558) JSON feat: replaced global_only with four properties settable_per_[mesh|extruder|meshgroup] and settable_globally (CURA-1558)
This commit is contained in:
commit
627d5e3c0d
51 changed files with 618 additions and 327 deletions
|
@ -93,7 +93,10 @@ class CuraApplication(QtApplication):
|
|||
self._open_file_queue = [] # Files to open when plug-ins are loaded.
|
||||
|
||||
# Need to do this before ContainerRegistry tries to load the machines
|
||||
SettingDefinition.addSupportedProperty("global_only", DefinitionPropertyType.Function, default = False)
|
||||
SettingDefinition.addSupportedProperty("settable_per_mesh", DefinitionPropertyType.Any, default = True)
|
||||
SettingDefinition.addSupportedProperty("settable_per_extruder", DefinitionPropertyType.Any, default = True)
|
||||
SettingDefinition.addSupportedProperty("settable_per_meshgroup", DefinitionPropertyType.Any, default = True)
|
||||
SettingDefinition.addSupportedProperty("settable_globally", DefinitionPropertyType.Any, default = True)
|
||||
SettingDefinition.addSettingType("extruder", str, ast.literal_eval, UM.Settings.Validator)
|
||||
|
||||
super().__init__(name = "cura", version = CuraVersion, buildtype = CuraBuildType)
|
||||
|
|
|
@ -58,6 +58,9 @@ class ExtruderManager(QObject):
|
|||
cls.__instance = ExtruderManager()
|
||||
return cls.__instance
|
||||
|
||||
## Changes the active extruder by index.
|
||||
#
|
||||
# \param index The index of the new active extruder.
|
||||
@pyqtSlot(int)
|
||||
def setActiveExtruderIndex(self, index):
|
||||
self._active_extruder_index = index
|
||||
|
|
|
@ -51,13 +51,18 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
|
|||
global_container_stack = UM.Application.getInstance().getGlobalContainerStack()
|
||||
if not global_container_stack:
|
||||
return #There is no machine to get the extruders of.
|
||||
for index, extruder in enumerate(manager.getMachineExtruders(global_container_stack.getBottom())):
|
||||
for extruder in manager.getMachineExtruders(global_container_stack.getBottom()):
|
||||
material = extruder.findContainer({ "type": "material" })
|
||||
colour = material.getMetaDataEntry("color_code", default = "#FFFF00") if material else "#FFFF00"
|
||||
position = extruder.getBottom().getMetaDataEntry("position", default = "0") #Position in the definition.
|
||||
try:
|
||||
position = int(position)
|
||||
except ValueError: #Not a proper int.
|
||||
position = -1
|
||||
item = { #Construct an item with only the relevant information.
|
||||
"name": extruder.getName(),
|
||||
"colour": colour,
|
||||
"index": index
|
||||
"index": position
|
||||
}
|
||||
self.appendItem(item)
|
||||
self.sort(lambda item: item["index"])
|
|
@ -266,7 +266,7 @@ class MachineManagerModel(QObject):
|
|||
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id=container_id)
|
||||
if not containers or not self._global_container_stack:
|
||||
return True
|
||||
return containers[0].getMetaDataEntry("read_only", False) == "True"
|
||||
return containers[0].isReadOnly()
|
||||
|
||||
@pyqtSlot(result = str)
|
||||
def convertUserContainerToQuality(self):
|
||||
|
@ -288,7 +288,7 @@ class MachineManagerModel(QObject):
|
|||
|
||||
## Change type / id / name
|
||||
new_quality_container.setMetaDataEntry("type", "quality")
|
||||
new_quality_container.setMetaDataEntry("read_only", False)
|
||||
new_quality_container.setReadOnly(False)
|
||||
new_quality_container.setName(name)
|
||||
new_quality_container._id = name
|
||||
|
||||
|
@ -310,7 +310,7 @@ class MachineManagerModel(QObject):
|
|||
## Copy all values
|
||||
new_container.deserialize(containers[0].serialize())
|
||||
|
||||
new_container.setMetaDataEntry("read_only", False)
|
||||
new_container.setReadOnly(False)
|
||||
new_container.setName(new_name)
|
||||
new_container._id = new_name
|
||||
UM.Settings.ContainerRegistry.getInstance().addContainer(new_container)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue