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] FreeViz: 2 issues when no data #2780

Merged
merged 2 commits into from
Nov 27, 2017
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions Orange/widgets/visualize/owfreeviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,8 @@ def keyReleaseEvent(self, event):
def update_radius(self):
# Update the anchor/axes visibility
assert not self.plotdata is None
if self.plotdata.hidecircle is None:
return

minradius = self.radius / 100 + 1e-5
for anchor, item in zip(self.plotdata.anchors,
Expand Down Expand Up @@ -813,6 +815,8 @@ def _update_graph(self, reset_view=True, **_):
self.graph.update_data(self.variable_x, self.variable_y, reset_view)

def update_density(self):
if self.graph.data is None:
return
self._update_graph(reset_view=False)

def selection_changed(self):
Expand Down
18 changes: 18 additions & 0 deletions Orange/widgets/visualize/tests/test_owfreeviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,21 @@ def test_none_data(self):
def test_class_density(self):
self.send_signal(self.widget.Inputs.data, Table("iris"))
self.widget.cb_class_density.click()

def test_set_radius_no_data(self):
"""
Widget should not crash when there is no data and radius slider is moved.
GH-2780
"""
w = self.widget
self.send_signal(w.Inputs.data, None)
w.rslider.setSliderPosition(3)

def test_update_graph_no_data(self):
"""
Widget should not crash when there is no data and one wants to change class density etc.
GH-2780
"""
w = self.widget
self.send_signal(w.Inputs.data, None)
w.cb_class_density.click()