aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/data/uzbl/plugins/bind.py
diff options
context:
space:
mode:
authorGravatar Mason Larobina <mason.larobina@gmail.com>2009-11-11 20:01:34 +0800
committerGravatar Mason Larobina <mason.larobina@gmail.com>2009-11-11 20:01:34 +0800
commit2b74e733ba85215d8256c7dd573e16a6957196e5 (patch)
tree81b0bb52d92887485f57f2a66ffba31c736e5d04 /examples/data/uzbl/plugins/bind.py
parent8fff4f72cd23a1881c8ee8d776a924acfb877955 (diff)
Remove useless event manager imports.
Diffstat (limited to 'examples/data/uzbl/plugins/bind.py')
-rw-r--r--examples/data/uzbl/plugins/bind.py18
1 files changed, 8 insertions, 10 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 = []