From 5bfb0fc437be41702fb37fbebe1648711bb270a8 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 18 May 2021 16:18:45 +0200 Subject: [PATCH] Use properties instead of slots for min & max flow This fixes some update issues in the simulation view display CURA-8196 --- plugins/SimulationView/SimulationViewMenuComponent.qml | 4 ++-- plugins/SimulationView/SimulationViewProxy.py | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index e52463be93..86e686e0fc 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -412,7 +412,7 @@ Cura.ExpandableComponent // Flow Rate selected if(UM.Preferences.getValue("layerview/layer_view_type") == 5) { - return parseFloat(UM.SimulationView.getMinFlowRate()).toFixed(2); + return parseFloat(UM.SimulationView.minFlowRate).toFixed(2); } } @@ -482,7 +482,7 @@ Cura.ExpandableComponent // Flow rate selected if(UM.Preferences.getValue("layerview/layer_view_type") == 5) { - return parseFloat(UM.SimulationView.getMaxFlowRate()).toFixed(2); + return parseFloat(UM.SimulationView.maxFlowRate).toFixed(2); } } return catalog.i18nc("@label","max") diff --git a/plugins/SimulationView/SimulationViewProxy.py b/plugins/SimulationView/SimulationViewProxy.py index e07d63e713..7d78e93ca5 100644 --- a/plugins/SimulationView/SimulationViewProxy.py +++ b/plugins/SimulationView/SimulationViewProxy.py @@ -126,15 +126,14 @@ class SimulationViewProxy(QObject): def minLineWidth(self): return self._simulation_view.getMinLineWidth() - @pyqtSlot(result=float) - def getMaxFlowRate(self): + @pyqtProperty(float, notify=colorSchemeLimitsChanged) + def maxFlowRate(self): return self._simulation_view.getMaxFlowRate() - @pyqtSlot(result=float) - def getMinFlowRate(self): + @pyqtProperty(float, notify=colorSchemeLimitsChanged) + def minFlowRate(self): return self._simulation_view.getMinFlowRate() - # Opacity 0..1 @pyqtSlot(int, float) def setExtruderOpacity(self, extruder_nr, opacity):