mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
removal of magic number
CURA-7647
This commit is contained in:
parent
a9aba2df74
commit
84565b7daa
1 changed files with 6 additions and 1 deletions
|
@ -12,6 +12,11 @@ if TYPE_CHECKING:
|
||||||
|
|
||||||
|
|
||||||
class SimulationViewProxy(QObject):
|
class SimulationViewProxy(QObject):
|
||||||
|
|
||||||
|
S_TO_MS = 1000
|
||||||
|
SPEED_OF_SIMULATION = 10
|
||||||
|
FACTOR = S_TO_MS/SPEED_OF_SIMULATION
|
||||||
|
|
||||||
def __init__(self, simulation_view: "SimulationView", parent=None) -> None:
|
def __init__(self, simulation_view: "SimulationView", parent=None) -> None:
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self._simulation_view = simulation_view
|
self._simulation_view = simulation_view
|
||||||
|
@ -59,7 +64,7 @@ class SimulationViewProxy(QObject):
|
||||||
def simulationTime(self):
|
def simulationTime(self):
|
||||||
# Extracts the currents paths simulation time (in seconds) for the current path from the dict of simulation time of the current layer.
|
# Extracts the currents paths simulation time (in seconds) for the current path from the dict of simulation time of the current layer.
|
||||||
# We multiply the time with 100 to make it to ms from s.(Should be 1000 in real time). This scaling makes the simulation time 10x faster than the real time.
|
# We multiply the time with 100 to make it to ms from s.(Should be 1000 in real time). This scaling makes the simulation time 10x faster than the real time.
|
||||||
simulationTimeOfpath = self._simulation_view.getSimulationTime(self._simulation_view.getCurrentPath()) * 100
|
simulationTimeOfpath = self._simulation_view.getSimulationTime(self._simulation_view.getCurrentPath()) * SimulationViewProxy.FACTOR
|
||||||
# Since the timer cannot process time less than 1 ms, we put a lower limit here
|
# Since the timer cannot process time less than 1 ms, we put a lower limit here
|
||||||
return int(max(1, simulationTimeOfpath))
|
return int(max(1, simulationTimeOfpath))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue