2 from PyQt4
import QtCore
4 from cola
.compat
import set
5 from cola
.decorators
import memoize
8 debug
= os
.environ
.get('COLA_NOTIFIER_DEBUG', False)
16 class Notifier(object):
17 """A pure-python re-implementation of QObject."""
21 def broadcast(self
, signal
, *args
, **opts
):
23 print ('broadcast: %s(%s, %s)' % (name
,
26 self
.emit(signal
, *args
, **opts
)
28 def emit(self
, signal
, *args
, **opts
):
29 subscribers
= self
.channels
.get(signal
, None)
31 for fxn
in subscribers
:
34 def connect(self
, signal
, callback
):
35 subscribers
= self
.channels
.setdefault(signal
, set())
36 subscribers
.add(callback
)