Commit eed8940d authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

Merge branch 'bf/macos-openfiles' into 'master'

Bf/macos openfiles

See merge request fsl/fsleyes/fsleyes!228
parents 3cd63c37 b39b3489
......@@ -67,6 +67,9 @@ Fixed
* Fixed a bug in image texture preparation for complex data types, when
running in a limited GL environment (e.g. VNC).
* Compatibility fixes for newer versions of Jupyter `notebook`.
* Fixed a problem with macOS desktop integration - it should now be possible
to open a file with FSLeyes as the default application, and to drag a file
onto the FSLeyes.app icon.
0.34.2 (Tuesday 14th July 2020)
......
......@@ -95,6 +95,14 @@ class FSLeyesApp(wx.App):
self.__overlayList = None
self.__displayCtx = None
# On macOS, when the user drags a file onto the FSLeyes window,
# or onto the FSLeyes.app icon, the file path will be passed to
# MacOpenFiles method. But that method may be called very early
# on in the startup process, before the DisplayContext and
# OverlayList have been created. So when this happens, we cache
# the files here, and then open them when the
# SetOverlayListAndDisplayContext method gets called.
self.__filesToOpen = []
self.__modalHook = FSLeyesApp.ModalHook()
self.__modalHook.Register()
......@@ -125,6 +133,14 @@ class FSLeyesApp(wx.App):
self.__overlayList = overlayList
self.__displayCtx = displayCtx
# MacOpenFiles was called before the
# overlaylist/dc were created, and
# queued some files that need to be
# opened
if len(self.__filesToOpen) > 0:
wx.CallAfter(self.MacOpenFiles, self.__filesToOpen)
self.__filesToOpen = None
def MacReopenApp(self):
"""On OSX, make sure that the FSLeyes frame is restored if it is
......@@ -169,7 +185,11 @@ class FSLeyesApp(wx.App):
on the application icon.
"""
# OverlayList has not yet been created -
# queue the files to open them later
# in SetOverlayListAndDisplayContext
if self.__overlayList is None:
self.__filesToOpen.extend(filenames)
return
import fsleyes.actions.loadoverlay as loadoverlay
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment