1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 """
18 Notifying dictionary.
19 """
20
21 import gobject
22
23
25
26 """
27 A notifier that emits an items-changed signal when its associated dictionary
28 is updated.
29
30 The items-changed signal is emitted with three parameters: the dictionary
31 itself, the key of the modified item, the value of the modified item.
32 """
33
34 __gsignals__ = \
35 {'items-changed': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_PYOBJECT,
36 (gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT)),
37 }
38
39 gobject.type_register(Notifier)
40
41
43
44 """
45 A dictionary that emits a signal when items are set/modified.
46
47 The signal is emitted through a L{Notifier} object.
48 """
49
50
51
52
53
54
55
56
57
58
62
66
68 dict.update(self, other)
69 self.notifier.emit('items-changed', self, other)
70
72 new_dict = self.__class__(self)
73 return new_dict
74