This commit is contained in:
fieldOfView 2016-06-09 13:16:38 +02:00
commit f498f0237c
6 changed files with 590 additions and 267 deletions

View file

@ -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)

View file

@ -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"])