~ubuntu-branches/ubuntu/trusty/pitivi/trusty

« back to all changes in this revision

Viewing changes to pitivi/receiver.py

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2011-07-07 13:43:47 UTC
  • mto: (6.1.9 sid) (1.2.12)
  • mto: This revision was merged to the branch mainline in revision 32.
  • Revision ID: james.westby@ubuntu.com-20110707134347-cari9kxjiakzej9z
Tags: upstream-0.14.1
ImportĀ upstreamĀ versionĀ 0.14.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
from types import MethodType
2
2
 
 
3
 
3
4
class _receiver_data(object):
4
5
 
5
6
    sender = None
6
7
    sigids = None
7
8
 
 
9
 
8
10
class receiver(object):
9
11
 
10
12
    """A descriptor which wrapps signal connect and disconnect for a single
26
28
    def __set__(self, instance, value):
27
29
        if not hasattr(instance, "_receiver_data"):
28
30
            instance._receiver_data = {}
29
 
        if not instance._receiver_data.has_key(self):
 
31
        if not self in instance._receiver_data:
30
32
            instance._receiver_data[self] = _receiver_data()
31
33
            instance._receiver_data[self].sigids = {}
32
34
        rd = instance._receiver_data[self]
51
53
    def add_handler(self, signal, hdlr):
52
54
        self.handlers[signal] = hdlr
53
55
 
 
56
 
54
57
def handler(prop, signal):
55
58
 
56
59
    """A decorator which registers a given function as a signal handler for