Drag and drop onto FSLeyes
My strategy would be to:
-
in the
fsleyes.frame
module, define a droptarget class which is given references to the overlay list and display context. ItsDoDrop
method would use thefsleyes.actions.loadoverlay.loadOverlays
function to load the files, and would then add them to the overlay list (an example of this is infsleyes.main.FSLeyesApp.MacOpenFiles
). -
In
fsleyes.main.makeFrame
, create an instance of your droptarget class, and pass it to theframe.SetDropTarget
method.
That's it! You may end up having to save a reference to the drop target object, to prevent it from being garbage-collected (although I am not sure about this). You could simply attach it as an attribute of the frame, e.g.:
frame = fsleyesframe.FSLeyesFrame(...)
frame.drop = fsleyesframe.DropTarget(..)
frame.SetDropTarget(frame.drop)