Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] ownomogram: Fix wrapped C++ obj error #5005

Merged
merged 1 commit into from
Sep 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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