From: Ilya Kulakov Date: Tue, 18 Feb 2014 14:57:10 +0000 (+0700) Subject: Workaround for the issue when drag'n'drop to Cura's window does not work on Mac OS X. X-Git-Tag: 14.02-RC3~1^2^2~1 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=0dc4555197ae53b619c7786905f6c746957c1fa1;p=cura.git Workaround for the issue when drag'n'drop to Cura's window does not work on Mac OS X. --- diff --git a/Cura/gui/mainWindow.py b/Cura/gui/mainWindow.py index e105056a..714fc8ea 100644 --- a/Cura/gui/mainWindow.py +++ b/Cura/gui/mainWindow.py @@ -3,6 +3,8 @@ __copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AG import wx import os import webbrowser +import sys + from Cura.gui import configBase from Cura.gui import expertConfig @@ -31,6 +33,14 @@ class mainWindow(wx.Frame): # allow dropping any file, restrict later self.SetDropTarget(dropTarget.FileDropTarget(self.OnDropFiles)) + # TODO: wxWidgets 2.9.4 has a bug when NSView does not register for dragged types when wx drop target is set. It was fixed in 2.9.5 + if sys.platform.startswith('darwin'): + import Cocoa + import objc + nswindow = objc.objc_object(c_void_p=self.MacGetTopLevelWindowRef()) + view = nswindow.contentView() + view.registerForDraggedTypes_([Cocoa.NSFilenamesPboardType]) + self.normalModeOnlyItems = [] mruFile = os.path.join(profile.getBasePath(), 'mru_filelist.ini')