Skip to content

issue270 #273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/source/changes/version_0_34_3.rst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
4 changes: 4 additions & 0 deletions larray_editor/arrayadapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 9 additions & 1 deletion larray_editor/arraywidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading