Permalink
Browse files

Woops. Forgot to add MWDragWindow.py.

  • Loading branch information...
1 parent 66b42f6 commit 4b50832114c80575b4da5ed915022099bebefc1f @lethain committed Aug 26, 2008
Showing with 35 additions and 0 deletions.
  1. +35 −0 MWDragWindow.py
View
@@ -0,0 +1,35 @@
+#
+# MWDragWindow.py
+# MetaWindow
+#
+# Created by Will Larson on 8/26/08.
+# Copyright (c) 2008 Will Larson. All rights reserved.
+#
+
+import objc
+from Foundation import *
+from AppKit import *
+
+
+class MWDragWindow(NSWindow):
+ controller = objc.IBOutlet()
+
+ def awakeFromNib(self):
+ self.registerForDraggedTypes_([NSStringPboardType])
+
+ def draggingEntered_(self,sender):
+ pboard = sender.draggingPasteboard()
+ types = pboard.types()
+ opType = NSDragOperationNone
+ if NSStringPboardType in types:
+ return NSDragOperationCopy
+ return opType
+
+ def performDragOperation_(self,sender):
+ pboard = sender.draggingPasteboard()
+ successful = False
+ if NSStringPboardType in pboard.types():
+ txt = pboard.stringForType_(NSStringPboardType)
+ self.controller.dragSearch(txt)
+ successful = True
+ return successful

0 comments on commit 4b50832

Please sign in to comment.