Skip to content

Commit

Permalink
Merge pull request #2780 from jerneju/freeviz-fix-hideradius
Browse files Browse the repository at this point in the history
[FIX] FreeViz: 2 issues when no data
  • Loading branch information
lanzagar authored Nov 27, 2017
2 parents f56ec3d + 2d006b0 commit 8341764
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
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()

0 comments on commit 8341764

Please sign in to comment.