Skip to content

Commit

Permalink
Merge pull request biolab#3466 from VesnaT/fix_apply_selection
Browse files Browse the repository at this point in the history
[FIX] OWDataProjectionWidget: Fix applying selection
  • Loading branch information
janezd authored Dec 13, 2018
2 parents 913ede0 + 868b74d commit 80d3528
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
7 changes: 4 additions & 3 deletions Orange/widgets/visualize/tests/test_owscatterplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,10 @@ def test_invalid_points_selection(self):
OWScatterPlot, stored_settings={
"selection_group": [(i, 1) for i in range(50)]}
)
self.send_signal(self.widget.Inputs.data, self.data[:10])
selected_data = self.get_output(self.widget.Outputs.selected_data)
self.assertEqual(len(selected_data), 10)
data = self.data.copy()[:11]
data[0, 0] = np.nan
self.send_signal(self.widget.Inputs.data, data)
self.assertIsNone(self.get_output(self.widget.Outputs.selected_data))

def test_set_strings_settings(self):
"""
Expand Down
9 changes: 4 additions & 5 deletions Orange/widgets/visualize/utils/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,11 +490,10 @@ def setup_plot(self):

# Selection
def apply_selection(self):
if self.data is not None and self.__pending_selection is not None \
and self.graph.n_valid:
index_group = [(index, group) for index, group in
self.__pending_selection if index < len(self.data)]
index_group = np.array(index_group).T
pending = self.__pending_selection
if self.data is not None and pending is not None and len(pending) \
and max(i for i, _ in pending) < self.graph.n_valid:
index_group = np.array(pending).T
selection = np.zeros(self.graph.n_valid, dtype=np.uint8)
selection[index_group[0]] = index_group[1]

Expand Down

0 comments on commit 80d3528

Please sign in to comment.