diff options
author | Dieter Plaetinck <dieter@plaetinck.be> | 2009-11-11 15:20:23 +0100 |
---|---|---|
committer | Dieter Plaetinck <dieter@plaetinck.be> | 2009-11-11 15:20:23 +0100 |
commit | 7a885cf6db9ef93275625e0a522566ae82b7ffde (patch) | |
tree | 026e6ba5233a43f2ee5c749f7c3ca28ffac03b93 /examples | |
parent | ce7554c5951526ab5a392bb4b384ec090cc24d15 (diff) | |
parent | 2b74e733ba85215d8256c7dd573e16a6957196e5 (diff) |
Merge remote branch 'mason/experimental' into experimental
Diffstat (limited to 'examples')
-rw-r--r-- | examples/data/uzbl/plugins/bind.py | 18 | ||||
-rw-r--r-- | examples/data/uzbl/plugins/on_event.py | 5 | ||||
-rwxr-xr-x | examples/data/uzbl/scripts/uzbl-event-manager | 4 |
3 files changed, 12 insertions, 15 deletions
diff --git a/examples/data/uzbl/plugins/bind.py b/examples/data/uzbl/plugins/bind.py index b8494fe..89b0831 100644 --- a/examples/data/uzbl/plugins/bind.py +++ b/examples/data/uzbl/plugins/bind.py @@ -11,7 +11,6 @@ And it is also possible to execute a function on activation: import sys import re -from event_manager import config, counter, iscallable, isiterable # Export these variables/functions to uzbl.<name> __export__ = ['bind', 'del_bind', 'del_bind_by_glob', 'get_binds'] @@ -31,11 +30,6 @@ class BindParseError(Exception): pass -def echo(msg): - if config['verbose']: - print 'bind plugin:', msg - - def error(msg): sys.stderr.write('bind plugin: error: %s\n' % msg) @@ -132,10 +126,11 @@ def del_bind_by_glob(uzbl, glob): class Bind(object): - nextbid = counter().next + # Class attribute to hold the number of Bind classes created. + counter = [0,] def __init__(self, glob, handler, *args, **kargs): - self.is_callable = iscallable(handler) + self.is_callable = callable(handler) self._repr_cache = None if not glob: @@ -149,14 +144,17 @@ class Bind(object): elif kargs: raise ArgumentError('cannot supply kargs for uzbl commands') - elif isiterable(handler): + elif hasattr(handler, '__iter__'): self.commands = handler else: self.commands = [handler,] + list(args) self.glob = glob - self.bid = self.nextbid() + + # Assign unique id. + self.counter[0] += 1 + self.bid = self.counter[0] self.split = split = find_prompts(glob) self.prompts = [] diff --git a/examples/data/uzbl/plugins/on_event.py b/examples/data/uzbl/plugins/on_event.py index 242f9b0..3dfc3fa 100644 --- a/examples/data/uzbl/plugins/on_event.py +++ b/examples/data/uzbl/plugins/on_event.py @@ -18,16 +18,11 @@ Usage: import sys import re -from event_manager import config __export__ = ['get_on_events', 'on_event'] UZBLS = {} -def echo(msg): - if config['verbose']: - print 'on_event plugin:', msg - def error(msg): sys.stderr.write('on_event plugin: error: %s\n' % msg) diff --git a/examples/data/uzbl/scripts/uzbl-event-manager b/examples/data/uzbl/scripts/uzbl-event-manager index dee42c5..eb4a470 100755 --- a/examples/data/uzbl/scripts/uzbl-event-manager +++ b/examples/data/uzbl/scripts/uzbl-event-manager @@ -335,6 +335,10 @@ class EventHandler(object): class UzblInstance(object): + + # Give all plugins access to the main config dict. + config = config + def __init__(self, parent, client_socket): # Internal variables. |