diff --git a/Orange/widgets/visualize/owlinearprojection.py b/Orange/widgets/visualize/owlinearprojection.py index e19d60b447a..4c23c67718c 100644 --- a/Orange/widgets/visualize/owlinearprojection.py +++ b/Orange/widgets/visualize/owlinearprojection.py @@ -947,6 +947,7 @@ def select_indices(self, indices, modifiers=Qt.NoModifier): self._selection_mask[indices] = True self._on_color_change() + self.selection_indices = numpy.flatnonzero(self._selection_mask).tolist() self.commit() def commit(self): @@ -956,9 +957,7 @@ def commit(self): indices = numpy.flatnonzero(self._selection_mask) if len(indices) > 0: subset = self.data[indices] - indices = indices.tolist() - self.selection_indices = indices self.Outputs.selected_data.send(subset) self.Outputs.annotated_data.send(create_annotated_table(self.data, indices)) diff --git a/Orange/widgets/visualize/owscatterplot.py b/Orange/widgets/visualize/owscatterplot.py index 56aba11d508..4ad6e647161 100644 --- a/Orange/widgets/visualize/owscatterplot.py +++ b/Orange/widgets/visualize/owscatterplot.py @@ -431,6 +431,19 @@ def update_graph(self, reset_view=True, **_): self.graph.update_data(self.attr_x, self.attr_y, reset_view) def selection_changed(self): + + # Store current selection in a setting that is stored in workflow + if isinstance(self.data, SqlTable): + selection = None + elif self.data is not None: + selection = self.graph.get_selection() + else: + selection = None + if selection is not None and len(selection): + self.selection_group = list(zip(selection, self.graph.selection[selection])) + else: + self.selection_group = None + self.commit() def send_data(self): @@ -451,12 +464,6 @@ def send_data(self): self.Outputs.selected_data.send(selected) self.Outputs.annotated_data.send(annotated) - # Store current selection in a setting that is stored in workflow - if selection is not None and len(selection): - self.selection_group = list(zip(selection, graph.selection[selection])) - else: - self.selection_group = None - def send_features(self): features = [attr for attr in [self.attr_x, self.attr_y] if attr] self.Outputs.features.send(features or None)