1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """
24 Event Reference class for GRAMPS
25 """
26
27
28
29
30
31
32 from types import InstanceType
33
34
35
36
37
38
39 from gen.lib.secondaryobj import SecondaryObject
40 from gen.lib.privacybase import PrivacyBase
41 from gen.lib.notebase import NoteBase
42 from gen.lib.attrbase import AttributeBase
43 from gen.lib.refbase import RefBase
44 from gen.lib.eventroletype import EventRoleType
45
46
47
48
49
50
51 -class EventRef(SecondaryObject, PrivacyBase, NoteBase, AttributeBase, RefBase):
52 """
53 Event reference class.
54
55 This class is for keeping information about how the person relates
56 to the refereneced event.
57 """
58
71
83
96
98 """
99 Return the list of all textual attributes of the object.
100
101 @return: Returns the list of all textual attributes of the object.
102 @rtype: list
103 """
104 return [str(self.role)]
105
107 """
108 Return the list of child objects that may carry textual data.
109
110 @return: Returns the list of child objects that may carry textual data.
111 @rtype: list
112 """
113 return self.attribute_list
114
116 """
117 Return the list of child secondary objects that may refer sources.
118
119 @return: Returns the list of child secondary child objects that may
120 refer sources.
121 @rtype: list
122 """
123 return self.attribute_list
124
126 """
127 Return the list of child secondary objects that may refer notes.
128
129 @return: Returns the list of child secondary child objects that may
130 refer notes.
131 @rtype: list
132 """
133 return self.attribute_list
134
136 """
137 Return the list of (classname, handle) tuples for all directly
138 referenced primary objects.
139
140 @return: Returns the list of (classname, handle) tuples for referenced
141 objects.
142 @rtype: list
143 """
144 ret = self.get_referenced_note_handles()
145 if self.ref:
146 ret += [('Event', self.ref)]
147 return ret
148
150 """
151 Return the list of child objects which may, directly or through their
152 children, reference primary objects..
153
154 @return: Returns the list of objects refereincing primary objects.
155 @rtype: list
156 """
157 return self.get_sourcref_child_list()
158
160 """
161 Return True if any of the child objects has reference to this source
162 handle.
163
164 @param src_handle: The source handle to be checked.
165 @type src_handle: str
166 @return: Returns whether any of it's child objects has reference to
167 this source handle.
168 @rtype: bool
169 """
170 for item in self.get_sourcref_child_list():
171 if item.has_source_reference(src_handle):
172 return True
173
174 return False
175
177 """
178 Remove references to all source handles in the list in all child
179 objects.
180
181 @param src_handle_list: The list of source handles to be removed.
182 @type src_handle_list: list
183 """
184 for item in self.get_sourcref_child_list():
185 item.remove_source_references(src_handle_list)
186
188 """
189 Replace references to source handles in the list in this object and
190 all child objects.
191
192 @param old_handle: The source handle to be replaced.
193 @type old_handle: str
194 @param new_handle: The source handle to replace the old one with.
195 @type new_handle: str
196 """
197 for item in self.get_sourcref_child_list():
198 item.replace_source_references(old_handle, new_handle)
199
201 """
202 Return the tuple corresponding to the preset role.
203 """
204 return self.role
205
207 """
208 Set the role according to the given argument.
209 """
210 self.role.set(role)
211