[Pyobjc-dev] Problems with Drag & Drop

Okay, I've been reading up on this all weekend, and trying to debug my
app with pdb, but to no avail.
I've taken a PIL script I wrote to generate the thumbnails I use on my
blog and wrapped it very quickly with PyObjC, and now I can drop images
on the app and have their thumbnails created. But here's the weird
part: if I drop three or more images, it seg faults. One or two work
just dandy. Here's the code of the Custom View class I implemented to
trap the drag event:
class DropView(NibClassBuilder.AutoBaseClass):
"""
"""
def draggingEntered_(self, sender):
NSLog("Dragging Entered...")
sourceDragMask = sender.draggingSourceOperationMask()
pboard = sender.draggingPasteboard()
if pboard.types().containsObject_(NSFilenamesPboardType):
if sourceDragMask and NSDragOperationGeneric:
return NSDragOperationGeneric
return NSDragOperationNone
def performDragOperation_(self, sender):
NSLog("Perform Drag Operation...")
sourceDragMask = sender.draggingSourceOperationMask()
pboard = sender.draggingPasteboard()
if pboard.types().containsObject_(NSFilenamesPboardType):
# I do a list() around this because it looked funny by itself
files = list(pboard.propertyListForType_(NSFilenamesPboardType))
if sourceDragMask and NSDragOperationGeneric:
self.app.processFiles(files)
return YES
def concludeDragOperation_(self, sender):
self.resetImage()
def resetImage(self):
start_image = NSImage.alloc().initWithContentsOfFile_("Thumbscrew.tif")
self.setImage_(start_image)
And that's it. The DropView.app attribute is my app delegate (wanted a
way to get back into it). Anyway, does this look funny to anyone? I
tried to copy the example offered in Apple's docs, so I only have the
two methods they listed (I register the DropView instance for receiving
drags in the app delegate's awakeFromNib() method)
Thanks,
Zac

Thread view

Okay, I've been reading up on this all weekend, and trying to debug my
app with pdb, but to no avail.
I've taken a PIL script I wrote to generate the thumbnails I use on my
blog and wrapped it very quickly with PyObjC, and now I can drop images
on the app and have their thumbnails created. But here's the weird
part: if I drop three or more images, it seg faults. One or two work
just dandy. Here's the code of the Custom View class I implemented to
trap the drag event:
class DropView(NibClassBuilder.AutoBaseClass):
"""
"""
def draggingEntered_(self, sender):
NSLog("Dragging Entered...")
sourceDragMask = sender.draggingSourceOperationMask()
pboard = sender.draggingPasteboard()
if pboard.types().containsObject_(NSFilenamesPboardType):
if sourceDragMask and NSDragOperationGeneric:
return NSDragOperationGeneric
return NSDragOperationNone
def performDragOperation_(self, sender):
NSLog("Perform Drag Operation...")
sourceDragMask = sender.draggingSourceOperationMask()
pboard = sender.draggingPasteboard()
if pboard.types().containsObject_(NSFilenamesPboardType):
# I do a list() around this because it looked funny by itself
files = list(pboard.propertyListForType_(NSFilenamesPboardType))
if sourceDragMask and NSDragOperationGeneric:
self.app.processFiles(files)
return YES
def concludeDragOperation_(self, sender):
self.resetImage()
def resetImage(self):
start_image = NSImage.alloc().initWithContentsOfFile_("Thumbscrew.tif")
self.setImage_(start_image)
And that's it. The DropView.app attribute is my app delegate (wanted a
way to get back into it). Anyway, does this look funny to anyone? I
tried to copy the example offered in Apple's docs, so I only have the
two methods they listed (I register the DropView instance for receiving
drags in the app delegate's awakeFromNib() method)
Thanks,
Zac