Package gen :: Package proxy :: Module proxybase
[frames] | no frames]

Source Code for Module gen.proxy.proxybase

  1  # 
  2  # Gramps - a GTK+/GNOME based genealogy program 
  3  # 
  4  # Copyright (C) 2007       Brian G. Matherly 
  5  # 
  6  # This program is free software; you can redistribute it and/or modify 
  7  # it under the terms of the GNU General Public License as published by 
  8  # the Free Software Foundation; either version 2 of the License, or 
  9  # (at your option) any later version. 
 10  # 
 11  # This program is distributed in the hope that it will be useful,  
 12  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
 13  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 14  # GNU General Public License for more details. 
 15  # 
 16  # You should have received a copy of the GNU General Public License 
 17  # along with this program; if not, write to the Free Software 
 18  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
 19  # 
 20   
 21  # $Id: proxybase.py 10103 2008-02-24 13:55:55Z acraphae $ 
 22   
 23  """ 
 24  Proxy class for the GRAMPS databases. Filter out all data marked private. 
 25  """ 
 26   
 27  #------------------------------------------------------------------------- 
 28  # 
 29  # GRAMPS libraries 
 30  # 
 31  #------------------------------------------------------------------------- 
 32  from dbbase import DbBase 
 33   
34 -class ProxyDbBase(DbBase):
35 """ 36 A proxy to a Gramps database. This proxy will act like a Gramps database, 37 but all data marked private will be hidden from the user. 38 """ 39
40 - def __init__(self, db):
41 """ 42 Create a new PrivateProxyDb instance. 43 """ 44 self.db = db 45 self.name_formats = db.name_formats 46 self.bookmarks = db.bookmarks 47 self.family_bookmarks = db.family_bookmarks 48 self.event_bookmarks = db.event_bookmarks 49 self.place_bookmarks = db.place_bookmarks 50 self.source_bookmarks = db.source_bookmarks 51 self.repo_bookmarks = db.repo_bookmarks 52 self.media_bookmarks = db.media_bookmarks 53 self.note_bookmarks = db.note_bookmarks
54
55 - def is_open(self):
56 """ 57 Return 1 if the database has been opened. 58 """ 59 return self.db.is_open
60
61 - def get_name_group_mapping(self, name):
62 """ 63 Return the default grouping name for a surname 64 """ 65 return self.db.get_name_group_mapping(name)
66
67 - def has_name_group_key(self, name):
68 """ 69 Return if a key exists in the name_group table 70 """ 71 return self.db.has_name_group_key(name)
72
73 - def get_name_group_keys(self):
74 """ 75 Return the defined names that have been assigned to a default grouping 76 """ 77 return self.db.get_name_group_keys()
78
79 - def get_number_of_people(self):
80 """ 81 Return the number of people currently in the databse. 82 """ 83 return len(self.get_person_handles())
84
85 - def get_number_of_families(self):
86 """ 87 Return the number of families currently in the databse. 88 """ 89 return len(self.get_family_handles())
90
91 - def get_number_of_events(self):
92 """ 93 Return the number of events currently in the databse. 94 """ 95 return len(self.get_event_handles())
96
97 - def get_number_of_places(self):
98 """ 99 Return the number of places currently in the databse. 100 """ 101 return len(self.get_place_handles())
102
103 - def get_number_of_sources(self):
104 """ 105 Return the number of sources currently in the databse. 106 """ 107 return len(self.get_source_handles())
108
110 """ 111 Return the number of media objects currently in the databse. 112 """ 113 return len(self.get_media_object_handles())
114
116 """ 117 Return the number of source repositories currently in the databse. 118 """ 119 return len(self.get_repository_handles())
120
121 - def get_number_of_notes(self):
122 """ 123 Return the number of notes currently in the databse. 124 """ 125 return self.db.get_number_of_notes()
126
127 - def get_save_path(self):
128 """returns the save path of the file, or "" if one does not exist""" 129 return self.db.get_save_path()
130
131 - def get_person_event_types(self):
132 """returns a list of all Event types assocated with Person 133 instances in the database""" 134 return self.db.get_person_event_types()
135
137 """returns a list of all Attribute types assocated with Person 138 instances in the database""" 139 return self.db.get_person_attribute_types()
140
142 """returns a list of all Attribute types assocated with Family 143 instances in the database""" 144 return self.db.get_family_attribute_types()
145
146 - def get_family_event_types(self):
147 """returns a list of all Event types assocated with Family 148 instances in the database""" 149 return self.db.get_family_event_types()
150
151 - def get_marker_types(self):
152 """return a list of all marker types available in the database""" 153 return self.db.get_marker_types()
154
156 """returns a list of all Attribute types assocated with Media 157 and MediaRef instances in the database""" 158 return self.db.get_media_attribute_types()
159
161 """returns a list of all relationship types assocated with Family 162 instances in the database""" 163 return self.db.get_family_relation_types()
164
166 """returns a list of all child reference types assocated with Family 167 instances in the database""" 168 return self.db.get_child_reference_types()
169
170 - def get_event_roles(self):
171 """returns a list of all custom event role names assocated with Event 172 instances in the database""" 173 return self.db.get_event_roles()
174
175 - def get_name_types(self):
176 """returns a list of all custom names types assocated with Person 177 instances in the database""" 178 return self.db.get_name_types()
179
180 - def get_repository_types(self):
181 """returns a list of all custom repository types assocated with 182 Repository instances in the database""" 183 return self.db.get_repository_types()
184
185 - def get_note_types(self):
186 """returns a list of all custom note types assocated with 187 Note instances in the database""" 188 return self.db.get_note_types()
189
190 - def get_source_media_types(self):
191 """returns a list of all custom source media types assocated with 192 Source instances in the database""" 193 return self.db.get_source_media_types()
194
195 - def get_url_types(self):
196 """returns a list of all custom names types assocated with Url 197 instances in the database""" 198 return self.db.get_url_types()
199
200 - def get_raw_person_data(self, handle):
201 return self.db.get_raw_person_data(handle)
202
203 - def get_raw_family_data(self, handle):
204 return self.db.get_raw_family_data(handle)
205
206 - def get_raw_object_data(self, handle):
207 return self.db.get_raw_object_data(handle)
208
209 - def get_raw_place_data(self, handle):
210 return self.db.get_raw_place_data(handle)
211
212 - def get_raw_event_data(self, handle):
213 return self.db.get_raw_event_data(handle)
214
215 - def get_raw_source_data(self, handle):
216 return self.db.get_raw_source_data(handle)
217
218 - def get_raw_repository_data(self, handle):
219 return self.db.get_raw_repository_data(handle)
220
221 - def get_raw_note_data(self, handle):
222 return self.db.get_raw_note_data(handle)
223
224 - def has_person_handle(self, handle):
225 """ 226 returns True if the handle exists in the current Person database. 227 """ 228 raise NotImplementedError
229
230 - def has_event_handle(self, handle):
231 """ 232 returns True if the handle exists in the current Event database. 233 """ 234 raise NotImplementedError
235
236 - def has_source_handle(self, handle):
237 """ 238 returns True if the handle exists in the current Source database. 239 """ 240 raise NotImplementedError
241
242 - def has_place_handle(self, handle):
243 """ 244 returns True if the handle exists in the current Place database. 245 """ 246 raise NotImplementedError
247
248 - def has_family_handle(self, handle):
249 """ 250 returns True if the handle exists in the current Family database. 251 """ 252 raise NotImplementedError
253
254 - def has_object_handle(self, handle):
255 """ 256 returns True if the handle exists in the current MediaObjectdatabase. 257 """ 258 raise NotImplementedError
259
260 - def has_repository_handle(self, handle):
261 """ 262 returns True if the handle exists in the current Repository database. 263 """ 264 raise NotImplementedError
265
266 - def has_note_handle(self, handle):
267 """ 268 returns True if the handle exists in the current Note database. 269 """ 270 raise NotImplementedError
271
272 - def get_mediapath(self):
273 """returns the default media path of the database""" 274 return self.db.get_mediapath()
275
276 - def set_column_order(self, col_list, name):
277 raise NotImplementedError
278
279 - def set_person_column_order(self, col_list):
280 """ 281 Stores the Person display common information in the 282 database's metadata. 283 """ 284 raise NotImplementedError
285
286 - def set_family_list_column_order(self, col_list):
287 """ 288 Stores the Person display common information in the 289 database's metadata. 290 """ 291 raise NotImplementedError
292
293 - def set_child_column_order(self, col_list):
294 """ 295 Stores the Person display common information in the 296 database's metadata. 297 """ 298 raise NotImplementedError
299
300 - def set_place_column_order(self, col_list):
301 """ 302 Stores the Place display common information in the 303 database's metadata. 304 """ 305 raise NotImplementedError
306
307 - def set_source_column_order(self, col_list):
308 """ 309 Stores the Source display common information in the 310 database's metadata. 311 """ 312 raise NotImplementedError
313
314 - def set_media_column_order(self, col_list):
315 """ 316 Stores the Media display common information in the 317 database's metadata. 318 """ 319 raise NotImplementedError
320
321 - def set_event_column_order(self, col_list):
322 """ 323 Stores the Event display common information in the 324 database's metadata. 325 """ 326 raise NotImplementedError
327
328 - def set_repository_column_order(self, col_list):
329 """ 330 Stores the Repository display common information in the 331 database's metadata. 332 """ 333 raise NotImplementedError
334
335 - def set_note_column_order(self, col_list):
336 """ 337 Stores the Note display common information in the 338 database's metadata. 339 """ 340 raise NotImplementedError
341
342 - def get_person_column_order(self):
343 """ 344 Return the Person display common information stored in the 345 database's metadata. 346 """ 347 raise NotImplementedError
348
349 - def get_family_list_column_order(self):
350 """ 351 Return the Person display common information stored in the 352 database's metadata. 353 """ 354 raise NotImplementedError
355
356 - def get_child_column_order(self):
357 """ 358 Return the Person display common information stored in the 359 database's metadata. 360 """ 361 raise NotImplementedError
362
363 - def get_place_column_order(self):
364 """ 365 Return the Place display common information stored in the 366 database's metadata. 367 """ 368 raise NotImplementedError
369
370 - def get_source_column_order(self):
371 """ 372 Return the Source display common information stored in the 373 database's metadata. 374 """ 375 raise NotImplementedError
376
377 - def get_media_column_order(self):
378 """ 379 Return the MediaObject display common information stored in the 380 database's metadata. 381 """ 382 raise NotImplementedError
383
384 - def get_event_column_order(self):
385 """ 386 Return the Event display common information stored in the 387 database's metadata. 388 """ 389 raise NotImplementedError
390
391 - def get_repository_column_order(self):
392 """ 393 Return the Repository display common information stored in the 394 database's metadata. 395 """ 396 raise NotImplementedError
397
398 - def get_note_column_order(self):
399 """ 400 Return the Note display common information stored in the 401 database's metadata. 402 """ 403 raise NotImplementedError
404
405 - def delete_primary_from_reference_map(self, handle, transaction):
406 """Called each time an object is removed from the database. This can 407 be used by subclasses to update any additional index tables that might 408 need to be changed.""" 409 raise NotImplementedError
410
411 - def update_reference_map(self, obj, transaction):
412 """Called each time an object is writen to the database. This can 413 be used by subclasses to update any additional index tables that might 414 need to be changed.""" 415 raise NotImplementedError
416
417 - def reindex_reference_map(self, callback):
418 """ 419 Reindex all primary records in the database. 420 421 """ 422 raise NotImplementedError
423 446
447 - def get_gramps_ids(self, obj_key):
448 return self.db.get_gramps_ids(obj_key)
449
450 - def has_gramps_id(self, obj_key, gramps_id):
451 return self.db.has_gramps_ids(obj_key, gramps_id)
452
453 - def get_bookmarks(self):
454 """returns the list of Person handles in the bookmarks""" 455 return self.bookmarks
456
457 - def get_family_bookmarks(self):
458 """returns the list of Person handles in the bookmarks""" 459 return self.family_bookmarks
460
461 - def get_event_bookmarks(self):
462 """returns the list of Person handles in the bookmarks""" 463 return self.event_bookmarks
464
465 - def get_place_bookmarks(self):
466 """returns the list of Person handles in the bookmarks""" 467 return self.place_bookmarks
468
469 - def get_source_bookmarks(self):
470 """returns the list of Person handles in the bookmarks""" 471 return self.source_bookmarks
472
473 - def get_media_bookmarks(self):
474 """returns the list of Person handles in the bookmarks""" 475 return self.media_bookmarks
476
477 - def get_repo_bookmarks(self):
478 """returns the list of Person handles in the bookmarks""" 479 return self.repo_bookmarks
480
481 - def get_note_bookmarks(self):
482 """returns the list of Note handles in the bookmarks""" 483 return self.note_bookmarks
484