From 0dc4555197ae53b619c7786905f6c746957c1fa1 Mon Sep 17 00:00:00 2001 From: Ilya Kulakov Date: Tue, 18 Feb 2014 21:57:10 +0700 Subject: [PATCH] Workaround for the issue when drag'n'drop to Cura's window does not work on Mac OS X. --- Cura/gui/mainWindow.py | 10 ++++++++++ 1 file changed, 10 insertions(+) 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') -- 2.30.2