diff --git a/doc/source/changes/version_0_34_3.rst.inc b/doc/source/changes/version_0_34_3.rst.inc index be99fa5..e6c937b 100644 --- a/doc/source/changes/version_0_34_3.rst.inc +++ b/doc/source/changes/version_0_34_3.rst.inc @@ -6,3 +6,5 @@ Fixes * changes made to arrays in the console using the "points" syntax (for example: `arr.points['a0,a1', 'b0,b1'] = 0`) and the other special `.something[]` syntaxes were not detected by the viewer and thus not displayed (closes :editor_issue:`269`). + +* fixed copying to clipboard an array filtered on all dimensions (to a single value). Closes :editor_issue:`270`. diff --git a/larray_editor/arrayadapter.py b/larray_editor/arrayadapter.py index 639ca8c..d1650e2 100644 --- a/larray_editor/arrayadapter.py +++ b/larray_editor/arrayadapter.py @@ -340,6 +340,10 @@ def selection_to_chain(self, raw_data, axes_names, vlabels, hlabels): ------- itertools.chain """ + # FIXME: this function does not support None axes_names, vlabels and hlabels + # which _selection_data() produces in some cases (notably when working + # on a scalar array). Unsure if we should fix _selection_data or this + # method though. from itertools import chain topheaders = [axes_names + hlabels] if self.ndim == 1: diff --git a/larray_editor/arraywidget.py b/larray_editor/arraywidget.py index e271f76..2d34aaa 100644 --- a/larray_editor/arraywidget.py +++ b/larray_editor/arraywidget.py @@ -1055,10 +1055,18 @@ def _selection_data(self, headers=True, none_selects_all=True): row_min, row_max, col_min, col_max = bounds raw_data = self.model_data.get_values(row_min, col_min, row_max, col_max) if headers: + # FIXME: using data_adapter.ndim here and in the vlabels line below is + # inherently buggy, because this does not take filter into account, + # which should be the case for selection-related stuff which work + # on visible data if not self.data_adapter.ndim: return raw_data, None, None, None axes_names = self.model_axes.get_values() - hlabels = [label[0] for label in self.model_hlabels.get_values(top=col_min, bottom=col_max)] + if len(axes_names): + hlabels = [label[0] + for label in self.model_hlabels.get_values(top=col_min, bottom=col_max)] + else: + hlabels = [] vlabels = self.model_vlabels.get_values(left=row_min, right=row_max) if self.data_adapter.ndim > 1 else [] return raw_data, axes_names, vlabels, hlabels else: