aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Dieter Plaetinck <dieter@plaetinck.be>2009-11-11 15:20:23 +0100
committerGravatar Dieter Plaetinck <dieter@plaetinck.be>2009-11-11 15:20:23 +0100
commit7a885cf6db9ef93275625e0a522566ae82b7ffde (patch)
tree026e6ba5233a43f2ee5c749f7c3ca28ffac03b93
parentce7554c5951526ab5a392bb4b384ec090cc24d15 (diff)
parent2b74e733ba85215d8256c7dd573e16a6957196e5 (diff)
Merge remote branch 'mason/experimental' into experimental
-rw-r--r--examples/data/uzbl/plugins/bind.py18
-rw-r--r--examples/data/uzbl/plugins/on_event.py5
-rwxr-xr-xexamples/data/uzbl/scripts/uzbl-event-manager4
-rwxr-xr-xuzbl-browser10
4 files changed, 18 insertions, 19 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.
diff --git a/uzbl-browser b/uzbl-browser
index 86da2e5..eebf9e3 100755
--- a/uzbl-browser
+++ b/uzbl-browser
@@ -47,11 +47,13 @@ then
fi
fi
-if [ ! -S $XDG_CACHE_HOME/uzbl/cookie_daemon_socket ]
-then
+# Uncomment this for a slight speedup at the expense of not having
+# stale cookie daemon sockets cleaned up.
+#if [ ! -S $XDG_CACHE_HOME/uzbl/cookie_daemon_socket ]
+#then
# if you want to customize it, copy to your $XDG_DATA_HOME/uzbl/scripts/ and update $PATH
- uzbl-cookie-daemon
-fi
+ uzbl-cookie-daemon -v start
+#fi
DAEMON_SOCKET=$XDG_CACHE_HOME/uzbl/event_daemon
DAEMON_PID=${DAEMON_SOCKET}.pid