Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfieldOfView <aldo@fieldofview.com>2016-09-13 11:53:21 +0300
committerfieldOfView <aldo@fieldofview.com>2016-09-13 11:53:21 +0300
commit224e6d37a8166c7f8e7ad38a9da2ae022d34cc6d (patch)
treeec5e835ead586a831dcb52d5428ae25370f65359 /cura/PrinterOutputDevice.py
parent8d6f7c06c14d63329869ae4956c41f8a0b040f4a (diff)
Add materialNames property to get user-facing texts from printer
inb4 string-freeze CURA-2276
Diffstat (limited to 'cura/PrinterOutputDevice.py')
-rw-r--r--cura/PrinterOutputDevice.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py
index 35ca6b7cbb..1071cfeebd 100644
--- a/cura/PrinterOutputDevice.py
+++ b/cura/PrinterOutputDevice.py
@@ -24,6 +24,7 @@ class PrinterOutputDevice(QObject, OutputDevice):
def __init__(self, device_id, parent = None):
super().__init__(device_id = device_id, parent = parent)
+ self._container_registry = UM.Settings.ContainerRegistry.getInstance()
self._target_bed_temperature = 0
self._bed_temperature = 0
self._num_extruders = 1
@@ -276,6 +277,21 @@ class PrinterOutputDevice(QObject, OutputDevice):
def materialIds(self):
return self._material_ids
+ @pyqtProperty("QVariantList", notify = materialIdChanged)
+ def materialNames(self):
+ result = []
+ for material_id in self._material_ids:
+ if material_id is None:
+ result.append(i18n_catalog.i18nc("@item:material", "No material loaded"))
+ continue
+
+ containers = self._container_registry.findInstanceContainers(type = "material", guid = material_id)
+ if containers:
+ result.append(containers[0].getName())
+ else:
+ result.append(i18n_catalog.i18nc("@item:material", "Unknown material"))
+ return result
+
## Protected setter for the current material id.
# /param index Index of the extruder
# /param material_id id of the material