From b0e7190acd1c266b20d2624051d6932bbf90a3d9 Mon Sep 17 00:00:00 2001 From: Mason Larobina Date: Fri, 1 Jan 2010 17:16:09 +0800 Subject: Use new export mechanism in all plugins. --- examples/data/uzbl/plugins/plugin_template.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'examples/data/uzbl/plugins/plugin_template.py') diff --git a/examples/data/uzbl/plugins/plugin_template.py b/examples/data/uzbl/plugins/plugin_template.py index 03cb748..565a999 100644 --- a/examples/data/uzbl/plugins/plugin_template.py +++ b/examples/data/uzbl/plugins/plugin_template.py @@ -1,8 +1,5 @@ '''Plugin template.''' -# A list of functions this plugin exports to be used via uzbl object. -__export__ = ['myplugin_function',] - # Holds the per-instance data dict. UZBLS = {} @@ -60,16 +57,20 @@ def init(uzbl): # Make a dictionary comprising of {"EVENT_NAME": handler, ..} to the event # handler stack: - connects = { - 'INSTANCE_START': add_instance, - 'INSTANCE_EXIT': del_instance, - 'MYPLUGIN_EVENT': myplugin_event_parser, - } - - # And connect the dicts event handlers to the handler stack. - uzbl.connect_dict(connects) + uzbl.connect_dict({ + # event name function + 'INSTANCE_START': add_instance, + 'INSTANCE_EXIT': del_instance, + 'MYPLUGIN_EVENT': myplugin_event_parser, + }) # Or connect a handler to an event manually and supply additional optional # arguments: - #uzbl.connect("MYOTHER_EVENT", myother_event_parser, True, limit=20) + + # Function exports to the uzbl object, `function(uzbl, *args, ..)` + # becomes `uzbl.function(*args, ..)`. + uzbl.connect_dict({ + # external name function + 'myplugin_function': myplugin_function, + }) -- cgit v1.2.3