Merge branch 'master' into ui_rework_4_0

This commit is contained in:
Diego Prado Gesto 2018-12-05 13:10:14 +01:00
commit 537929893f
2 changed files with 16 additions and 4 deletions

View file

@ -179,13 +179,15 @@ Item
color: "#414054" // TODO: Theme!
font: UM.Theme.getFont("large") // 16pt, bold
text: {
if (printer && printer.state == "disabled"){
if (printer && printer.state == "disabled")
{
return catalog.i18nc("@label:status", "Unavailable")
}
if (printer && printer.state == "unreachable"){
return catalog.i18nc("@label:status", "Unavailable")
if (printer && printer.state == "unreachable")
{
return catalog.i18nc("@label:status", "Unreachable")
}
if (printer && !printer.activePrintJob)
if (printer && printer.state == "idle")
{
return catalog.i18nc("@label:status", "Idle")
}

View file

@ -608,6 +608,16 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
def _createMaterialOutputModel(self, material_data: Dict[str, Any]) -> "MaterialOutputModel":
material_manager = CuraApplication.getInstance().getMaterialManager()
material_group_list = material_manager.getMaterialGroupListByGUID(material_data["guid"])
# This can happen if the connected machine has no material in one or more extruders (if GUID is empty), or the
# material is unknown to Cura, so we should return an "empty" or "unknown" material model.
if material_group_list is None:
material_name = "Empty" if len(material_data["guid"]) == 0 else "Unknown"
return MaterialOutputModel(guid = material_data["guid"],
type = material_data.get("type", ""),
color = material_data.get("color", ""),
brand = material_data.get("brand", ""),
name = material_data.get("name", material_name)
)
# Sort the material groups by "is_read_only = True" first, and then the name alphabetically.
read_only_material_group_list = list(filter(lambda x: x.is_read_only, material_group_list))