From 5d47a0f44c501c6eda23a72ddf3f54d72490c761 Mon Sep 17 00:00:00 2001 From: rr- Date: Thu, 17 Jan 2019 00:47:23 +0100 Subject: [PATCH] mechanic: fix simulation stopping under certain conditions --- pqcli/mechanic.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pqcli/mechanic.py b/pqcli/mechanic.py index 6ff0597..c066922 100644 --- a/pqcli/mechanic.py +++ b/pqcli/mechanic.py @@ -75,9 +75,10 @@ class Bar(SignalMixin): return self._position >= self.max_ def reposition(self, new_pos: float) -> None: + old_pos = self._position new_pos = float(min(new_pos, self._max)) - if not math.isclose(new_pos, self._position): - self._position = new_pos + self._position = new_pos + if not math.isclose(new_pos, old_pos): self.emit("change")