qobserver: Handle editable combo boxes in 'SLOT()'
[git-cola.git] / cola / notification.py
blob6f079908cb4e5a873ca2d4f4c2fe101677802099
1 import os
2 from PyQt4 import QtCore
3 from cola import signals
5 debug = os.environ.get('COLA_NOTIFIER_DEBUG', False)
6 _instance = None
7 def notifier():
8 global _instance
9 if _instance:
10 return _instance
11 _instance = QNotifier()
12 return _instance
15 class QNotifier(QtCore.QObject):
16 def broadcast(self, signal, *args, **kwargs):
17 if debug:
18 print ('broadcast: %s(%s, %s)' % (signals.name(signal),
19 args or '<empty>',
20 kwargs or '<empty>'))
21 self.emit(signal, *args, **kwargs)
23 def listen(self, signal, callback):
24 self.connect(self, signal, callback)