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:
authorGhostkeeper <rubend@tutanota.com>2022-01-26 13:33:42 +0300
committerGhostkeeper <rubend@tutanota.com>2022-01-26 13:33:42 +0300
commit5e5e0febb91a3fa6643cc95107f14ce3d764fc0f (patch)
treec3a01807007ce2f30a8428ee96b3e67e50b4a793 /cura/Machines
parente607ae7b92917f83f65310e433524ac1308d18e7 (diff)
Format calculated functions in QualitySettingsModel itself
That way we don't have to re-format it in the display in the table. Contributes to issue CURA-8686.
Diffstat (limited to 'cura/Machines')
-rw-r--r--cura/Machines/Models/QualitySettingsModel.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/cura/Machines/Models/QualitySettingsModel.py b/cura/Machines/Models/QualitySettingsModel.py
index 89a996fba1..63d23240a8 100644
--- a/cura/Machines/Models/QualitySettingsModel.py
+++ b/cura/Machines/Models/QualitySettingsModel.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2020 Ultimaker B.V.
+# Copyright (c) 2022 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from PyQt5.QtCore import pyqtProperty, pyqtSignal, Qt
@@ -9,6 +9,7 @@ from UM import i18nCatalog
from UM.Logger import Logger
from UM.Qt.ListModel import ListModel
from UM.Settings.ContainerRegistry import ContainerRegistry
+from UM.Settings.SettingFunction import SettingFunction # To format setting functions differently.
import os
@@ -174,11 +175,16 @@ class QualitySettingsModel(ListModel):
if self._i18n_catalog:
label = self._i18n_catalog.i18nc(definition.key + " label", label)
+ if isinstance(profile_value, SettingFunction):
+ profile_value_display = self._i18n_catalog.i18nc("@info:status", "Calculated")
+ else:
+ profile_value_display = "" if profile_value is None else str(profile_value)
+
items.append({
"key": definition.key,
"label": label,
"unit": definition.unit,
- "profile_value": "" if profile_value is None else str(profile_value), # it is for display only
+ "profile_value": profile_value_display,
"profile_value_source": profile_value_source,
"user_value": "" if user_value is None else str(user_value),
"category": current_category