Skip to content

[ENH] Select Columns: Accept partially correct drops#6390

Merged
ales-erjavec merged 2 commits intobiolab:masterfrom
janezd:selectcolumns-filterdrop
May 12, 2023
Merged

[ENH] Select Columns: Accept partially correct drops#6390
ales-erjavec merged 2 commits intobiolab:masterfrom
janezd:selectcolumns-filterdrop

Conversation

@janezd
Copy link
Contributor

@janezd janezd commented Apr 2, 2023

Issue

Fixes #5897.

Drag & Drop between VariablesListViews rejects drops that contain any variables of unacceptable type.

Description of changes
  • Reimplement drag procedure to accept partially correct drops.
  • Same for buttons: the are enabled if there is anything to move, and move only what they may
Includes
  • Code changes
  • Tests
  • N/A: Documentation

if self.primitive and not all(var.is_primitive() for var in variables):
variables = [var for var in variables if var.is_primitive()]
self[row:row] = variables
mime.setProperty("_moved", variables)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ales-erjavec, MIME is passed from source of the drag to its destination. In this PR, destination may accept only some data, so it must have a way to pass the list of accepted variables back to the source. drag.exec does not return values. Here I treated mime data as a shared, two-way object. It works, but is it OK? Documentation neither mentions nor prohibits it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably fine.

@janezd janezd force-pushed the selectcolumns-filterdrop branch from 445613d to 34dc780 Compare April 13, 2023 08:40
@janezd janezd marked this pull request as ready for review April 13, 2023 08:40
@janezd janezd force-pushed the selectcolumns-filterdrop branch from 34dc780 to 1682368 Compare April 13, 2023 08:54
@janezd janezd force-pushed the selectcolumns-filterdrop branch from dd5ed1c to 851cf6e Compare April 13, 2023 09:22
@janezd janezd changed the title Select Columns: Accept partially correct drops [ENH] Select Columns: Accept partially correct drops Apr 24, 2023
@ales-erjavec ales-erjavec merged commit 0fa863e into biolab:master May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Select Columns: ignore moving string to features automatically

2 participants