Skip to content

Commit

Permalink
Merge pull request #5005 from irgolic/nomogram-flash-dots
Browse files Browse the repository at this point in the history
[FIX] ownomogram: Fix wrapped C++ obj error
  • Loading branch information
janezd committed Sep 25, 2020
2 parents 9c07ac0 + e089c86 commit 1a2ae34
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Orange/widgets/visualize/ownomogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand All @@ -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):
Expand Down Expand Up @@ -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()]
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 1a2ae34

Please sign in to comment.