mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-21 05:37:50 -06:00
Get how we name variants from the machine definition
CURA-2116
This commit is contained in:
parent
6bcea1e309
commit
8c63216fdf
2 changed files with 27 additions and 2 deletions
|
@ -731,6 +731,16 @@ class MachineManager(QObject):
|
||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
## Gets how the active definition calls variants
|
||||||
|
# Caveat: per-definition-variant-title is currently not translated (though the fallback is)
|
||||||
|
@pyqtProperty(str, notify = globalContainerChanged)
|
||||||
|
def activeDefinitionVariantsName(self):
|
||||||
|
fallback_title = catalog.i18nc("@label", "Nozzle")
|
||||||
|
if self._global_container_stack:
|
||||||
|
return self._global_container_stack.getBottom().getMetaDataEntry("variants_name", fallback_title)
|
||||||
|
|
||||||
|
return fallback_title
|
||||||
|
|
||||||
@pyqtSlot(str, str)
|
@pyqtSlot(str, str)
|
||||||
def renameMachine(self, machine_id, new_name):
|
def renameMachine(self, machine_id, new_name):
|
||||||
containers = UM.Settings.ContainerRegistry.getInstance().findContainerStacks(id = machine_id)
|
containers = UM.Settings.ContainerRegistry.getInstance().findContainerStacks(id = machine_id)
|
||||||
|
|
|
@ -183,8 +183,23 @@ Column
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
id: variantLabel
|
id: variantLabel
|
||||||
text: (Cura.MachineManager.hasVariants && Cura.MachineManager.hasMaterials) ? catalog.i18nc("@label","Nozzle & Material:"):
|
text:
|
||||||
Cura.MachineManager.hasVariants ? catalog.i18nc("@label","Nozzle:") : catalog.i18nc("@label","Material:");
|
{
|
||||||
|
var label;
|
||||||
|
if(Cura.MachineManager.hasVariants && Cura.MachineManager.hasMaterials)
|
||||||
|
{
|
||||||
|
label = "%1 & %2".arg(Cura.MachineManager.activeDefinitionVariantsName).arg(catalog.i18nc("@label","Material"));
|
||||||
|
}
|
||||||
|
else if(Cura.MachineManager.hasVariants)
|
||||||
|
{
|
||||||
|
label = Cura.MachineManager.activeDefinitionVariantsName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
label = catalog.i18nc("@label","Material");
|
||||||
|
}
|
||||||
|
return "%1:".arg(label);
|
||||||
|
}
|
||||||
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
width: parent.width * 0.45 - UM.Theme.getSize("default_margin").width
|
width: parent.width * 0.45 - UM.Theme.getSize("default_margin").width
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue