Implemented database upgrade for all eligible remaining object types.
Added Citations to undo-redo feature. Moved Citation view within navigation pane to below Sources. Removed useless edit button from sourcebackreflist. Fixed default bottombar gramplets for citations. svn: r18069
This commit is contained in:
parent
165625715d
commit
d3dcbb1c12
@ -188,7 +188,7 @@ register('interface.dont-ask', False)
|
||||
register('interface.view-categories',
|
||||
["Gramplets", "People", "Relationships", "Families",
|
||||
"Ancestry", "Events", "Places", "Geography", "Sources",
|
||||
"Repositories", "Media", "Notes"])
|
||||
"Citations", "Repositories", "Media", "Notes"])
|
||||
register('interface.edit-rule-width', 600)
|
||||
register('interface.edit-rule-height', 450)
|
||||
register('interface.event-height', 450)
|
||||
|
@ -2,6 +2,7 @@
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2007 Donald N. Allingham
|
||||
# Copyright (C) 2011 Tim G L Lyons
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -60,7 +61,7 @@ import cPickle as pickle
|
||||
#------------------------------------------------------------------------
|
||||
from gen.db.exceptions import DbException
|
||||
from gen.db.write import FAMILY_TBL, PLACES_TBL, SOURCES_TBL, MEDIA_TBL, \
|
||||
EVENTS_TBL, PERSON_TBL, REPO_TBL, NOTE_TBL, TAG_TBL, META
|
||||
EVENTS_TBL, PERSON_TBL, REPO_TBL, NOTE_TBL, TAG_TBL, META, CITATIONS_TBL
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -201,6 +202,7 @@ def __build_tbl_map(database):
|
||||
( FAMILY_TBL, database.family_map.db),
|
||||
( PLACES_TBL, database.place_map.db),
|
||||
( SOURCES_TBL, database.source_map.db),
|
||||
( CITATIONS_TBL, database.citation_map.db),
|
||||
( REPO_TBL, database.repository_map.db),
|
||||
( NOTE_TBL, database.note_map.db),
|
||||
( MEDIA_TBL, database.media_map.db),
|
||||
|
@ -560,10 +560,8 @@ class DbBsddbRead(DbReadBase, Callback):
|
||||
Return the next available GRAMPS' ID for a Source object based off the
|
||||
source ID prefix.
|
||||
"""
|
||||
LOG.debug("cid_index %s" % [self.cid_trans])
|
||||
self.cmap_index, gid = self.__find_next_gramps_id(self.citation_prefix,
|
||||
self.cmap_index, self.cid_trans)
|
||||
LOG.debug("gid %s" % gid)
|
||||
return gid
|
||||
|
||||
def find_next_family_gramps_id(self):
|
||||
|
@ -39,28 +39,125 @@ else:
|
||||
from gen.db import BSDDBTxn, DbTxn
|
||||
from gen.lib.nameorigintype import NameOriginType
|
||||
from gen.db.write import _mkname, SURNAMES
|
||||
|
||||
num_citations = 0
|
||||
from gen.db.dbconst import (PERSON_KEY, FAMILY_KEY, EVENT_KEY,
|
||||
MEDIA_KEY, PLACE_KEY)
|
||||
from QuestionDialog import (InfoDialog)
|
||||
|
||||
def gramps_upgrade_16(self):
|
||||
"""Upgrade database from version 15 to 16. This upgrade converts all
|
||||
SourceRef child objects to Citation Primary objects.
|
||||
|
||||
For each primary object that has a sourceref, what we have to do is:
|
||||
|
||||
(1) create each citation
|
||||
(2) update the object to reference the Citations
|
||||
(3) remove backlinks for references from object to Source
|
||||
(4) add backlinks for references from object to Citations
|
||||
(5) add backlinks for references from Citation to Source
|
||||
|
||||
the backlinks are all updated at the end by calling
|
||||
reindex_reference_map
|
||||
|
||||
"""
|
||||
global num_citations
|
||||
length = (len(self.note_map) + len(self.person_map) +
|
||||
len(self.event_map) + len(self.family_map) +
|
||||
len(self.repository_map) + len(self.media_map) +
|
||||
len(self.place_map) + len(self.source_map)) + 10
|
||||
self.set_total(length)
|
||||
|
||||
LOG.debug("self %s" % self)
|
||||
LOG.debug("self.find_next_citation_gramps_id %s" %
|
||||
self.find_next_citation_gramps_id)
|
||||
t = time.time()
|
||||
num_citations = 0
|
||||
# Setup data for upgrade statistics information dialogue
|
||||
keyorder = [PERSON_KEY, FAMILY_KEY, EVENT_KEY, MEDIA_KEY,
|
||||
PLACE_KEY]
|
||||
key2data = {
|
||||
PERSON_KEY : 0,
|
||||
FAMILY_KEY : 1,
|
||||
EVENT_KEY: 2,
|
||||
MEDIA_KEY: 3,
|
||||
PLACE_KEY: 4,
|
||||
}
|
||||
key2string = {
|
||||
PERSON_KEY : _('%6d People upgraded with %6d citations in %6d secs\n'),
|
||||
FAMILY_KEY : _('%6d Families upgraded with %6d citations in %6d secs\n'),
|
||||
EVENT_KEY : _('%6d Events upgraded with %6d citations in %6d secs\n'),
|
||||
MEDIA_KEY : _('%6d Media Objects upgraded with %6d citations in %6d secs\n'),
|
||||
PLACE_KEY : _('%6d Places upgraded with %6d citations in %6d secs\n'),
|
||||
}
|
||||
data_upgradeobject = [0] * 5
|
||||
|
||||
# Initialise the citation gramps ID number
|
||||
self.cmap_index = 0
|
||||
|
||||
# ---------------------------------
|
||||
# Modify Person
|
||||
# ---------------------------------
|
||||
start_num_citations = self.cmap_index
|
||||
start_time = time.time()
|
||||
for person_handle in self.person_map.keys():
|
||||
person = self.person_map[person_handle]
|
||||
with DbTxn(_("convert a person record"), self, batch=True,
|
||||
no_magic=True) as transaction:
|
||||
(handle, gramps_id, gender, primary_name, alternate_names,
|
||||
death_ref_index, birth_ref_index, event_ref_list, family_list,
|
||||
parent_family_list, media_list, address_list, attribute_list,
|
||||
urls, lds_seal_list, source_list, note_list, change, tag_list,
|
||||
private, person_ref_list) = person
|
||||
if primary_name:
|
||||
primary_name = upgrade_name_16(self, primary_name, transaction)
|
||||
if alternate_names:
|
||||
alternate_names = upgrade_name_list_16(
|
||||
self, alternate_names, transaction)
|
||||
if address_list:
|
||||
address_list = upgrade_address_list_16(
|
||||
self, address_list, transaction)
|
||||
if media_list:
|
||||
media_list = upgrade_media_list_16(
|
||||
self, media_list, transaction)
|
||||
if attribute_list:
|
||||
attribute_list = upgrade_attribute_list_16(
|
||||
self, attribute_list, transaction)
|
||||
if lds_seal_list:
|
||||
lds_seal_list = upgrade_lds_seal_list_16(
|
||||
self, lds_seal_list, transaction)
|
||||
if source_list:
|
||||
new_citation_list = convert_source_list_to_citation_list_16(
|
||||
self, source_list, transaction)
|
||||
else:
|
||||
new_citation_list = []
|
||||
if person_ref_list:
|
||||
person_ref_list = upgrade_person_ref_list_16(
|
||||
self, person_ref_list, transaction)
|
||||
if primary_name or alternate_names or address_list or \
|
||||
media_list or attribute_list or lds_seal_list or source_list or \
|
||||
person_ref_list:
|
||||
new_person = (handle, gramps_id, gender, primary_name,
|
||||
alternate_names, death_ref_index,
|
||||
birth_ref_index, event_ref_list, family_list,
|
||||
parent_family_list, media_list, address_list,
|
||||
attribute_list, urls, lds_seal_list,
|
||||
new_citation_list, note_list, change, tag_list,
|
||||
private, person_ref_list)
|
||||
with BSDDBTxn(self.env, self.person_map) as txn:
|
||||
txn.put(str(handle), new_person, txn=transaction)
|
||||
# with BSDDBTxn(self.env) as txn:
|
||||
# self.update_reference_map(
|
||||
# self.get_person_from_handle(handle),
|
||||
# transaction,
|
||||
# txn.txn)
|
||||
self.update()
|
||||
|
||||
LOG.debug("%d persons upgraded with %d citations in %d seconds. " %
|
||||
(len(self.person_map.keys()),
|
||||
self.cmap_index - start_num_citations,
|
||||
time.time() - start_time))
|
||||
data_upgradeobject[key2data[PERSON_KEY]] = (len(self.person_map.keys()),
|
||||
self.cmap_index - start_num_citations,
|
||||
time.time() - start_time)
|
||||
|
||||
# ---------------------------------
|
||||
# Modify Media
|
||||
# ---------------------------------
|
||||
start_num_citations = self.cmap_index
|
||||
start_time = time.time()
|
||||
for media_handle in self.media_map.keys():
|
||||
media = self.media_map[media_handle]
|
||||
LOG.debug("upgrade media %s" % media[4])
|
||||
@ -96,22 +193,121 @@ def gramps_upgrade_16(self):
|
||||
# (get_object is really get_MediaObject !)
|
||||
LOG.debug(" update ref map media %s" % [handle,
|
||||
self.get_object_from_handle(handle) ])
|
||||
with BSDDBTxn(self.env) as txn:
|
||||
self.update_reference_map(
|
||||
self.get_object_from_handle(handle),
|
||||
transaction,
|
||||
txn.txn)
|
||||
|
||||
# with BSDDBTxn(self.env) as txn:
|
||||
# self.update_reference_map(
|
||||
# self.get_object_from_handle(handle),
|
||||
# transaction,
|
||||
# txn.txn)
|
||||
self.update()
|
||||
|
||||
LOG.debug("Media upgrade %d citations upgraded in %d seconds" %
|
||||
(num_citations, int(time.time()-t)))
|
||||
(self.cmap_index - start_num_citations,
|
||||
int(time.time() - start_time)))
|
||||
data_upgradeobject[key2data[MEDIA_KEY]] = (len(self.media_map.keys()),
|
||||
self.cmap_index - start_num_citations,
|
||||
time.time() - start_time)
|
||||
|
||||
# ---------------------------------
|
||||
# Modify Places
|
||||
# ---------------------------------
|
||||
start_num_citations = self.cmap_index
|
||||
start_time = time.time()
|
||||
for place_handle in self.place_map.keys():
|
||||
place = self.place_map[place_handle]
|
||||
with DbTxn(_("convert a place record"), self, batch=True,
|
||||
no_magic=True) as transaction:
|
||||
(handle, gramps_id, title, long, lat,
|
||||
main_loc, alt_loc, urls, media_list, source_list, note_list,
|
||||
change, private) = place
|
||||
if source_list:
|
||||
new_citation_list = convert_source_list_to_citation_list_16(
|
||||
self, source_list, transaction)
|
||||
else:
|
||||
new_citation_list = []
|
||||
if media_list:
|
||||
media_list = upgrade_media_list_16(
|
||||
self, media_list, transaction)
|
||||
if source_list or media_list:
|
||||
new_place = (handle, gramps_id, title,
|
||||
long, lat, main_loc, alt_loc, urls,
|
||||
media_list, new_citation_list, note_list,
|
||||
change, private)
|
||||
with BSDDBTxn(self.env, self.place_map) as txn:
|
||||
txn.put(str(handle), new_place, txn=transaction)
|
||||
# with BSDDBTxn(self.env) as txn:
|
||||
# self.update_reference_map(
|
||||
# self.get_place_from_handle(handle),
|
||||
# transaction,
|
||||
# txn.txn)
|
||||
self.update()
|
||||
|
||||
LOG.debug("%d places upgraded with %d citations in %d seconds. " %
|
||||
(len(self.place_map.keys()),
|
||||
self.cmap_index - start_num_citations,
|
||||
time.time() - start_time))
|
||||
data_upgradeobject[key2data[PLACE_KEY]] = (len(self.place_map.keys()),
|
||||
self.cmap_index - start_num_citations,
|
||||
time.time() - start_time)
|
||||
|
||||
# ---------------------------------
|
||||
# Modify Families
|
||||
# ---------------------------------
|
||||
start_num_citations = self.cmap_index
|
||||
start_time = time.time()
|
||||
for family_handle in self.family_map.keys():
|
||||
family = self.family_map[family_handle]
|
||||
with DbTxn(_("convert a family record"), self, batch=True,
|
||||
no_magic=True) as transaction:
|
||||
(handle, gramps_id, father_handle, mother_handle,
|
||||
child_ref_list, the_type, event_ref_list, media_list,
|
||||
attribute_list, lds_seal_list, source_list, note_list,
|
||||
change, tag_list, private) = family
|
||||
if source_list:
|
||||
new_citation_list = convert_source_list_to_citation_list_16(
|
||||
self, source_list, transaction)
|
||||
else:
|
||||
new_citation_list = []
|
||||
if child_ref_list:
|
||||
child_ref_list = upgrade_child_ref_list_16(
|
||||
self, child_ref_list, transaction)
|
||||
if lds_seal_list:
|
||||
lds_seal_list = upgrade_lds_seal_list_16(
|
||||
self, lds_seal_list, transaction)
|
||||
if media_list:
|
||||
media_list = upgrade_media_list_16(
|
||||
self, media_list, transaction)
|
||||
if attribute_list:
|
||||
attribute_list = upgrade_attribute_list_16(
|
||||
self, attribute_list, transaction)
|
||||
if source_list or media_list or child_ref_list or \
|
||||
attribute_list or lds_seal_list:
|
||||
new_family = (handle, gramps_id, father_handle, mother_handle,
|
||||
child_ref_list, the_type, event_ref_list, media_list,
|
||||
attribute_list, lds_seal_list, new_citation_list, note_list,
|
||||
change, tag_list, private)
|
||||
with BSDDBTxn(self.env, self.family_map) as txn:
|
||||
txn.put(str(handle), new_family, txn=transaction)
|
||||
# with BSDDBTxn(self.env) as txn:
|
||||
# self.update_reference_map(
|
||||
# self.get_family_from_handle(handle),
|
||||
# transaction,
|
||||
# txn.txn)
|
||||
self.update()
|
||||
|
||||
LOG.debug("%d familys upgraded with %d citations in %d seconds. " %
|
||||
(len(self.family_map.keys()),
|
||||
self.cmap_index - start_num_citations,
|
||||
time.time() - start_time))
|
||||
data_upgradeobject[key2data[FAMILY_KEY]] = (len(self.family_map.keys()),
|
||||
self.cmap_index - start_num_citations,
|
||||
time.time() - start_time)
|
||||
# ---------------------------------
|
||||
# Modify Events
|
||||
# ---------------------------------
|
||||
upgrade_time = 0
|
||||
backlink_time = 0
|
||||
start_num_citations = self.cmap_index
|
||||
start_time = time.time()
|
||||
for event_handle in self.event_map.keys():
|
||||
t1 = time.time()
|
||||
event = self.event_map[event_handle]
|
||||
@ -131,9 +327,7 @@ def gramps_upgrade_16(self):
|
||||
if media_list:
|
||||
media_list = upgrade_media_list_16(
|
||||
self, media_list, transaction)
|
||||
# FIXME: events also have sources for places
|
||||
if source_list or attribute_list or media_list:
|
||||
LOG.debug("upgrade event %s: %s" % (event[1], event [4]))
|
||||
new_event = (handle, gramps_id, the_type, date, description, place,
|
||||
new_citation_list, note_list, media_list,
|
||||
attribute_list,
|
||||
@ -145,42 +339,31 @@ def gramps_upgrade_16(self):
|
||||
upgrade_time += t2 - t1
|
||||
# remove backlinks for references from Media to Source
|
||||
# add backlinks for references from Media to Citations
|
||||
if source_list or attribute_list or media_list:
|
||||
LOG.debug(" upgrade backlinks %s" %
|
||||
[source_list, attribute_list, media_list])
|
||||
with BSDDBTxn(self.env) as txn:
|
||||
self.update_reference_map(
|
||||
self.get_event_from_handle(handle),
|
||||
transaction,
|
||||
txn.txn)
|
||||
# if source_list or attribute_list or media_list:
|
||||
# LOG.debug(" upgrade backlinks %s" %
|
||||
# [source_list, attribute_list, media_list])
|
||||
# with BSDDBTxn(self.env) as txn:
|
||||
# self.update_reference_map(
|
||||
# self.get_event_from_handle(handle),
|
||||
# transaction,
|
||||
# txn.txn)
|
||||
t3 = time.time()
|
||||
backlink_time += t3 - t2
|
||||
self.update()
|
||||
t3 = time.time()
|
||||
backlink_time += t3 - t2
|
||||
|
||||
LOG.debug("%d events upgraded with %d citations in %d seconds. "
|
||||
"Backlinks took %d seconds" %
|
||||
(len(self.event_map.keys()), num_citations,
|
||||
(len(self.event_map.keys()),
|
||||
self.cmap_index - start_num_citations,
|
||||
int(upgrade_time), int(backlink_time)))
|
||||
data_upgradeobject[key2data[EVENT_KEY]] = (len(self.event_map.keys()),
|
||||
self.cmap_index - start_num_citations,
|
||||
time.time() - start_time)
|
||||
|
||||
# FIXME: some useful code snipetts for building an information dialogue
|
||||
# about the speed of datatbase upgrade.
|
||||
# self.data_newobject = [0] * 9
|
||||
# self.data_newobject[self.key2data[key]] += 1
|
||||
# key2string = {
|
||||
# PERSON_KEY : _(' People: %d\n'),
|
||||
# FAMILY_KEY : _(' Families: %d\n'),
|
||||
# SOURCE_KEY : _(' Sources: %d\n'),
|
||||
# EVENT_KEY : _(' Events: %d\n'),
|
||||
# MEDIA_KEY : _(' Media Objects: %d\n'),
|
||||
# PLACE_KEY : _(' Places: %d\n'),
|
||||
# REPOSITORY_KEY : _(' Repositories: %d\n'),
|
||||
# NOTE_KEY : _(' Notes: %d\n'),
|
||||
# TAG_KEY : _(' Tags: %d\n'),
|
||||
# }
|
||||
# txt = _("Number of new objects imported:\n")
|
||||
# for key in self.keyorder:
|
||||
# txt += key2string[key] % self.data_newobject[self.key2data[key]]
|
||||
# InfoDialog(_('Upgrade Statistics'), infotxt, self.window)
|
||||
# ---------------------------------
|
||||
|
||||
|
||||
# ---------------------------------
|
||||
# Example database from repository took:
|
||||
# 3403 events upgraded with 8 citations in 23 seconds. Backlinks took 1071 seconds
|
||||
# actually 4 of these citations were from:
|
||||
@ -190,9 +373,57 @@ def gramps_upgrade_16(self):
|
||||
# 3403 events upgraded with 8 citations in 19 seconds. Backlinks took 1348 seconds
|
||||
# further improved by skipping debug logging:
|
||||
# 3403 events upgraded with 8 citations in 2 seconds. Backlinks took 167 seconds
|
||||
|
||||
#Number of new objects upgraded:
|
||||
# 2090 People upgraded with 2092 citations in 2148 secs
|
||||
# 734 Families upgraded with 735 citations in 768 secs
|
||||
# 3403 Events upgraded with 4 citations in 212 secs
|
||||
# 7 Media Objects upgraded with 4 citations in 3 secs
|
||||
# 852 Places upgraded with 0 citations in 39 secs
|
||||
|
||||
# with reduced diagnostics
|
||||
#Number of new objects upgraded:
|
||||
# 73 People upgraded with 76 citations in 74 secs
|
||||
# 35 Families upgraded with 36 citations in 31 secs
|
||||
# 3403 Events upgraded with 4 citations in 7 secs
|
||||
# 7 Media Objects upgraded with 4 citations in 3 secs
|
||||
# 852 Places upgraded with 0 citations in 1 secs
|
||||
|
||||
# without doing any backlinks
|
||||
#Number of new objects upgraded:
|
||||
# 73 People upgraded with 76 citations in 43 secs
|
||||
# 35 Families upgraded with 36 citations in 24 secs
|
||||
# 3403 Events upgraded with 4 citations in 6 secs
|
||||
# 7 Media Objects upgraded with 4 citations in 2 secs
|
||||
# 852 Places upgraded with 0 citations in 1 secs
|
||||
|
||||
# another run about the same code:
|
||||
#Number of new objects upgraded:
|
||||
# 73 People upgraded with 76 citations in 48 secs
|
||||
# 35 Families upgraded with 36 citations in 21 secs
|
||||
# 3403 Events upgraded with 4 citations in 9 secs
|
||||
# 7 Media Objects upgraded with 4 citations in 4 secs
|
||||
# 852 Places upgraded with 0 citations in 1 secs
|
||||
|
||||
|
||||
|
||||
self.reset()
|
||||
self.set_total(6)
|
||||
self.reindex_reference_map(self.update)
|
||||
self.reset()
|
||||
|
||||
# Bump up database version. Separate transaction to save metadata.
|
||||
with BSDDBTxn(self.env, self.metadata) as txn:
|
||||
txn.put('version', 16)
|
||||
|
||||
LOG.debug([data_upgradeobject])
|
||||
txt = _("Number of new objects upgraded:\n")
|
||||
for key in keyorder:
|
||||
try:
|
||||
txt += key2string[key] % data_upgradeobject[key2data[key]]
|
||||
except:
|
||||
txt += key2string[key]
|
||||
InfoDialog(_('Upgrade Statistics'), txt)
|
||||
|
||||
def upgrade_media_list_16(self, media_list, transaction):
|
||||
new_media_list = []
|
||||
@ -219,80 +450,90 @@ def upgrade_attribute_list_16(self, attribute_list, transaction):
|
||||
new_attribute_list.append((new_attribute))
|
||||
return new_attribute_list
|
||||
|
||||
def upgrade_child_ref_list_16(self, child_ref_list, transaction):
|
||||
new_child_ref_list = []
|
||||
for child_ref in child_ref_list:
|
||||
(privacy, source_list, note_list, ref, frel, mrel) = child_ref
|
||||
new_citation_list = convert_source_list_to_citation_list_16(
|
||||
self, source_list, transaction)
|
||||
new_child_ref = (privacy, new_citation_list, note_list, ref, frel, mrel)
|
||||
new_child_ref_list.append((new_child_ref))
|
||||
return new_child_ref_list
|
||||
|
||||
def upgrade_lds_seal_list_16(self, lds_seal_list, transaction):
|
||||
new_lds_seal_list = []
|
||||
for lds_seal in lds_seal_list:
|
||||
(source_list, note_list, date, type, place,
|
||||
famc, temple, status, private) = lds_seal
|
||||
new_citation_list = convert_source_list_to_citation_list_16(
|
||||
self, source_list, transaction)
|
||||
new_lds_seal = (new_citation_list, note_list, date, type, place,
|
||||
famc, temple, status, private)
|
||||
new_lds_seal_list.append((new_lds_seal))
|
||||
return new_lds_seal_list
|
||||
|
||||
def upgrade_address_list_16(self, address_list, transaction):
|
||||
new_address_list = []
|
||||
for address in address_list:
|
||||
(privacy, source_list, note_list, date, location) = address
|
||||
new_citation_list = convert_source_list_to_citation_list_16(
|
||||
self, source_list, transaction)
|
||||
new_address = (privacy, new_citation_list, note_list, date, location)
|
||||
new_address_list.append((new_address))
|
||||
return new_address_list
|
||||
|
||||
def upgrade_name_list_16(self, name_list, transaction):
|
||||
new_name_list = []
|
||||
for name in name_list:
|
||||
new_name = upgrade_name_16(self, name, transaction)
|
||||
new_name_list.append((new_name))
|
||||
return new_name_list
|
||||
|
||||
def upgrade_name_16(self, name, transaction):
|
||||
(privacy, source_list, note, date, first_name, surname_list, suffix,
|
||||
title, name_type, group_as, sort_as, display_as, call, nick,
|
||||
famnick) = name
|
||||
new_citation_list = convert_source_list_to_citation_list_16(
|
||||
self, source_list, transaction)
|
||||
new_name = (privacy, new_citation_list, note, date, first_name,
|
||||
surname_list, suffix, title, name_type, group_as, sort_as,
|
||||
display_as, call, nick, famnick)
|
||||
return new_name
|
||||
|
||||
def upgrade_person_ref_list_16(self, person_ref_list, transaction):
|
||||
new_person_ref_list = []
|
||||
for person_ref in person_ref_list:
|
||||
(privacy, source_list, note_list, ref, rel) = person_ref
|
||||
new_citation_list = convert_source_list_to_citation_list_16(
|
||||
self, source_list, transaction)
|
||||
new_person_ref = (privacy, new_citation_list, note_list, ref, rel)
|
||||
new_person_ref_list.append((new_person_ref))
|
||||
return new_person_ref_list
|
||||
|
||||
def convert_source_list_to_citation_list_16(self, source_list, transaction):
|
||||
global num_citations
|
||||
citation_list = []
|
||||
for source in source_list:
|
||||
(new_handle, new_citation) = \
|
||||
convert_sourceref_to_citation_16(self, source)
|
||||
(date, private, note_list, confidence, ref, page) = source
|
||||
new_handle = self.create_id()
|
||||
new_media_list = []
|
||||
new_data_map = {}
|
||||
new_change = time.time()
|
||||
new_gramps_id = self.citation_prefix % self.cmap_index
|
||||
new_citation = (new_handle, new_gramps_id,
|
||||
date, page, confidence, ref, note_list, new_media_list,
|
||||
new_data_map, new_change, private)
|
||||
with BSDDBTxn(self.env, self.citation_map) as txn:
|
||||
txn.put(str(new_handle), new_citation, txn=transaction)
|
||||
num_citations += 1
|
||||
# add backlinks for references from Citation to Source
|
||||
LOG.debug(" update ref map citation %s" %
|
||||
[new_handle,
|
||||
self.get_citation_from_handle(new_handle) ])
|
||||
with BSDDBTxn(self.env) as txn:
|
||||
self.update_reference_map(
|
||||
self.get_citation_from_handle(new_handle),
|
||||
transaction,
|
||||
txn.txn)
|
||||
self.cmap_index += 1
|
||||
# # add backlinks for references from Citation to Source
|
||||
# with BSDDBTxn(self.env) as txn:
|
||||
# self.update_reference_map(
|
||||
# self.get_citation_from_handle(new_handle),
|
||||
# transaction,
|
||||
# txn.txn)
|
||||
citation_list.append((new_handle))
|
||||
return citation_list
|
||||
|
||||
def convert_sourceref_to_citation_16(self, source):
|
||||
LOG.debug(" convert_sourceref_to_citation_16")
|
||||
LOG.debug(" old sourceref %s" % [source])
|
||||
(date, private, note_list, confidence, ref, page) = source
|
||||
new_handle = self.create_id()
|
||||
new_media_list = []
|
||||
new_data_map = {}
|
||||
new_change = time.time()
|
||||
LOG.debug(" self %s" % [self])
|
||||
|
||||
# FIXME: I don't understand why I can't use find_next_citation_gramps_id.
|
||||
# Attempting to use it fails. This seems to be because cid_trans
|
||||
# is not initialised properly. However I don't understand how this
|
||||
# is ever initialised.
|
||||
# FIXME: self.cmap_index does not seem to be initialised, but
|
||||
# again I don't see how it is initialised for
|
||||
# find_next_citation_gramps_id
|
||||
# FIXME: Should self.citation_map and/or cmap_index be committed to the
|
||||
# database after being updated?
|
||||
LOG.debug(" cmap_index %s" % self.cmap_index)
|
||||
LOG.debug(" len(self.citation_map) %s" % len(self.citation_map))
|
||||
(self.cmap_index, new_gramps_id) = \
|
||||
__find_next_gramps_id(self, self.citation_prefix,
|
||||
self.cmap_index)
|
||||
LOG.debug(" new_gramps_id %s" % new_gramps_id)
|
||||
new_citation = (new_handle, new_gramps_id,
|
||||
date, page, confidence, ref, note_list, new_media_list,
|
||||
new_data_map, new_change, private)
|
||||
LOG.debug(" new_citation %s" % [new_citation])
|
||||
return (new_handle, new_citation)
|
||||
|
||||
def __find_next_gramps_id(self, prefix, map_index):
|
||||
"""
|
||||
Helper function for find_next_<object>_gramps_id methods
|
||||
"""
|
||||
index = prefix % map_index
|
||||
# This uses a generator expression, see PEP 289:
|
||||
# http://www.python.org/dev/peps/pep-0289/
|
||||
# This avoids evaluating a whole list at once.
|
||||
# This is equivalent to:
|
||||
# used_ids = {}
|
||||
# for handle in self.citation_map.keys()
|
||||
# used_ids += self.citation_map[handle][1]
|
||||
used_ids = (self.citation_map[handle][1] for handle
|
||||
in self.citation_map.keys())
|
||||
for i in used_ids:
|
||||
LOG.debug(" used_ids %s" % i)
|
||||
while index in used_ids:
|
||||
map_index += 1
|
||||
index = prefix % map_index
|
||||
map_index += 1
|
||||
return (map_index, index)
|
||||
|
||||
def gramps_upgrade_15(self):
|
||||
"""Upgrade database from version 14 to 15. This upgrade adds:
|
||||
* tagging
|
||||
|
@ -3,6 +3,7 @@
|
||||
#
|
||||
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||
# Copyright (C) 2010 Michiel D. Nauta
|
||||
# Copyright (C) 2011 Tim G L Lyons
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -32,7 +33,7 @@ Address class for GRAMPS.
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.lib.secondaryobj import SecondaryObject
|
||||
from gen.lib.privacybase import PrivacyBase
|
||||
from gen.lib.srcbase import SourceBase
|
||||
from gen.lib.citationbase import CitationBase
|
||||
from gen.lib.notebase import NoteBase
|
||||
from gen.lib.datebase import DateBase
|
||||
from gen.lib.locationbase import LocationBase
|
||||
@ -43,7 +44,7 @@ from gen.lib.const import IDENTICAL, EQUAL, DIFFERENT
|
||||
# Address for Person/Repository
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Address(SecondaryObject, PrivacyBase, SourceBase, NoteBase, DateBase,
|
||||
class Address(SecondaryObject, PrivacyBase, CitationBase, NoteBase, DateBase,
|
||||
LocationBase):
|
||||
"""Provide address information."""
|
||||
|
||||
@ -52,7 +53,7 @@ class Address(SecondaryObject, PrivacyBase, SourceBase, NoteBase, DateBase,
|
||||
Create a new Address instance, copying from the source if provided.
|
||||
"""
|
||||
PrivacyBase.__init__(self, source)
|
||||
SourceBase.__init__(self, source)
|
||||
CitationBase.__init__(self, source)
|
||||
NoteBase.__init__(self, source)
|
||||
DateBase.__init__(self, source)
|
||||
LocationBase.__init__(self, source)
|
||||
@ -62,7 +63,7 @@ class Address(SecondaryObject, PrivacyBase, SourceBase, NoteBase, DateBase,
|
||||
Convert the object to a serialized tuple of data.
|
||||
"""
|
||||
return (PrivacyBase.serialize(self),
|
||||
SourceBase.serialize(self),
|
||||
CitationBase.serialize(self),
|
||||
NoteBase.serialize(self),
|
||||
DateBase.serialize(self),
|
||||
LocationBase.serialize(self))
|
||||
@ -71,10 +72,10 @@ class Address(SecondaryObject, PrivacyBase, SourceBase, NoteBase, DateBase,
|
||||
"""
|
||||
Convert a serialized tuple of data to an object.
|
||||
"""
|
||||
(privacy, source_list, note_list, date, location) = data
|
||||
(privacy, citation_list, note_list, date, location) = data
|
||||
|
||||
PrivacyBase.unserialize(self, privacy)
|
||||
SourceBase.unserialize(self, source_list)
|
||||
CitationBase.unserialize(self, citation_list)
|
||||
NoteBase.unserialize(self, note_list)
|
||||
DateBase.unserialize(self, date)
|
||||
LocationBase.unserialize(self, location)
|
||||
@ -96,7 +97,7 @@ class Address(SecondaryObject, PrivacyBase, SourceBase, NoteBase, DateBase,
|
||||
:returns: Returns the list of child objects that may carry textual data.
|
||||
:rtype: list
|
||||
"""
|
||||
return self.source_list
|
||||
return []
|
||||
|
||||
def get_note_child_list(self):
|
||||
"""
|
||||
@ -105,7 +106,7 @@ class Address(SecondaryObject, PrivacyBase, SourceBase, NoteBase, DateBase,
|
||||
:returns: Returns the list of child secondary child objects that may refer notes.
|
||||
:rtype: list
|
||||
"""
|
||||
return self.source_list
|
||||
return []
|
||||
|
||||
def get_handle_referents(self):
|
||||
"""
|
||||
@ -115,7 +116,7 @@ class Address(SecondaryObject, PrivacyBase, SourceBase, NoteBase, DateBase,
|
||||
:returns: Returns the list of objects referencing primary objects.
|
||||
:rtype: list
|
||||
"""
|
||||
return self.source_list
|
||||
return []
|
||||
|
||||
def get_referenced_handles(self):
|
||||
"""
|
||||
@ -125,7 +126,8 @@ class Address(SecondaryObject, PrivacyBase, SourceBase, NoteBase, DateBase,
|
||||
:returns: List of (classname, handle) tuples for referenced objects.
|
||||
:rtype: list
|
||||
"""
|
||||
return self.get_referenced_note_handles()
|
||||
return self.get_referenced_note_handles() + \
|
||||
self.get_referenced_citation_handles()
|
||||
|
||||
def is_equivalent(self, other):
|
||||
"""
|
||||
@ -158,4 +160,4 @@ class Address(SecondaryObject, PrivacyBase, SourceBase, NoteBase, DateBase,
|
||||
"""
|
||||
self._merge_privacy(acquisition)
|
||||
self._merge_note_list(acquisition)
|
||||
self._merge_source_reference_list(acquisition)
|
||||
self._merge_citation_list(acquisition)
|
||||
|
@ -3,6 +3,7 @@
|
||||
#
|
||||
# Copyright (C) 2006-2007 Donald N. Allingham
|
||||
# Copyright (C) 2010 Michiel D. Nauta
|
||||
# Copyright (C) 2011 Tim G L Lyons
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -31,7 +32,7 @@ Child Reference class for GRAMPS.
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.lib.secondaryobj import SecondaryObject
|
||||
from gen.lib.privacybase import PrivacyBase
|
||||
from gen.lib.srcbase import SourceBase
|
||||
from gen.lib.citationbase import CitationBase
|
||||
from gen.lib.notebase import NoteBase
|
||||
from gen.lib.refbase import RefBase
|
||||
from gen.lib.childreftype import ChildRefType
|
||||
@ -42,7 +43,7 @@ from gen.lib.const import IDENTICAL, EQUAL, DIFFERENT
|
||||
# Person References for Person/Family
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class ChildRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
|
||||
class ChildRef(SecondaryObject, PrivacyBase, CitationBase, NoteBase, RefBase):
|
||||
"""
|
||||
Person reference class.
|
||||
|
||||
@ -53,7 +54,7 @@ class ChildRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
|
||||
|
||||
def __init__(self, source=None):
|
||||
PrivacyBase.__init__(self, source)
|
||||
SourceBase.__init__(self, source)
|
||||
CitationBase.__init__(self, source)
|
||||
NoteBase.__init__(self, source)
|
||||
RefBase.__init__(self, source)
|
||||
if source:
|
||||
@ -68,7 +69,7 @@ class ChildRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
|
||||
Convert the object to a serialized tuple of data.
|
||||
"""
|
||||
return (PrivacyBase.serialize(self),
|
||||
SourceBase.serialize(self),
|
||||
CitationBase.serialize(self),
|
||||
NoteBase.serialize(self),
|
||||
RefBase.serialize(self),
|
||||
self.frel.serialize(),
|
||||
@ -78,9 +79,9 @@ class ChildRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
|
||||
"""
|
||||
Convert a serialized tuple of data to an object.
|
||||
"""
|
||||
(privacy, source_list, note_list, ref, frel, mrel) = data
|
||||
(privacy, citation_list, note_list, ref, frel, mrel) = data
|
||||
PrivacyBase.unserialize(self, privacy)
|
||||
SourceBase.unserialize(self, source_list)
|
||||
CitationBase.unserialize(self, citation_list)
|
||||
NoteBase.unserialize(self, note_list)
|
||||
RefBase.unserialize(self, ref)
|
||||
self.frel = ChildRefType()
|
||||
@ -105,7 +106,7 @@ class ChildRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
|
||||
:returns: Returns the list of child objects that may carry textual data.
|
||||
:rtype: list
|
||||
"""
|
||||
return self.source_list
|
||||
return []
|
||||
|
||||
def get_note_child_list(self):
|
||||
"""
|
||||
@ -115,7 +116,7 @@ class ChildRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
|
||||
refer notes.
|
||||
:rtype: list
|
||||
"""
|
||||
return self.source_list
|
||||
return []
|
||||
|
||||
def get_referenced_handles(self):
|
||||
"""
|
||||
@ -125,7 +126,8 @@ class ChildRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
|
||||
:returns: List of (classname, handle) tuples for referenced objects.
|
||||
:rtype: list
|
||||
"""
|
||||
ret = self.get_referenced_note_handles()
|
||||
ret = self.get_referenced_note_handles() + \
|
||||
self.get_referenced_citation_handles()
|
||||
if self.ref:
|
||||
ret += [('Person', self.ref)]
|
||||
return ret
|
||||
@ -138,7 +140,7 @@ class ChildRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
|
||||
:returns: Returns the list of objects referencing primary objects.
|
||||
:rtype: list
|
||||
"""
|
||||
return self.source_list
|
||||
return []
|
||||
|
||||
def is_equivalent(self, other):
|
||||
"""
|
||||
@ -169,7 +171,7 @@ class ChildRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
|
||||
"""
|
||||
self._merge_privacy(acquisition)
|
||||
self._merge_note_list(acquisition)
|
||||
self._merge_source_reference_list(acquisition)
|
||||
self._merge_citation_list(acquisition)
|
||||
if (self.mrel != acquisition.mrel) or (self.frel != acquisition.frel):
|
||||
if self.mrel == ChildRefType.UNKNOWN:
|
||||
self.set_mother_relation(acquisition.mrel)
|
||||
|
@ -3,6 +3,7 @@
|
||||
#
|
||||
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||
# Copyright (C) 2010 Michiel D. Nauta
|
||||
# Copyright (C) 2011 Tim G L Lyons
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -25,6 +26,14 @@
|
||||
Event object for GRAMPS.
|
||||
"""
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# standard python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import logging
|
||||
LOG = logging.getLogger(".citation")
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
|
@ -4,6 +4,7 @@
|
||||
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||
# Copyright (C) 2010 Michiel D. Nauta
|
||||
# Copyright (C) 2010 Nick Hall
|
||||
# Copyright (C) 2011 Tim G L Lyons
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -32,6 +33,8 @@ Family object for GRAMPS.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from warnings import warn
|
||||
import logging
|
||||
LOG = logging.getLogger(".citation")
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -39,7 +42,7 @@ from warnings import warn
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.lib.primaryobj import PrimaryObject
|
||||
from gen.lib.srcbase import SourceBase
|
||||
from gen.lib.citationbase import CitationBase
|
||||
from gen.lib.notebase import NoteBase
|
||||
from gen.lib.mediabase import MediaBase
|
||||
from gen.lib.attrbase import AttributeBase
|
||||
@ -55,7 +58,7 @@ from gen.lib.const import IDENTICAL, EQUAL, DIFFERENT
|
||||
# Family class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
|
||||
class Family(CitationBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
|
||||
TagBase, PrimaryObject):
|
||||
"""
|
||||
The Family record is the GRAMPS in-memory representation of the
|
||||
@ -82,7 +85,7 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
|
||||
including the database handle.
|
||||
"""
|
||||
PrimaryObject.__init__(self)
|
||||
SourceBase.__init__(self)
|
||||
CitationBase.__init__(self)
|
||||
NoteBase.__init__(self)
|
||||
MediaBase.__init__(self)
|
||||
AttributeBase.__init__(self)
|
||||
@ -121,7 +124,7 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
|
||||
MediaBase.serialize(self),
|
||||
AttributeBase.serialize(self),
|
||||
LdsOrdBase.serialize(self),
|
||||
SourceBase.serialize(self),
|
||||
CitationBase.serialize(self),
|
||||
NoteBase.serialize(self),
|
||||
self.change, TagBase.serialize(self), self.private)
|
||||
|
||||
@ -132,7 +135,7 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
|
||||
"""
|
||||
(self.handle, self.gramps_id, self.father_handle, self.mother_handle,
|
||||
child_ref_list, the_type, event_ref_list, media_list,
|
||||
attribute_list, lds_seal_list, source_list, note_list,
|
||||
attribute_list, lds_seal_list, citation_list, note_list,
|
||||
self.change, tag_list, self.private) = data
|
||||
|
||||
self.type = FamilyRelType()
|
||||
@ -143,7 +146,7 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
|
||||
for cr in child_ref_list]
|
||||
MediaBase.unserialize(self, media_list)
|
||||
AttributeBase.unserialize(self, attribute_list)
|
||||
SourceBase.unserialize(self, source_list)
|
||||
CitationBase.unserialize(self, citation_list)
|
||||
NoteBase.unserialize(self, note_list)
|
||||
LdsOrdBase.unserialize(self, lds_seal_list)
|
||||
TagBase.unserialize(self, tag_list)
|
||||
@ -269,15 +272,14 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
|
||||
:rtype: list
|
||||
"""
|
||||
add_list = filter(None, self.lds_ord_list)
|
||||
return self.media_list + self.attribute_list + \
|
||||
self.source_list + add_list
|
||||
return self.media_list + self.attribute_list + add_list
|
||||
|
||||
def get_sourcref_child_list(self):
|
||||
def get_citationref_child_list(self):
|
||||
"""
|
||||
Return the list of child secondary objects that may refer sources.
|
||||
Return the list of child secondary objects that may refer citations.
|
||||
|
||||
:returns: Returns the list of child secondary child objects that may
|
||||
refer sources.
|
||||
refer citations.
|
||||
:rtype: list
|
||||
"""
|
||||
check_list = self.media_list + self.attribute_list + \
|
||||
@ -294,7 +296,7 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
|
||||
:rtype: list
|
||||
"""
|
||||
check_list = self.media_list + self.attribute_list + \
|
||||
self.lds_ord_list + self.child_ref_list + self.source_list + \
|
||||
self.lds_ord_list + self.child_ref_list + \
|
||||
self.event_ref_list
|
||||
return check_list
|
||||
|
||||
@ -306,7 +308,8 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
|
||||
:returns: List of (classname, handle) tuples for referenced objects.
|
||||
:rtype: list
|
||||
"""
|
||||
ret = self.get_referenced_note_handles()
|
||||
ret = self.get_referenced_note_handles() + \
|
||||
self.get_referenced_citation_handles()
|
||||
ret += [('Person', handle) for handle
|
||||
in ([ref.ref for ref in self.child_ref_list] +
|
||||
[self.father_handle, self.mother_handle])
|
||||
@ -322,7 +325,7 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
|
||||
:returns: Returns the list of objects referencing primary objects.
|
||||
:rtype: list
|
||||
"""
|
||||
return self.get_sourcref_child_list() + self.source_list
|
||||
return self.get_citationref_child_list()
|
||||
|
||||
def merge(self, acquisition):
|
||||
"""
|
||||
@ -342,7 +345,7 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
|
||||
self._merge_child_ref_list(acquisition)
|
||||
self._merge_attribute_list(acquisition)
|
||||
self._merge_note_list(acquisition)
|
||||
self._merge_source_reference_list(acquisition)
|
||||
self._merge_citation_list(acquisition)
|
||||
self._merge_tag_list(acquisition)
|
||||
|
||||
def set_relationship(self, relationship_type):
|
||||
|
@ -3,6 +3,7 @@
|
||||
#
|
||||
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||
# Copyright (C) 2010 Michiel D. Nauta
|
||||
# Copyright (C) 2011 Tim G L Lyons
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -39,7 +40,7 @@ from warnings import warn
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.lib.secondaryobj import SecondaryObject
|
||||
from gen.lib.srcbase import SourceBase
|
||||
from gen.lib.citationbase import CitationBase
|
||||
from gen.lib.notebase import NoteBase
|
||||
from gen.lib.datebase import DateBase
|
||||
from gen.lib.placebase import PlaceBase
|
||||
@ -51,7 +52,7 @@ from gen.lib.const import IDENTICAL, EQUAL, DIFFERENT
|
||||
# LDS Ordinance class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class LdsOrd(SecondaryObject, SourceBase, NoteBase,
|
||||
class LdsOrd(SecondaryObject, CitationBase, NoteBase,
|
||||
DateBase, PlaceBase, PrivacyBase):
|
||||
"""
|
||||
Class that contains information about LDS Ordinances.
|
||||
@ -116,7 +117,7 @@ class LdsOrd(SecondaryObject, SourceBase, NoteBase,
|
||||
|
||||
def __init__(self, source=None):
|
||||
"""Create a LDS Ordinance instance."""
|
||||
SourceBase.__init__(self, source)
|
||||
CitationBase.__init__(self, source)
|
||||
NoteBase.__init__(self, source)
|
||||
DateBase.__init__(self, source)
|
||||
PlaceBase.__init__(self, source)
|
||||
@ -137,7 +138,7 @@ class LdsOrd(SecondaryObject, SourceBase, NoteBase,
|
||||
"""
|
||||
Convert the object to a serialized tuple of data.
|
||||
"""
|
||||
return (SourceBase.serialize(self),
|
||||
return (CitationBase.serialize(self),
|
||||
NoteBase.serialize(self),
|
||||
DateBase.serialize(self),
|
||||
self.type, self.place,
|
||||
@ -147,9 +148,9 @@ class LdsOrd(SecondaryObject, SourceBase, NoteBase,
|
||||
"""
|
||||
Convert a serialized tuple of data to an object.
|
||||
"""
|
||||
(source_list, note_list, date, self.type, self.place,
|
||||
(citation_list, note_list, date, self.type, self.place,
|
||||
self.famc, self.temple, self.status, self.private) = data
|
||||
SourceBase.unserialize(self, source_list)
|
||||
CitationBase.unserialize(self, citation_list)
|
||||
NoteBase.unserialize(self, note_list)
|
||||
DateBase.unserialize(self, date)
|
||||
return self
|
||||
@ -171,7 +172,7 @@ class LdsOrd(SecondaryObject, SourceBase, NoteBase,
|
||||
:returns: Returns the list of child objects that may carry textual data.
|
||||
:rtype: list
|
||||
"""
|
||||
return self.source_list
|
||||
return []
|
||||
|
||||
def get_note_child_list(self):
|
||||
"""
|
||||
@ -181,7 +182,7 @@ class LdsOrd(SecondaryObject, SourceBase, NoteBase,
|
||||
refer notes.
|
||||
:rtype: list
|
||||
"""
|
||||
return self.source_list
|
||||
return []
|
||||
|
||||
def get_referenced_handles(self):
|
||||
"""
|
||||
@ -191,7 +192,8 @@ class LdsOrd(SecondaryObject, SourceBase, NoteBase,
|
||||
:returns: List of (classname, handle) tuples for referenced objects.
|
||||
:rtype: list
|
||||
"""
|
||||
ret = self.get_referenced_note_handles()
|
||||
ret = self.get_referenced_note_handles() + \
|
||||
self.get_referenced_citation_handles()
|
||||
if self.place:
|
||||
ret += [('Place', self.place)]
|
||||
if self.famc:
|
||||
@ -206,7 +208,7 @@ class LdsOrd(SecondaryObject, SourceBase, NoteBase,
|
||||
:returns: Returns the list of objects referencing primary objects.
|
||||
:rtype: list
|
||||
"""
|
||||
return self.source_list
|
||||
return []
|
||||
|
||||
def is_equivalent(self, other):
|
||||
"""
|
||||
@ -241,7 +243,7 @@ class LdsOrd(SecondaryObject, SourceBase, NoteBase,
|
||||
"""
|
||||
self._merge_privacy(acquisition)
|
||||
self._merge_note_list(acquisition)
|
||||
self._merge_source_reference_list(acquisition)
|
||||
self._merge_citation_list(acquisition)
|
||||
|
||||
def get_type(self):
|
||||
"""
|
||||
|
@ -161,7 +161,7 @@ class MediaObject(CitationBase, NoteBase, DateBase, AttributeBase,
|
||||
# """
|
||||
# return self.attribute_list
|
||||
#
|
||||
def get_citation_child_list(self):
|
||||
def get_citationref_child_list(self):
|
||||
"""
|
||||
Return the list of child secondary objects that may refer to citations.
|
||||
|
||||
@ -191,11 +191,6 @@ class MediaObject(CitationBase, NoteBase, DateBase, AttributeBase,
|
||||
:returns: List of (classname, handle) tuples for referenced objects.
|
||||
:rtype: list
|
||||
"""
|
||||
LOG.debug ("Media: %s get_referenced_handles: %s" %
|
||||
(self.desc,
|
||||
self.get_referenced_note_handles() +
|
||||
self.get_referenced_tag_handles() +
|
||||
self.get_referenced_citation_handles()))
|
||||
return self.get_referenced_note_handles() + \
|
||||
self.get_referenced_tag_handles() + \
|
||||
self.get_referenced_citation_handles()
|
||||
@ -208,12 +203,6 @@ class MediaObject(CitationBase, NoteBase, DateBase, AttributeBase,
|
||||
:returns: Returns the list of objects referencing primary objects.
|
||||
:rtype: list
|
||||
"""
|
||||
LOG.debug ("Media: %s get_handle_referents: %s" %
|
||||
(self.desc,
|
||||
self.attribute_list))
|
||||
# FIXME: This is wrong, because it returns the handle, when it should return
|
||||
# the citation object. This is probably because the citation unpack has not
|
||||
# been done.
|
||||
return self.attribute_list
|
||||
|
||||
def merge(self, acquisition):
|
||||
|
@ -3,6 +3,7 @@
|
||||
#
|
||||
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||
# Copyright (C) 2010 Michiel D. Nauta
|
||||
# Copyright (C) 2011 Tim G L Lyons
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -32,7 +33,7 @@ Name class for GRAMPS.
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.lib.secondaryobj import SecondaryObject
|
||||
from gen.lib.privacybase import PrivacyBase
|
||||
from gen.lib.srcbase import SourceBase
|
||||
from gen.lib.citationbase import CitationBase
|
||||
from gen.lib.notebase import NoteBase
|
||||
from gen.lib.datebase import DateBase
|
||||
from gen.lib.surnamebase import SurnameBase
|
||||
@ -44,7 +45,7 @@ from gen.lib.const import IDENTICAL, EQUAL, DIFFERENT
|
||||
# Personal Name
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Name(SecondaryObject, PrivacyBase, SurnameBase, SourceBase, NoteBase,
|
||||
class Name(SecondaryObject, PrivacyBase, SurnameBase, CitationBase, NoteBase,
|
||||
DateBase):
|
||||
"""
|
||||
Provide name information about a person.
|
||||
@ -73,18 +74,18 @@ class Name(SecondaryObject, PrivacyBase, SurnameBase, SourceBase, NoteBase,
|
||||
"""
|
||||
PrivacyBase.__init__(self, source)
|
||||
SurnameBase.__init__(self, source)
|
||||
SourceBase.__init__(self, source)
|
||||
CitationBase.__init__(self, source)
|
||||
NoteBase.__init__(self, source)
|
||||
DateBase.__init__(self, source)
|
||||
if data:
|
||||
(privacy, source_list, note, date,
|
||||
(privacy, citation_list, note, date,
|
||||
self.first_name, surname_list, self.suffix, self.title, name_type,
|
||||
self.group_as, self.sort_as, self.display_as, self.call,
|
||||
self.nick, self.famnick) = data
|
||||
self.type = NameType(name_type)
|
||||
SurnameBase.unserialize(self, surname_list)
|
||||
PrivacyBase.unserialize(self, privacy)
|
||||
SourceBase.unserialize(self, source_list)
|
||||
CitationBase.unserialize(self, citation_list)
|
||||
NoteBase.unserialize(self, note)
|
||||
DateBase.unserialize(self, date)
|
||||
elif source:
|
||||
@ -115,7 +116,7 @@ class Name(SecondaryObject, PrivacyBase, SurnameBase, SourceBase, NoteBase,
|
||||
Convert the object to a serialized tuple of data.
|
||||
"""
|
||||
return (PrivacyBase.serialize(self),
|
||||
SourceBase.serialize(self),
|
||||
CitationBase.serialize(self),
|
||||
NoteBase.serialize(self),
|
||||
DateBase.serialize(self),
|
||||
self.first_name,
|
||||
@ -140,14 +141,14 @@ class Name(SecondaryObject, PrivacyBase, SurnameBase, SourceBase, NoteBase,
|
||||
"""
|
||||
Convert a serialized tuple of data to an object.
|
||||
"""
|
||||
(privacy, source_list, note_list, date,
|
||||
(privacy, citation_list, note_list, date,
|
||||
self.first_name, surname_list, self.suffix, self.title, name_type,
|
||||
self.group_as, self.sort_as, self.display_as, self.call,
|
||||
self.nick, self.famnick) = data
|
||||
self.type = NameType(name_type)
|
||||
PrivacyBase.unserialize(self, privacy)
|
||||
SurnameBase.unserialize(self, surname_list)
|
||||
SourceBase.unserialize(self, source_list)
|
||||
CitationBase.unserialize(self, citation_list)
|
||||
NoteBase.unserialize(self, note_list)
|
||||
DateBase.unserialize(self, date)
|
||||
return self
|
||||
@ -169,7 +170,7 @@ class Name(SecondaryObject, PrivacyBase, SurnameBase, SourceBase, NoteBase,
|
||||
:returns: Returns the list of child objects that may carry textual data.
|
||||
:rtype: list
|
||||
"""
|
||||
return self.source_list + self.surname_list
|
||||
return self.surname_list
|
||||
|
||||
def get_note_child_list(self):
|
||||
"""
|
||||
@ -179,7 +180,7 @@ class Name(SecondaryObject, PrivacyBase, SurnameBase, SourceBase, NoteBase,
|
||||
refer notes.
|
||||
:rtype: list
|
||||
"""
|
||||
return self.source_list
|
||||
return []
|
||||
|
||||
def get_handle_referents(self):
|
||||
"""
|
||||
@ -189,7 +190,7 @@ class Name(SecondaryObject, PrivacyBase, SurnameBase, SourceBase, NoteBase,
|
||||
:returns: Returns the list of objects referencing primary objects.
|
||||
:rtype: list
|
||||
"""
|
||||
return self.source_list
|
||||
return []
|
||||
|
||||
def get_referenced_handles(self):
|
||||
"""
|
||||
@ -199,7 +200,8 @@ class Name(SecondaryObject, PrivacyBase, SurnameBase, SourceBase, NoteBase,
|
||||
:returns: List of (classname, handle) tuples for referenced objects.
|
||||
:rtype: list
|
||||
"""
|
||||
return self.get_referenced_note_handles()
|
||||
return self.get_referenced_note_handles() + \
|
||||
self.get_referenced_citation_handles()
|
||||
|
||||
def is_equivalent(self, other):
|
||||
"""
|
||||
@ -238,7 +240,7 @@ class Name(SecondaryObject, PrivacyBase, SurnameBase, SourceBase, NoteBase,
|
||||
self._merge_privacy(acquisition)
|
||||
self._merge_surname_list(acquisition)
|
||||
self._merge_note_list(acquisition)
|
||||
self._merge_source_reference_list(acquisition)
|
||||
self._merge_citation_list(acquisition)
|
||||
|
||||
def set_group_as(self, name):
|
||||
"""
|
||||
|
@ -4,6 +4,7 @@
|
||||
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||
# Copyright (C) 2010 Michiel D. Nauta
|
||||
# Copyright (C) 2010 Nick Hall
|
||||
# Copyright (C) 2011 Tim G L Lyons
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -32,7 +33,7 @@ Person object for GRAMPS.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.lib.primaryobj import PrimaryObject
|
||||
from gen.lib.srcbase import SourceBase
|
||||
from gen.lib.citationbase import CitationBase
|
||||
from gen.lib.notebase import NoteBase
|
||||
from gen.lib.mediabase import MediaBase
|
||||
from gen.lib.attrbase import AttributeBase
|
||||
@ -53,7 +54,7 @@ from gen.lib.const import IDENTICAL, EQUAL, DIFFERENT
|
||||
# Person class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
|
||||
class Person(CitationBase, NoteBase, AttributeBase, MediaBase,
|
||||
AddressBase, UrlBase, LdsOrdBase, TagBase, PrimaryObject):
|
||||
"""
|
||||
The Person record is the GRAMPS in-memory representation of an
|
||||
@ -85,7 +86,7 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
|
||||
handle.
|
||||
"""
|
||||
PrimaryObject.__init__(self)
|
||||
SourceBase.__init__(self)
|
||||
CitationBase.__init__(self)
|
||||
NoteBase.__init__(self)
|
||||
MediaBase.__init__(self)
|
||||
AttributeBase.__init__(self)
|
||||
@ -149,7 +150,7 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
|
||||
AttributeBase.serialize(self), # 12
|
||||
UrlBase.serialize(self), # 13
|
||||
LdsOrdBase.serialize(self), # 14
|
||||
SourceBase.serialize(self), # 15
|
||||
CitationBase.serialize(self), # 15
|
||||
NoteBase.serialize(self), # 16
|
||||
self.change, # 17
|
||||
TagBase.serialize(self), # 18
|
||||
@ -181,7 +182,7 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
|
||||
attribute_list, # 12
|
||||
urls, # 13
|
||||
lds_ord_list, # 14
|
||||
source_list, # 15
|
||||
citation_list, # 15
|
||||
note_list, # 16
|
||||
self.change, # 17
|
||||
tag_list, # 18
|
||||
@ -202,7 +203,7 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
|
||||
AddressBase.unserialize(self, address_list)
|
||||
AttributeBase.unserialize(self, attribute_list)
|
||||
UrlBase.unserialize(self, urls)
|
||||
SourceBase.unserialize(self, source_list)
|
||||
CitationBase.unserialize(self, citation_list)
|
||||
NoteBase.unserialize(self, note_list)
|
||||
TagBase.unserialize(self, tag_list)
|
||||
return self
|
||||
@ -369,18 +370,17 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
|
||||
self.address_list +
|
||||
self.attribute_list +
|
||||
self.urls +
|
||||
self.source_list +
|
||||
self.event_ref_list +
|
||||
add_list +
|
||||
self.person_ref_list
|
||||
)
|
||||
|
||||
def get_sourcref_child_list(self):
|
||||
def get_citationref_child_list(self):
|
||||
"""
|
||||
Return the list of child secondary objects that may refer sources.
|
||||
Return the list of child secondary objects that may refer citations.
|
||||
|
||||
:returns: Returns the list of child secondary child objects that may
|
||||
refer sources.
|
||||
refer citations.
|
||||
:rtype: list
|
||||
"""
|
||||
return ([self.primary_name] +
|
||||
@ -408,7 +408,6 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
|
||||
self.attribute_list +
|
||||
self.lds_ord_list +
|
||||
self.person_ref_list +
|
||||
self.source_list +
|
||||
self.event_ref_list
|
||||
)
|
||||
|
||||
@ -422,7 +421,8 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
|
||||
"""
|
||||
return [('Family', handle) for handle in
|
||||
(self.family_list + self.parent_family_list)] + (
|
||||
self.get_referenced_note_handles() +
|
||||
self.get_referenced_note_handles() +
|
||||
self.get_referenced_citation_handles() +
|
||||
self.get_referenced_tag_handles()
|
||||
)
|
||||
|
||||
@ -434,8 +434,7 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
|
||||
:returns: Returns the list of objects referencing primary objects.
|
||||
:rtype: list
|
||||
"""
|
||||
#don't count double, notes can be found in sourcref
|
||||
return self.get_sourcref_child_list() + self.source_list
|
||||
return self.get_citationref_child_list()
|
||||
|
||||
def merge(self, acquisition):
|
||||
"""
|
||||
@ -462,7 +461,7 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
|
||||
self._merge_url_list(acquisition)
|
||||
self._merge_person_ref_list(acquisition)
|
||||
self._merge_note_list(acquisition)
|
||||
self._merge_source_reference_list(acquisition)
|
||||
self._merge_citation_list(acquisition)
|
||||
self._merge_tag_list(acquisition)
|
||||
|
||||
map(self.add_parent_family_handle,
|
||||
|
@ -3,6 +3,7 @@
|
||||
#
|
||||
# Copyright (C) 2006-2007 Donald N. Allingham
|
||||
# Copyright (C) 2010 Michiel D. Nauta
|
||||
# Copyright (C) 2011 Tim G L Lyons
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -32,7 +33,7 @@ Person Reference class for GRAMPS.
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.lib.secondaryobj import SecondaryObject
|
||||
from gen.lib.privacybase import PrivacyBase
|
||||
from gen.lib.srcbase import SourceBase
|
||||
from gen.lib.citationbase import CitationBase
|
||||
from gen.lib.notebase import NoteBase
|
||||
from gen.lib.refbase import RefBase
|
||||
from gen.lib.const import IDENTICAL, EQUAL, DIFFERENT
|
||||
@ -42,7 +43,7 @@ from gen.lib.const import IDENTICAL, EQUAL, DIFFERENT
|
||||
# Person References for Person/Family
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class PersonRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
|
||||
class PersonRef(SecondaryObject, PrivacyBase, CitationBase, NoteBase, RefBase):
|
||||
"""
|
||||
Person reference class.
|
||||
|
||||
@ -53,7 +54,7 @@ class PersonRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
|
||||
|
||||
def __init__(self, source=None):
|
||||
PrivacyBase.__init__(self, source)
|
||||
SourceBase.__init__(self, source)
|
||||
CitationBase.__init__(self, source)
|
||||
NoteBase.__init__(self, source)
|
||||
RefBase.__init__(self, source)
|
||||
if source:
|
||||
@ -66,7 +67,7 @@ class PersonRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
|
||||
Convert the object to a serialized tuple of data.
|
||||
"""
|
||||
return (PrivacyBase.serialize(self),
|
||||
SourceBase.serialize(self),
|
||||
CitationBase.serialize(self),
|
||||
NoteBase.serialize(self),
|
||||
RefBase.serialize(self),
|
||||
self.rel)
|
||||
@ -75,9 +76,9 @@ class PersonRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
|
||||
"""
|
||||
Convert a serialized tuple of data to an object.
|
||||
"""
|
||||
(privacy, source_list, note_list, ref, self.rel) = data
|
||||
(privacy, citation_list, note_list, ref, self.rel) = data
|
||||
PrivacyBase.unserialize(self, privacy)
|
||||
SourceBase.unserialize(self, source_list)
|
||||
CitationBase.unserialize(self, citation_list)
|
||||
NoteBase.unserialize(self, note_list)
|
||||
RefBase.unserialize(self, ref)
|
||||
return self
|
||||
@ -98,7 +99,7 @@ class PersonRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
|
||||
:returns: Returns the list of child objects that may carry textual data.
|
||||
:rtype: list
|
||||
"""
|
||||
return self.source_list
|
||||
return []
|
||||
|
||||
def get_note_child_list(self):
|
||||
"""
|
||||
@ -108,7 +109,7 @@ class PersonRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
|
||||
refer notes.
|
||||
:rtype: list
|
||||
"""
|
||||
return self.source_list
|
||||
return []
|
||||
|
||||
def get_referenced_handles(self):
|
||||
"""
|
||||
@ -118,7 +119,8 @@ class PersonRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
|
||||
:returns: List of (classname, handle) tuples for referenced objects.
|
||||
:rtype: list
|
||||
"""
|
||||
ret = self.get_referenced_note_handles()
|
||||
ret = self.get_referenced_note_handles() + \
|
||||
self.get_referenced_citation_handles()
|
||||
if self.ref:
|
||||
ret += [('Person', self.ref)]
|
||||
return ret
|
||||
@ -131,7 +133,7 @@ class PersonRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
|
||||
:returns: Returns the list of objects referencing primary objects.
|
||||
:rtype: list
|
||||
"""
|
||||
return self.source_list
|
||||
return []
|
||||
|
||||
def is_equivalent(self, other):
|
||||
"""
|
||||
@ -162,7 +164,7 @@ class PersonRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
|
||||
:param acquisition: PersonRef
|
||||
"""
|
||||
self._merge_privacy(acquisition)
|
||||
self._merge_source_reference_list(acquisition)
|
||||
self._merge_citation_list(acquisition)
|
||||
self._merge_note_list(acquisition)
|
||||
|
||||
def set_relation(self, rel):
|
||||
|
@ -3,6 +3,7 @@
|
||||
#
|
||||
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||
# Copyright (C) 2010 Michiel D. Nauta
|
||||
# Copyright (C) 2011 Tim G L Lyons
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -31,7 +32,7 @@ Place object for GRAMPS.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.lib.primaryobj import PrimaryObject
|
||||
from gen.lib.srcbase import SourceBase
|
||||
from gen.lib.citationbase import CitationBase
|
||||
from gen.lib.notebase import NoteBase
|
||||
from gen.lib.mediabase import MediaBase
|
||||
from gen.lib.urlbase import UrlBase
|
||||
@ -44,7 +45,7 @@ _EMPTY_LOC = Location().serialize()
|
||||
# Place class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Place(SourceBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
|
||||
class Place(CitationBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
|
||||
"""
|
||||
Contains information related to a place, including multiple address
|
||||
information (since place names can change with time), longitude, latitude,
|
||||
@ -59,7 +60,7 @@ class Place(SourceBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
|
||||
:type source: Place
|
||||
"""
|
||||
PrimaryObject.__init__(self, source)
|
||||
SourceBase.__init__(self, source)
|
||||
CitationBase.__init__(self, source)
|
||||
NoteBase.__init__(self, source)
|
||||
MediaBase.__init__(self, source)
|
||||
UrlBase.__init__(self, source)
|
||||
@ -104,7 +105,7 @@ class Place(SourceBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
|
||||
main_loc, [al.serialize() for al in self.alt_loc],
|
||||
UrlBase.serialize(self),
|
||||
MediaBase.serialize(self),
|
||||
SourceBase.serialize(self),
|
||||
CitationBase.serialize(self),
|
||||
NoteBase.serialize(self),
|
||||
self.change, self.private)
|
||||
|
||||
@ -118,7 +119,7 @@ class Place(SourceBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
|
||||
:type data: tuple
|
||||
"""
|
||||
(self.handle, self.gramps_id, self.title, self.long, self.lat,
|
||||
main_loc, alt_loc, urls, media_list, source_list, note_list,
|
||||
main_loc, alt_loc, urls, media_list, citation_list, note_list,
|
||||
self.change, self.private) = data
|
||||
|
||||
if main_loc is None:
|
||||
@ -128,7 +129,7 @@ class Place(SourceBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
|
||||
self.alt_loc = [Location().unserialize(al) for al in alt_loc]
|
||||
UrlBase.unserialize(self, urls)
|
||||
MediaBase.unserialize(self, media_list)
|
||||
SourceBase.unserialize(self, source_list)
|
||||
CitationBase.unserialize(self, citation_list)
|
||||
NoteBase.unserialize(self, note_list)
|
||||
|
||||
def get_text_data_list(self):
|
||||
@ -148,16 +149,16 @@ class Place(SourceBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
|
||||
:rtype: list
|
||||
"""
|
||||
|
||||
ret = self.media_list + self.source_list + self.alt_loc + self.urls
|
||||
ret = self.media_list + self.alt_loc + self.urls
|
||||
if self.main_loc:
|
||||
ret.append(self.main_loc)
|
||||
return ret
|
||||
|
||||
def get_sourcref_child_list(self):
|
||||
def get_citationref_child_list(self):
|
||||
"""
|
||||
Return the list of child secondary objects that may refer sources.
|
||||
Return the list of child secondary objects that may refer citations.
|
||||
|
||||
:returns: List of child secondary child objects that may refer sources.
|
||||
:returns: List of child secondary child objects that may refer citations.
|
||||
:rtype: list
|
||||
"""
|
||||
return self.media_list
|
||||
@ -170,7 +171,7 @@ class Place(SourceBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
|
||||
refer notes.
|
||||
:rtype: list
|
||||
"""
|
||||
return self.media_list + self.source_list
|
||||
return self.media_list
|
||||
|
||||
def get_handle_referents(self):
|
||||
"""
|
||||
@ -180,7 +181,7 @@ class Place(SourceBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
|
||||
:returns: Returns the list of objects referencing primary objects.
|
||||
:rtype: list
|
||||
"""
|
||||
return self.media_list + self.source_list
|
||||
return self.media_list
|
||||
|
||||
def get_referenced_handles(self):
|
||||
"""
|
||||
@ -190,7 +191,8 @@ class Place(SourceBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
|
||||
:returns: List of (classname, handle) tuples for referenced objects.
|
||||
:rtype: list
|
||||
"""
|
||||
return self.get_referenced_note_handles()
|
||||
return self.get_referenced_note_handles() + \
|
||||
self.get_referenced_citation_handles()
|
||||
|
||||
def merge(self, acquisition):
|
||||
""" Merge the content of acquisition into this place.
|
||||
@ -203,7 +205,7 @@ class Place(SourceBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
|
||||
self._merge_media_list(acquisition)
|
||||
self._merge_url_list(acquisition)
|
||||
self._merge_note_list(acquisition)
|
||||
self._merge_source_reference_list(acquisition)
|
||||
self._merge_citation_list(acquisition)
|
||||
|
||||
def set_title(self, title):
|
||||
"""
|
||||
|
@ -85,9 +85,9 @@ class CitationEmbedList(EmbeddedList, DbGUIElement):
|
||||
def __init__(self, dbstate, uistate, track, data, callertitle=None):
|
||||
self.data = data
|
||||
self.callertitle = callertitle
|
||||
EmbeddedList.__init__(self, dbstate, uistate, track, _("_Citations"),
|
||||
CitationRefModel, share_button=True,
|
||||
move_buttons=True)
|
||||
EmbeddedList.__init__(self, dbstate, uistate, track,
|
||||
_("_Source Citations"), CitationRefModel,
|
||||
share_button=True, move_buttons=True)
|
||||
DbGUIElement.__init__(self, dbstate.db)
|
||||
self.callman.register_handles({'citation': self.data})
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
#
|
||||
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||
# 2009 Benny Malengier
|
||||
# Copyright (C) 2011 Tim G L Lyons
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -129,7 +130,7 @@ class NameModel(gtk.TreeStore):
|
||||
row=self.row(self.DEFINDEX, defname))
|
||||
|
||||
def hassource(self, name):
|
||||
if len(name.get_source_references()):
|
||||
if len(name.get_citation_references()):
|
||||
return YES
|
||||
return NO
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000-2006 Donald N. Allingham
|
||||
# Copyright (C) 2-11 Tim G L Lyons
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -20,6 +21,13 @@
|
||||
|
||||
# $Id$
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GTK libraries
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gtk
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS classes
|
||||
@ -27,6 +35,7 @@
|
||||
#-------------------------------------------------------------------------
|
||||
from backrefmodel import BackRefModel
|
||||
from backreflist import BackRefList
|
||||
from gui.widgets import SimpleButton
|
||||
|
||||
class SourceBackRefList(BackRefList):
|
||||
|
||||
@ -34,5 +43,36 @@ class SourceBackRefList(BackRefList):
|
||||
BackRefList.__init__(self, dbstate, uistate, track, obj,
|
||||
BackRefModel, callback=callback)
|
||||
|
||||
def _create_buttons(self, share=False, move=False, jump=False, top_label=None):
|
||||
"""
|
||||
SourceBackrefList inherits from BackrefList inherits from EmbeddedList
|
||||
inherits from ButtonTab
|
||||
_create_buttons is defined in ButtonTab, and overridden in BackRefList.
|
||||
But needs to be overriden here so that there is no edit button for
|
||||
References to Source, because they will all be citations,
|
||||
and the Citations will be displayed in the top part of the
|
||||
editcitation dialogue.
|
||||
|
||||
Create a button box consisting of one button: Edit.
|
||||
This has to be created here because backreflist.py sets it sensitive
|
||||
This button box is then not appended hbox (self).
|
||||
Method has signature of, and overrides create_buttons from _ButtonTab.py
|
||||
"""
|
||||
self.edit_btn = SimpleButton(gtk.STOCK_EDIT, self.edit_button_clicked)
|
||||
self.edit_btn.set_tooltip_text(_('Edit reference'))
|
||||
|
||||
hbox = gtk.HBox()
|
||||
hbox.set_spacing(6)
|
||||
# hbox.pack_start(self.edit_btn, False)
|
||||
hbox.show_all()
|
||||
self.pack_start(hbox, False)
|
||||
|
||||
self.add_btn = None
|
||||
self.del_btn = None
|
||||
|
||||
self.track_ref_for_deletion("edit_btn")
|
||||
self.track_ref_for_deletion("add_btn")
|
||||
self.track_ref_for_deletion("del_btn")
|
||||
|
||||
def get_icon_name(self):
|
||||
return 'gramps-source'
|
||||
|
@ -307,14 +307,6 @@ class EditCitation(EditPrimary):
|
||||
self._add_tab(notebook_src, self.repo_tab)
|
||||
self.track_ref_for_deletion("repo_tab")
|
||||
|
||||
# FIXME:
|
||||
# SourceBackrefList inherits from BackrefList inherits from EmbeddedList
|
||||
# inherits from ButtonTab
|
||||
# _create_buttons is defined in ButtonTab, and overridden in BackRefList.
|
||||
# But needs to be overriden here so that there is no edit button for
|
||||
# References to Source, because they will all be citations,
|
||||
# and the Citations will be displayed in the top part of the
|
||||
# edit dialogue.
|
||||
self.srcref_list = SourceBackRefList(self.dbstate,self.uistate,
|
||||
self.track,
|
||||
self.db.find_backlink_handles(self.source.handle),
|
||||
@ -379,7 +371,6 @@ class EditCitation(EditPrimary):
|
||||
self.db.commit_citation(self.obj, trans)
|
||||
msg += _("\n" + "Edit Citation (%s)") % self.obj.get_page()
|
||||
trans.set_description(msg)
|
||||
LOG.debug(msg)
|
||||
|
||||
if self.callback:
|
||||
self.callback(self.obj.get_handle())
|
||||
|
@ -4,6 +4,7 @@
|
||||
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||
# Copyright (C) 2009 Gary Burton
|
||||
# Copyright (C) 2010 Nick Hall
|
||||
# Copyright (C) 2011 Tim G L Lyons
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -70,7 +71,7 @@ from glade import Glade
|
||||
from editprimary import EditPrimary
|
||||
from editchildref import EditChildRef
|
||||
from editperson import EditPerson
|
||||
from displaytabs import (EmbeddedList, EventEmbedList, SourceEmbedList,
|
||||
from displaytabs import (EmbeddedList, EventEmbedList, CitationEmbedList,
|
||||
FamilyAttrEmbedList, NoteTab, GalleryTab,
|
||||
FamilyLdsEmbedList, ChildModel)
|
||||
from gui.widgets import (PrivacyButton, MonitoredEntry, MonitoredDataType,
|
||||
@ -716,12 +717,13 @@ class EditFamily(EditPrimary):
|
||||
self._add_tab(notebook, self.event_list)
|
||||
self.track_ref_for_deletion("event_list")
|
||||
|
||||
self.source_list = SourceEmbedList(self.dbstate,
|
||||
self.citation_list = CitationEmbedList(self.dbstate,
|
||||
self.uistate,
|
||||
self.track,
|
||||
self.obj)
|
||||
self._add_tab(notebook, self.source_list)
|
||||
self.track_ref_for_deletion("source_list")
|
||||
self.obj.get_citation_list(),
|
||||
self.get_menu_title())
|
||||
self._add_tab(notebook, self.citation_list)
|
||||
self.track_ref_for_deletion("citation_list")
|
||||
|
||||
self.attr_list = FamilyAttrEmbedList(self.dbstate,
|
||||
self.uistate,
|
||||
|
@ -3,6 +3,7 @@
|
||||
#
|
||||
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||
# 2009 Gary Burton
|
||||
# Copyright (C) 2011 Tim G L Lyons
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -50,7 +51,7 @@ import LdsUtils
|
||||
from glade import Glade
|
||||
from editsecondary import EditSecondary
|
||||
from objectentries import PlaceEntry
|
||||
from displaytabs import SourceEmbedList,NoteTab
|
||||
from displaytabs import CitationEmbedList,NoteTab
|
||||
from gui.widgets import (PrivacyButton, MonitoredDate,
|
||||
MonitoredMenu, MonitoredStrMenu)
|
||||
from gui.selectors import SelectorFactory
|
||||
@ -239,10 +240,11 @@ class EditLdsOrd(EditSecondary):
|
||||
|
||||
def _create_tabbed_pages(self):
|
||||
notebook = gtk.Notebook()
|
||||
self.srcref_list = SourceEmbedList(self.dbstate, self.uistate,
|
||||
self.track, self.obj)
|
||||
self._add_tab(notebook, self.srcref_list)
|
||||
self.track_ref_for_deletion("srcref_list")
|
||||
self.citation_list = CitationEmbedList(self.dbstate, self.uistate,
|
||||
self.track,
|
||||
self.obj.get_citation_list())
|
||||
self._add_tab(notebook, self.citation_list)
|
||||
self.track_ref_for_deletion("citation_list")
|
||||
|
||||
self.note_tab = NoteTab(self.dbstate, self.uistate, self.track,
|
||||
self.obj.get_note_list(),
|
||||
@ -404,7 +406,7 @@ class EditFamilyLdsOrd(EditSecondary):
|
||||
|
||||
def _create_tabbed_pages(self):
|
||||
notebook = gtk.Notebook()
|
||||
self.srcref_list = SourceEmbedList(self.dbstate,self.uistate, self.track,self.obj)
|
||||
self.srcref_list = CitationEmbedList(self.dbstate,self.uistate, self.track,self.obj)
|
||||
self._add_tab(notebook, self.srcref_list)
|
||||
self.track_ref_for_deletion("srcref_list")
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||
# Copyright (C) 2009-2011 Gary Burton
|
||||
# Copyright (C) 2010 Nick Hall
|
||||
# Copyright (C) 2011 Tim G L Lyons
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -65,7 +66,7 @@ import config
|
||||
from QuestionDialog import ErrorDialog, ICON
|
||||
from Errors import ValidationError
|
||||
|
||||
from displaytabs import (PersonEventEmbedList, NameEmbedList, SourceEmbedList,
|
||||
from displaytabs import (PersonEventEmbedList, NameEmbedList, CitationEmbedList,
|
||||
AttrEmbedList, AddrEmbedList, NoteTab, GalleryTab,
|
||||
WebEmbedList, PersonRefEmbedList, LdsEmbedList,
|
||||
PersonBackRefList, SurnameTab)
|
||||
@ -443,10 +444,11 @@ class EditPerson(EditPrimary):
|
||||
self._add_tab(notebook, self.name_list)
|
||||
self.track_ref_for_deletion("name_list")
|
||||
|
||||
self.srcref_list = SourceEmbedList(self.dbstate,
|
||||
self.srcref_list = CitationEmbedList(self.dbstate,
|
||||
self.uistate,
|
||||
self.track,
|
||||
self.obj)
|
||||
self.obj.get_citation_list(),
|
||||
self.get_menu_title())
|
||||
self._add_tab(notebook, self.srcref_list)
|
||||
self.track_ref_for_deletion("srcref_list")
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
# Copyright (C) 2000-2006 Donald N. Allingham
|
||||
# Copyright (C) 2009 Gary Burton
|
||||
# Copyright (C) 2010 Nick Hall
|
||||
# Copyright (C) 2011 Tim G L lyons
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -46,7 +47,7 @@ import gtk
|
||||
import gen.lib
|
||||
from gen.db import DbTxn
|
||||
from editprimary import EditPrimary
|
||||
from displaytabs import (GrampsTab, LocationEmbedList, SourceEmbedList,
|
||||
from displaytabs import (GrampsTab, LocationEmbedList, CitationEmbedList,
|
||||
GalleryTab, NoteTab, WebEmbedList, PlaceBackRefList)
|
||||
from gui.widgets import MonitoredEntry, PrivacyButton
|
||||
from Errors import ValidationError
|
||||
@ -244,12 +245,13 @@ class EditPlace(EditPrimary):
|
||||
self._add_tab(notebook, self.loc_list)
|
||||
self.track_ref_for_deletion("loc_list")
|
||||
|
||||
self.srcref_list = SourceEmbedList(self.dbstate,
|
||||
self.uistate,
|
||||
self.track,
|
||||
self.obj)
|
||||
self._add_tab(notebook, self.srcref_list)
|
||||
self.track_ref_for_deletion("srcref_list")
|
||||
self.citation_list = CitationEmbedList(self.dbstate,
|
||||
self.uistate,
|
||||
self.track,
|
||||
self.obj.get_citation_list(),
|
||||
self.get_menu_title())
|
||||
self._add_tab(notebook, self.citation_list)
|
||||
self.track_ref_for_deletion("citation_list")
|
||||
|
||||
self.note_tab = NoteTab(self.dbstate,
|
||||
self.uistate,
|
||||
|
@ -4,6 +4,7 @@
|
||||
# Copyright (C) 2008 Gary Burton
|
||||
# Copyright (C) 2009-2010 Nick Hall
|
||||
# Copyright (C) 2010 Benny Malengier
|
||||
# Copyright (C) 2011 Tim G L Lyons
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -450,7 +451,7 @@ class BasePersonView(ListView):
|
||||
"Person Gallery",
|
||||
"Person Events",
|
||||
"Person Children",
|
||||
"Person Sources",
|
||||
"Person Citations",
|
||||
"Person Notes",
|
||||
"Person Attributes",
|
||||
"Person Backlinks"))
|
||||
|
@ -3,6 +3,7 @@
|
||||
# Copyright (C) 2001-2006 Donald N. Allingham
|
||||
# Copyright (C) 2008 Gary Burton
|
||||
# Copyright (C) 2010 Nick Hall
|
||||
# Copyright (C) 2011 Tim G L Lyons
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -428,7 +429,7 @@ class PlaceBaseView(ListView):
|
||||
return (("Place Filter",),
|
||||
("Place Details",
|
||||
"Place Gallery",
|
||||
"Place Sources",
|
||||
"Place Citations",
|
||||
"Place Notes",
|
||||
"Place Backlinks"))
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#
|
||||
# Copyright (C) 2001-2006 Donald N. Allingham
|
||||
# Copyright (C) 2010 Nick Hall
|
||||
# Copyright (C) 2011 Tim G L Lyons
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -348,7 +349,7 @@ class FamilyView(ListView):
|
||||
("Family Gallery",
|
||||
"Family Events",
|
||||
"Family Children",
|
||||
"Family Sources",
|
||||
"Family Citations",
|
||||
"Family Notes",
|
||||
"Family Attributes",
|
||||
"Family Backlinks"))
|
||||
|
Loading…
Reference in New Issue
Block a user