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

[ENH] canvas: Open dropped ows files #2885

Merged
merged 1 commit into from
Feb 16, 2018

Conversation

astaric
Copy link
Member

@astaric astaric commented Jan 23, 2018

Issue

When an ows file is dropped on canvas window, nothing happens.

Description of changes

When an ows file is dropped on canvas window, it is opened.

Includes
  • Code changes
  • Tests
  • Documentation

@codecov-io
Copy link

codecov-io commented Jan 23, 2018

Codecov Report

Merging #2885 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #2885   +/-   ##
=======================================
  Coverage   82.12%   82.12%           
=======================================
  Files         329      329           
  Lines       56258    56258           
=======================================
  Hits        46201    46201           
  Misses      10057    10057

@astaric
Copy link
Member Author

astaric commented Jan 24, 2018

@ales-erjavec, is this a proper way to do it?

I considered handling drops in CanvasMainWindows, but then the whole window would be the drop target.

@ales-erjavec
Copy link
Contributor

I considered handling drops in CanvasMainWindows, but then the whole window would be the drop target.

You can:

  1. condition the drop on certain sub areas by looking at event.pos() and accepting/rejecting it accordingly
  2. use an event filter on the 'target' widget. This is how it was already done in 2.7

@astaric
Copy link
Member Author

astaric commented Jan 24, 2018

Thanks, I like the event filter way. I'll update the code accordingly.

@astaric
Copy link
Member Author

astaric commented Jan 24, 2018

I ended up using the same code as in 2.7 :)

I did not use the OSX_NSURL_toLocalFile workaround as it is not needed for Qt5 (we started using it because PyQt4 never got official support for "permanent" file urls on macos). Since all our installers ship with PyQt5, this should be ok.

@markotoplak
Copy link
Member

Works for me on Linux.

One issue though: If I already have something open and chose "Cancel" in the save changes dialog, parts of the dialog remain until (parts of) the canvas is redrawn.

@astaric
Copy link
Member Author

astaric commented Feb 2, 2018

I did not manage to reproduce this

@lanzagar lanzagar added this to the 3.10 milestone Feb 7, 2018
@lanzagar lanzagar changed the title canvas: open dropped ows files [ENH] canvas: Open dropped ows files Feb 16, 2018
@lanzagar lanzagar merged commit 5e00aa1 into biolab:master Feb 16, 2018
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.

5 participants