hdf-compass icon indicating copy to clipboard operation
hdf-compass copied to clipboard

'Drag & drop' doesn't work

Open gheber opened this issue 9 years ago • 8 comments

I just want to D&D an HDF5 file onto the HDFCompass main window and magic things should happen...

gheber avatar Apr 17 '15 07:04 gheber

This is a guide for configure drag and drop on the mac: http://wiki.wxpython.org/Optimizing%20for%20Mac%20OS%20X. It seems py2app specific though - I'm not sure if it will work with pyinstaller.

jreadey avatar Oct 28 '15 03:10 jreadey

Having it working with py2app can help to test it with pyinstaller that have open this ticket: https://github.com/pyinstaller/pyinstaller/issues/1309

giumas avatar Oct 28 '15 03:10 giumas

Something is moving to fix this issue on the Pyinstaller side: https://github.com/pyinstaller/pyinstaller/pull/2219

giumas avatar Oct 17 '16 14:10 giumas

@giumas - have you been able to get it working with the pyinstaller branch?

jreadey avatar Oct 18 '16 19:10 jreadey

Just to be clear, the argv emulation in pyinstaller and/or py2app only affects the startup of the application. For example, when you double click on a document to open your application, this functionality allows you to pick off the filename of what was dropped, so that your application can automatically open it.

It does not affect at all a drag/drop of a file onto your application. For that, you need to handle MacOpenFile or whatever appropriate AppleEvent.

dhyams avatar Oct 21 '16 21:10 dhyams

Actually, I think that wx.PyDropTarget already has everything you need, and it works on the mac...at least, that's what a cursory review of some of my current code tells me. But to handle things like the user drag/dropping a file onto the dock icon or some such, see

https://wxpython.org/Phoenix/docs/html/wx.PyApp.html#wx.PyApp.MacOpenFiles

dhyams avatar Oct 21 '16 21:10 dhyams

@dhyams Do you use wx classic or phoenix? If classic, are you able to drag&drop + associate a wx 'frozen' application using your PyInstaller branch?

FYI: HDF Compass is currently using classic and Python 2. The idea would be to switch to Python 3 as soon as phoenix is officially released.

giumas avatar Oct 21 '16 23:10 giumas

I am currently using wxPython 3.0.0.0 classic, and Python 2.7. Yes, I can associate a document with my app, and it works; I think that's what you mean. (In my case, for example, I associate a .gxp with my app, and then the .gxp is double clicked in the Finder, it runs my app, and my app reads sys.argv to get the filename). Note that it takes a modification to the Info.plist to cause the association to occur to begin with.

Drag and drop of a file onto my application works too, but I don't think that has anything to do with my modifications in pyinstaller/pyinstaller#2219. That's what I was trying to say a comment up; you handle a file drag/drop with wx.PyDropTarget.

dhyams avatar Oct 22 '16 03:10 dhyams