Skip to content
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

Improved copying and selection behaviour of array editor #2750

Merged
merged 2 commits into from
Oct 12, 2015

Conversation

da-woods
Copy link

@da-woods da-woods commented Oct 8, 2015

This replaces #2579 (so close that request if you're happy with this one).

The justification remains the same:
The reason for this change is that if you went to the array editor and used the top left square to select everything, it only selected the currently loaded data. For large arrays that was a subset of the whole thing (because extra data is fetched on demand). It wasn't obvious that it had done this unless you scrolled to check what it had selected, or copied the selection and found it was smaller than expected.

I've changed two things:

  1. When an array is copied and the selected ranges reach the edges of the currently loaded data, the range copied goes to the end of the array, not the end of the loaded data.
  2. When a whole row or column is selected and more data is loaded into the array editor, the selection is expanded too (which I think is intuitive).

The advantage over the original pull request is that it no longer suddenly loads the whole array into the editor (which could use large amounts of memory)

David Woods added 2 commits October 8, 2015 19:35
If a whole solumn or row is selected in the array editor
then copy the whole of that from the array, even if the
data isn't completely loaded into the array editor
If the selection includes complete rows or columns, these are
expanded to reach the new ends
@ccordoba12
Copy link
Member

Thanks a lot for this and for taking the time to improve on your previous idea.

I'm very +1 to your contribution, and I'll try to review it during the weekend :-)

# so we can treat it as intentional and copy the whole thing
col_max = self.model().total_cols-1
if row_min == 0 and row_max == (self.model().rows_loaded-1):
row_max = self.model().total_rows-1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like this, it's very clever and solves the select columns, rows and all content in a very elegant way!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably worth mentioning that it doesn't quite do the right thing if you try to select an usual shaped region (i.e. select some rows or columns, then hold down ctrl and add a few extra cells elsewhere). That's an issue with the original code (not my added code) and it would probably be quite hard to work out what to do with numpy there.

ccordoba12 added a commit that referenced this pull request Oct 12, 2015
Improved copying and selection behaviour of array editor
@ccordoba12 ccordoba12 merged commit 5208cb1 into spyder-ide:master Oct 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants