Skip to content

Commit

Permalink
Radviz: Do not save selected vars when showing warning
Browse files Browse the repository at this point in the history
  • Loading branch information
VesnaT committed Dec 6, 2018
1 parent 97dee02 commit e3021f6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Orange/widgets/visualize/owradviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,13 @@ def __vizrank_set_attrs(self, attrs):
self.__model_selected_changed()

def __model_selected_changed(self):
self.selected_vars = [(var.name, vartype(var)) for var
in self.model_selected]

self.Warning.no_features.clear()
if len(self.model_selected) < 2:
self.Warning.no_features()
return

self.selected_vars = [(var.name, vartype(var)) for var
in self.model_selected]
self.init_projection()
self.setup_plot()
self.commit()
Expand Down
12 changes: 12 additions & 0 deletions Orange/widgets/visualize/tests/test_owradviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,15 @@ def test_discrete_attributes(self):
self.assertTrue(self.widget.Warning.removed_vars.is_shown())
self.send_signal(self.widget.Inputs.data, None)
self.assertFalse(self.widget.Warning.removed_vars.is_shown())

def test_no_features_warning(self):
self.send_signal(self.widget.Inputs.data, self.data)
self.widget.model_selected[:] = self.data.domain[:3]
self.widget.variables_selection.removed.emit()
self.widget.model_selected[:] = self.data.domain[:1]
self.widget.variables_selection.removed.emit()
self.assertTrue(self.widget.Warning.no_features.is_shown())
self.send_signal(self.widget.Inputs.data, None)
self.assertFalse(self.widget.Warning.no_features.is_shown())
self.send_signal(self.widget.Inputs.data, self.data)
self.assertEqual(len(self.widget.model_selected[:]), 3)

0 comments on commit e3021f6

Please sign in to comment.