From e089c86702420858819300c9bcba7b281209cc91 Mon Sep 17 00:00:00 2001 From: Rafael Irgolic Date: Fri, 25 Sep 2020 13:27:41 +0200 Subject: [PATCH] ownomogram: Fix wrapped C++ obj error --- Orange/widgets/visualize/ownomogram.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Orange/widgets/visualize/ownomogram.py b/Orange/widgets/visualize/ownomogram.py index 326402b550c..b1a34112dfc 100644 --- a/Orange/widgets/visualize/ownomogram.py +++ b/Orange/widgets/visualize/ownomogram.py @@ -192,6 +192,9 @@ def probs_dot(self, dot): def hookOnMousePress(self, func): self._mousePressFunc = func + def unhookOnMousePress(self): + self._mousePressFunc = None + def mousePressEvent(self, event): if self._mousePressFunc: self._mousePressFunc() @@ -282,6 +285,8 @@ def setGraphicsItems(self, items): if self.__animation.state() == QPropertyAnimation.Running: self.__animation.stop() self.__items = items + for item in items: + item.hookOnMousePress(self.stop) def start(self): self.__animation.start() @@ -293,6 +298,12 @@ def stop(self): for item in self.__items: item.setBrush(self.__defaultColor) + def clear(self): + for item in self.__items: + item.unhookOnMousePress() + self.__items = [] + + class ContinuousItemMixin: def get_tooltip_text(self): @@ -982,7 +993,6 @@ def update_scene(self): item.dot.point_dot = point_item.dot item.dot.probs_dot = probs_item.dot item.dot.vertical_line = self.hidden_vertical_line - item.dot.hookOnMousePress(self.dot_animator.stop) self.dot_animator.setGraphicsItems( [item.dot for item in self.feature_items.values()] @@ -1262,6 +1272,7 @@ def clear_scene(self): self.nomogram_main = None self.vertical_line = None self.hidden_vertical_line = None + self.dot_animator.clear() self.scene.clear() def send_report(self):