aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/data/uzbl/plugins/cmd_expand.py
diff options
context:
space:
mode:
authorGravatar Mason Larobina <mason.larobina@gmail.com>2010-01-01 16:55:39 +0800
committerGravatar Mason Larobina <mason.larobina@gmail.com>2010-01-01 16:55:39 +0800
commit3d9e04194d816f28621b6f3fdd5c73d58f271545 (patch)
tree78a0ea021f361381348e04c5f184daa84fc02501 /examples/data/uzbl/plugins/cmd_expand.py
parent3a73a42aae448240211d6d96349f1afb7e4e4996 (diff)
Correctness re-write of the export mechanism.
Exporting is now done with the following two new functions: 1. `uzbl.export('external_name', function)` 2. `uzbl.export_dict({'name1': func1, 'name2': func2, ...})` This system is preferable to the old `__export__` variable for several reasons. The first being that the exporting system is now very similar to the connect (read: `uzbl.connect(..)` and `uzbl.connect_dict({..})`) system in the event manager. And consider the following: 1. User wishes to write a plugin that doesn't connect to any events but exports a function. 2. It's an arbitrary requirement that a plugin have an `init(uzbl)` function. 3. The user would have done the following (example plugin snippet): __export__ = 'my_function' def my_function(uzbl, ..): # Do something def init(uzbl): # Do nothing pass 4. The user now does the following: def my_function(uzbl, ..): # do something def init(uzbl): uzbl.export('my_function', my_function) Note that the name in `uzbl.export('external_name', function)` doesn't need to match the function name. Example pseudo-python: # In the plugin >>> def hello(uzbl): ... return "Hello, World!" >>> def init(uzbl): ... uzbl.export('say_hello', hello) ... print uzbl.say_hello() # In the event manager >>> plugin.init(uzbl) Hello, World!
Diffstat (limited to 'examples/data/uzbl/plugins/cmd_expand.py')
0 files changed, 0 insertions, 0 deletions