1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """
24 Repository object for GRAMPS.
25 """
26
27
28
29
30
31
32 from types import InstanceType
33
34
35
36
37
38
39 from gen.lib.primaryobj import PrimaryObject
40 from gen.lib.notebase import NoteBase
41 from gen.lib.addressbase import AddressBase
42 from gen.lib.urlbase import UrlBase
43 from gen.lib.repotype import RepositoryType
44 from gen.lib.markertype import MarkerType
45
46
47
48
49
50
51 -class Repository(NoteBase, AddressBase, UrlBase, PrimaryObject):
52 """A location where collections of Sources are found."""
53
64
75
77 """
78 Convert the data held in a tuple created by the serialize method
79 back into the data in a Repository structure.
80 """
81 (self.handle, self.gramps_id, the_type, self.name, note_list,
82 address_list, urls, self.change, marker, self.private) = data
83
84 self.marker = InstanceType(MarkerType)
85 self.marker.unserialize(marker)
86 self.type = InstanceType(RepositoryType)
87 self.type.unserialize(the_type)
88 NoteBase.unserialize(self, note_list)
89 AddressBase.unserialize(self, address_list)
90 UrlBase.unserialize(self, urls)
91
93 """
94 Return the list of all textual attributes of the object.
95
96 @return: Returns the list of all textual attributes of the object.
97 @rtype: list
98 """
99 return [self.name, str(self.type)]
100
102 """
103 Return the list of child objects that may carry textual data.
104
105 @return: Returns the list of child objects that may carry textual data.
106 @rtype: list
107 """
108 return self.address_list + self.urls
109
111 """
112 Return the list of child secondary objects that may refer sources.
113
114 @return: Returns the list of child secondary child objects that may
115 refer sources.
116 @rtype: list
117 """
118 return self.address_list
119
121 """
122 Return the list of child secondary objects that may refer notes.
123
124 @return: Returns the list of child secondary child objects that may
125 refer notes.
126 @rtype: list
127 """
128 return self.address_list
129
131 """
132 Return the list of child objects which may, directly or through
133 their children, reference primary objects.
134
135 @return: Returns the list of objects refereincing primary objects.
136 @rtype: list
137 """
138 return self.address_list
139
141 """
142 Return the list of (classname, handle) tuples for all directly
143 referenced primary objects.
144
145 @return: List of (classname, handle) tuples for referenced objects.
146 @rtype: list
147 """
148 return self.get_referenced_note_handles()
149
151 """
152 Return True if any of the child objects has reference to this source
153 handle.
154
155 @param src_handle: The source handle to be checked.
156 @type src_handle: str
157 @return: Returns whether any of it's child objects has reference to
158 this source handle.
159 @rtype: bool
160 """
161 for item in self.get_sourcref_child_list():
162 if item.has_source_reference(src_handle):
163 return True
164
165 return False
166
168 """
169 Remove references to all source handles in the list in all child
170 objects.
171
172 @param src_handle_list: The list of source handles to be removed.
173 @type src_handle_list: list
174 """
175 for item in self.get_sourcref_child_list():
176 item.remove_source_references(src_handle_list)
177
179 """
180 Replace references to source handles in the list in this object and
181 all child objects.
182
183 @param old_handle: The source handle to be replaced.
184 @type old_handle: str
185 @param new_handle: The source handle to replace the old one with.
186 @type new_handle: str
187 """
188 for item in self.get_sourcref_child_list():
189 item.replace_source_references(old_handle, new_handle)
190
192 """
193 @param the_type: descriptive type of the Repository
194 @type the_type: str
195 """
196 self.type.set(the_type)
197
199 """
200 @returns: the descriptive type of the Repository
201 @rtype: str
202 """
203 return self.type
204
206 """
207 @param name: descriptive name of the Repository
208 @type name: str
209 """
210 self.name = name
211
213 """
214 @returns: the descriptive name of the Repository
215 @rtype: str
216 """
217 return self.name
218