Drop hooks

From Silhouette Wiki
Revision as of 21:39, 18 November 2016 by Paul (talk | contribs) (Created page with "Register a "drop hook" with the new <i>trees</i> object. A drop hook is triggered when a specific mime type is dropped into the Trees view. def drop_hook(type, data): pri...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Register a "drop hook" with the new trees object. A drop hook is triggered when a specific mime type is dropped into the Trees view.

def drop_hook(type, data):

   print type, data
   if type is "text/plain":
       node = Node(data)
       activeSession().addNode(node)

trees.registerDropHook("text/plain", drop_hook) trees.registerDropHook("text/uri-list", drop_hook)