GEP18: big database change for source and citation

svn: r22639
This commit is contained in:
Benny Malengier 2013-07-01 19:27:48 +00:00
parent 6c04f8b151
commit 38db8959fa
46 changed files with 11560 additions and 11401 deletions

View File

@ -229,7 +229,7 @@ SOURCES
-->
<!ELEMENT sources (source)*>
<!ELEMENT source (stitle?, sauthor?, spubinfo?, sabbrev?,
<!ELEMENT source (sname?, stemplate?, sabbrev?,
noteref*, objref*, srcattribute*, reporef*, tagref*)>
<!ATTLIST source
id CDATA #IMPLIED
@ -237,9 +237,8 @@ SOURCES
priv (0|1) #IMPLIED
change CDATA #REQUIRED
>
<!ELEMENT stitle (#PCDATA)>
<!ELEMENT sauthor (#PCDATA)>
<!ELEMENT spubinfo (#PCDATA)>
<!ELEMENT sname (#PCDATA)>
<!ELEMENT stemplate (#PCDATA)>
<!ELEMENT sabbrev (#PCDATA)>
<!-- ************************************************************
@ -368,7 +367,7 @@ CITATIONS
<!ELEMENT citations (citation)*>
<!ELEMENT citation ((daterange|datespan|dateval|datestr)?, page?, confidence?,
<!ELEMENT citation ((daterange|datespan|dateval|datestr)?, cname?, confidence?,
noteref*, objref*, srcattribute*, sourceref, tagref*)>
<!ATTLIST citation
id CDATA #IMPLIED
@ -376,6 +375,7 @@ CITATIONS
priv (0|1) #IMPLIED
change CDATA #REQUIRED
>
<!ELEMENT cname (#PCDATA)>
<!-- ************************************************************
BOOKMARKS

View File

@ -430,7 +430,7 @@
<define name="citation-content">
<ref name="primary-object"/>
<optional><ref name="date-content"/></optional>
<optional><element name="page"><text/></element></optional>
<optional><element name="cname"><text/></element></optional>
<optional><element name="confidence"><text/></element></optional>
<zeroOrMore><element name="noteref">
<ref name="noteref-content"/>
@ -448,9 +448,8 @@
<define name="source-content">
<ref name="primary-object"/>
<optional><element name="stitle"><text/></element></optional>
<optional><element name="sauthor"><text/></element></optional>
<optional><element name="spubinfo"><text/></element></optional>
<optional><element name="sname"><text/></element></optional>
<optional><element name="stemplate"><text/></element></optional>
<optional><element name="sabbrev"><text/></element></optional>
<zeroOrMore><element name="noteref">
<ref name="noteref-content"/>

File diff suppressed because it is too large Load Diff

View File

@ -55,6 +55,9 @@ def gramps_upgrade_17(self):
1. This upgrade adds tags to event, place, repository, source and
citation objects.
2. Data of Source becomes SourceAttributes Secondary Object
3. Citation page is deprecated and becomes Citation name
Source title, author and pubinfo are deprecated. Now there is
Source template and name instead.
"""
length = (len(self.event_map) + len(self.place_map) +
len(self.repository_map) + len(self.source_map) +
@ -137,15 +140,33 @@ def gramps_upgrade_17(self):
self.update()
# -------------------------------------------------------
# Upgrade Source and Citation datamap to SrcAttributeBase
# 1. Upgrade Source and Citation datamap to SrcAttributeBase
# 2. Citation page is deprecated and becomes Citation name
# Source title, author and pubinfo are deprecated. Now there is
# Source template and name instead.
# -------------------------------------------------------
from ..lib.srcattrtype import SrcAttributeType
private = False
for handle in self.source_map.keys():
source = self.source_map[handle]
(handle, gramps_id, title, author, pubinfo,
notelist, medialist, abbrev, change, datamap, reporef_list,
taglist, private) = source
srcattributelist = upgrade_datamap_17(datamap)
new_source = (handle, gramps_id, title, author, pubinfo,
if title:
the_type = (SrcAttributeType.TITLE, '')
srcattributelist.append((private, the_type, title))
if author:
the_type = (SrcAttributeType.AUTHOR, '')
srcattributelist.append((private, the_type, author))
if pubinfo:
the_type = (SrcAttributeType.PUB_INFO, '')
srcattributelist.append((private, the_type, pubinfo))
name = title
template = 'GEDCOM'
new_source = (handle, gramps_id, name, template,
notelist, medialist, abbrev, change, srcattributelist, reporef_list,
taglist, private)
with BSDDBTxn(self.env, self.source_map) as txn:
@ -159,7 +180,12 @@ def gramps_upgrade_17(self):
(handle, gramps_id, datelist, page, confidence, source_handle,
notelist, medialist, datamap, change, taglist, private) = citation
srcattributelist = upgrade_datamap_17(datamap)
new_citation = (handle, gramps_id, datelist, page, confidence, source_handle,
if page:
the_type = (SrcAttributeType.PAGE, '')
srcattributelist.append((private, the_type, page))
name = page
new_citation = (handle, gramps_id, datelist, name, confidence, source_handle,
notelist, medialist, srcattributelist, change, taglist, private)
with BSDDBTxn(self.env, self.citation_map) as txn:
if isinstance(handle, UNITYPE):

View File

@ -48,7 +48,7 @@ class HasCitationBase(Rule):
First parameter is [Volume/page, Date, Confidence]
"""
labels = [ _('Volume/Page:'),
labels = [ _('Name:'),
_('Date:'),
_('Confidence:') ]
name = _('Citations matching parameters')
@ -72,7 +72,7 @@ class HasCitationBase(Rule):
return False
def _apply(self, db, citation):
if not self.match_substring(0, citation.get_page()):
if not self.match_substring(0, citation.get_name()):
return False
if self.date:

View File

@ -47,7 +47,7 @@ from ....datehandler import parser
class HasCitation(Rule):
"""Rule that checks for a citations with a particular value"""
labels = [ _('Volume/Page:'),
labels = [ _('Name:'),
_('Date:'),
_('Confidence level:')]
name = _('Citations matching parameters')
@ -64,7 +64,7 @@ class HasCitation(Rule):
pass
def apply(self, dbase, citation):
if not self.match_substring(0, citation.get_page()):
if not self.match_substring(0, citation.get_name()):
return False
if self.date:

View File

@ -42,14 +42,14 @@ class MatchesPageSubstringOf(Rule):
"""Citation Volume/Page title containing <substring>"""
labels = [ _('Substring:')]
name = _('Citation Volume/Page containing <substring>')
description = _("Matches citations whose Volume/Page contains a "
name = _('Citation Name containing <substring>')
description = _("Matches citations whose Name contains a "
"certain substring")
category = _('General filters')
def apply(self, db, object):
""" Apply the filter """
title = object.get_page()
title = object.get_name()
if title.upper().find(self.list[0].upper()) != -1:
return True
return False

View File

@ -45,6 +45,7 @@ from .notebase import NoteBase
from .datebase import DateBase
from .tagbase import TagBase
from .srcattrbase import SrcAttributeBase
from .srctemplate import SrcTemplate
from ..constfunc import cuni, deprecated
from .handle import Handle
@ -75,7 +76,7 @@ class Citation(MediaBase, NoteBase, SrcAttributeBase, PrimaryObject, DateBase):
NoteBase.__init__(self) # 6
DateBase.__init__(self) # 2
self.source_handle = None # 5
self.page = "" # 3
self.name = "" # 3
self.confidence = Citation.CONF_NORMAL # 4
SrcAttributeBase.__init__(self) # 8
@ -86,7 +87,7 @@ class Citation(MediaBase, NoteBase, SrcAttributeBase, PrimaryObject, DateBase):
return (self.handle, # 0
self.gramps_id, # 1
DateBase.serialize(self, no_text_date),# 2
cuni(self.page), # 3
cuni(self.name), # 3
self.confidence, # 4
self.source_handle, # 5
NoteBase.serialize(self), # 6
@ -119,7 +120,7 @@ class Citation(MediaBase, NoteBase, SrcAttributeBase, PrimaryObject, DateBase):
return {"handle": Handle("Citation", self.handle), # 0
"gramps_id": self.gramps_id, # 1
"date": DateBase.to_struct(self), # 2
"page": cuni(self.page), # 3
"name": cuni(self.name), # 3
"confidence": self.confidence, # 4
"source_handle": Handle("Source", self.source_handle), # 5
"note_list": NoteBase.to_struct(self), # 6
@ -137,7 +138,7 @@ class Citation(MediaBase, NoteBase, SrcAttributeBase, PrimaryObject, DateBase):
(self.handle, # 0
self.gramps_id, # 1
date, # 2
self.page, # 3
self.name, # 3
self.confidence, # 4
self.source_handle, # 5
note_list, # 6
@ -284,17 +285,63 @@ class Citation(MediaBase, NoteBase, SrcAttributeBase, PrimaryObject, DateBase):
"""Return the confidence level."""
return self.confidence
def set_page(self, page):
"""Set the page indicator of the Citation."""
self.page = page
def set_name(self, name):
"""
Set a descriptive name for the Citation object, which will be used in
Gramps for sorting, identification.
Typically, this value is set automatically based on the template of the
Source of this Citation, but is user changeable if needed.
:param name: a descriptive name to assign to the Citation
:type name: str
"""
self.name = name
def get_name(self):
"""
Return the descriptive name of the citation
:returns: Returns the descriptive name of the Citation
:rtype: str
"""
return self.name
@deprecated
def get_page(self):
"""Get the page indicator of the Citation."""
return self.page
def set_reference_handle(self, val):
self.source_handle = val
def get_reference_handle(self):
return self.source_handle
#-------------------------------------------------------------------------
#
# GEDCOM interface
#
#-------------------------------------------------------------------------
@deprecated
def get_page(self):
"""Get the page indicator of the Citation.
This method is deprecated. the citation name is returned as fallback.
Convert to get_name, or use the source template to construct citation
reference information
"""
return self.get_name()
def get_gedcom_page(self, templatekey):
"""
Return the descriptive page part as used in GEDCOM
page depends on the source template. The logic is:
1. obtain template, if no key given, name of citation is used
2. create page from the 'full' reference
:returns: Returns the descriptive page part of the citation
:rtype: str
"""
attrlist = self.get_attribute_list()
if templatekey:
stemp = SrcTemplate(templatekey)
return stemp.page_gedcom(attrlist)
else:
return self.get_name()

View File

@ -56,9 +56,8 @@ class Source(MediaBase, NoteBase, SrcAttributeBase, PrimaryObject):
MediaBase.__init__(self)
NoteBase.__init__(self)
SrcAttributeBase.__init__(self)
self.title = ""
self.author = ""
self.pubinfo = ""
self.name = ""
self.template = 'GEDCOM'
self.abbrev = ""
self.reporef_list = []
@ -68,17 +67,16 @@ class Source(MediaBase, NoteBase, SrcAttributeBase, PrimaryObject):
"""
return (self.handle, # 0
self.gramps_id, # 1
cuni(self.title), # 2
cuni(self.author), # 3
cuni(self.pubinfo), # 4
NoteBase.serialize(self), # 5
MediaBase.serialize(self), # 6
cuni(self.abbrev), # 7
self.change, # 8
SrcAttributeBase.serialize(self), # 9
[rr.serialize() for rr in self.reporef_list], # 10
TagBase.serialize(self), # 11
self.private) # 12
cuni(self.name), # 2
cuni(self.template), # 3
NoteBase.serialize(self), # 4
MediaBase.serialize(self), # 5
cuni(self.abbrev), # 6
self.change, # 7
SrcAttributeBase.serialize(self), # 8
[rr.serialize() for rr in self.reporef_list], # 9
TagBase.serialize(self), # 10
self.private) # 11
def to_struct(self):
"""
@ -102,9 +100,8 @@ class Source(MediaBase, NoteBase, SrcAttributeBase, PrimaryObject):
"""
return {"handle": Handle("Source", self.handle),
"gramps_id": self.gramps_id,
"title": cuni(self.title),
"author": cuni(self.author),
"pubinfo": cuni(self.pubinfo),
"name": cuni(self.name),
"template": cuni(self.template),
"note_list": NoteBase.to_struct(self),
"media_list": MediaBase.to_struct(self),
"abbrev": cuni(self.abbrev),
@ -121,17 +118,16 @@ class Source(MediaBase, NoteBase, SrcAttributeBase, PrimaryObject):
"""
(self.handle, # 0
self.gramps_id, # 1
self.title, # 2
self.author, # 3
self.pubinfo, # 4
note_list, # 5
media_list, # 6
self.abbrev, # 7
self.change, # 8
srcattr_list, # 9
reporef_list, # 10
tag_list, # 11
self.private # 12
self.name, # 2
self.template, # 3
note_list, # 4
media_list, # 5
self.abbrev, # 6
self.change, # 7
srcattr_list, # 8
reporef_list, # 9
tag_list, # 10
self.private # 11
) = data
NoteBase.unserialize(self, note_list)
@ -264,67 +260,61 @@ class Source(MediaBase, NoteBase, SrcAttributeBase, PrimaryObject):
self._merge_attribute_list(acquisition)
self._merge_reporef_list(acquisition)
def set_title(self, title):
def set_template(self, template):
"""
Set the descriptive title of the Source object.
Set the template type of the Source object. This defines a number of
preset SrcAttributes to be filled in by the user
:param title: descriptive title to assign to the Source
:type title: str
:param template: a template code as defined in SrcTemplate
:type template: str
"""
self.title = title
self.template = template
@deprecated
def get_title(self):
"""
Return the descriptive title of the Place object.
def get_template(self):
"""Return the template type of the Source
:returns: Returns the descriptive title of the Place
:returns: Returns the code of the SrcTemplate set for this Source
:rtype: str
"""
return self.title
return self.template
## def set_author(self, author):
## """Set the author of the Source."""
## self.author = author
@deprecated
def get_author(self):
"""Return the author of the Source.
Author depends on the source template. The logic is:
1. obtain template
2. create author from the 'full' reference
3. if no template, it defaults to GEDCOM, so AUTHOR will be used
def set_name(self, name):
"""
attrlist = self.get_attribute_list()
stemp = SrcTemplate(self.get_source_template()[0])
Set a descriptive name for the Source object, which will be used in
Gramps for sorting, identification.
Typically, this value is set automatically based on the template, but
is user changeable if needed.
return stemp.author_gedcom(attrlist)
## def set_publication_info(self, text):
## """Set the publication information of the Source."""
## self.pubinfo = text
@deprecated
def get_publication_info(self):
"""Return the publication information of the Source.
PubInfo depends on the source template. The logic is:
1. obtain template
2. create pubinfo from the 'full' reference
3. if no template, it defaults to GEDCOM, so PUB_INFO will be used
:param name: a descriptive name to assign to the Source
:type name: str
"""
attrlist = self.get_attribute_list()
stemp = SrcTemplate(self.get_source_template()[0])
self.name = name
return stemp.pubinfo_gedcom(attrlist)
def get_name(self):
"""
Return the descriptive name of the source
:returns: Returns the descriptive name of the source
:rtype: str
"""
return self.name
def set_abbreviation(self, abbrev):
"""Set the title abbreviation of the Source."""
"""Set the title abbreviation of the Source used for LOCAL
sorting or filing.
:param abbrev: Short form used to retrieve Source locally
:type abbrev: str
"""
self.abbrev = abbrev
@deprecated
def get_abbreviation(self):
"""Return the title abbreviation of the Source."""
print 'test'
"""Return the title abbreviation of the Source used for LOCAL
sorting or filing.
:returns: Short form used to retrieve Source locally
:rtype: str
"""
return self.abbrev
def add_repo_reference(self, repo_ref):
@ -428,3 +418,61 @@ class Source(MediaBase, NoteBase, SrcAttributeBase, PrimaryObject):
new_ref.merge(repo_ref)
self.reporef_list.pop(idx)
refs_list.pop(idx)
#-------------------------------------------------------------------------
#
# GEDCOM interface
#
#-------------------------------------------------------------------------
@deprecated
def get_title(self):
return self.get_gedcom_title()
@deprecated
def get_author(self):
return self.get_gedcom_author()
@deprecated
def get_publication_info(self):
return self.get_gedcom_publication_info()
def get_gedcom_title(self):
"""
Return the descriptive title of the source
Title depends on the source template. The logic is:
1. obtain template
2. create title from the 'full' reference
3. if no template, it defaults to GEDCOM, so TITLE will be used
:returns: Returns the descriptive title of the source
:rtype: str
"""
attrlist = self.get_attribute_list()
stemp = SrcTemplate(self.get_template())
return stemp.title_gedcom(attrlist)
def get_gedcom_author(self):
"""Return the author of the Source.
Author depends on the source template. The logic is:
1. obtain template
2. create author from the 'full' reference
3. if no template, it defaults to GEDCOM, so AUTHOR will be used
"""
attrlist = self.get_attribute_list()
stemp = SrcTemplate(self.get_template())
return stemp.author_gedcom(attrlist)
def get_gedcom_publication_info(self):
"""Return the publication information of the Source.
PubInfo depends on the source template. The logic is:
1. obtain template
2. create pubinfo from the 'full' reference
3. if no template, it defaults to GEDCOM, so PUB_INFO will be used
"""
attrlist = self.get_attribute_list()
stemp = SrcTemplate(self.get_template())
return stemp.pubinfo_gedcom(attrlist)

View File

@ -35,8 +35,6 @@ _ = glocale.translation.gettext
#-------------------------------------------------------------------------
from .attrbase import AttributeRootBase
from .srcattribute import SrcAttribute
from .srcattrtype import SrcAttributeType
from .srctemplate import SrcTemplate
#-------------------------------------------------------------------------
#
@ -46,64 +44,3 @@ from .srctemplate import SrcTemplate
class SrcAttributeBase(AttributeRootBase):
_CLASS = SrcAttribute
#------------------------------------------------------------------------
#
# Logical methods
#
#------------------------------------------------------------------------
def get_source_template(self):
"""
Return the source template of the source/citation
This is the value of the first source template in the attribute list
If not known UNKNOWN is returned as key, which is integer. Other keys
will be str.
:rtype tuple: (index, description, string_key_as stored)
"""
#no template is UNKNOWN!
templ = SrcTemplate.UNKNOWN
for attr in self.attribute_list:
if int(attr.get_type()) == SrcAttributeType.SRCTEMPLATE:
val = attr.get_value()
if SrcTemplate.template_defined(val):
templ = val
else:
# a template not in the predefined list. convert to unknown
print ('Unknown Template: Keyerror:', val,
'For now UNKNOWN is used.\nDownload required template style!')
break
try:
retval = (templ, SrcTemplate.template_description(templ))
except KeyError:
#templ is not present, return the default GEDCOM value as actual
#template
templ = SrcTemplate.UNKNOWN
retval = (templ, _('Unknown'))
return retval
def set_source_template(self, template):
"""
Set the source template of the source/citation
This is the value of the first source template in the attribute list
If tempindex is UNKNOWN, the template is removed.
If tempindex is not CUSTOM, string value of tempindex is stored.
Otherwise, the user given string value tempcustom_str is stored
:param tempindex: integer template key
:param tempcustom_str: string of a custom key to use as value for
template
"""
attrtemp = None
for attr in self.attribute_list:
if int(attr.get_type()) == SrcAttributeType.SRCTEMPLATE:
#we update the existing template
attrtemp = attr
break
if attrtemp is None:
#we create a new attribute and add it
attrtemp = SrcAttribute()
self.add_attribute(attrtemp)
if template == SrcTemplate.UNKNOWN:
self.remove_attribute(attrtemp)
else:
#custom key, store string as is
attrtemp.set_value(template)

View File

@ -56,6 +56,7 @@ GED_TITLE = 2
GED_PUBINF = 3
# template to GEDCOM field mapping for Date in F reference fields
GED_DATE = 4
GED_PAGE = 5
# template to a shortening algorithm mapping for predefined algorithms
SHORTERALG_LOC = 1 # reduce a location to a shorter format (typically city level)
SHORTERALG_YEAR = 2 # reduce a date to only the year part
@ -87,7 +88,6 @@ class SrcAttributeType(GrampsType):
# PREDEFINED TYPES
UNKNOWN = -1
CUSTOM = 0
SRCTEMPLATE = 1
# GEDCOM support
EVEN_REC = 2
EVEN_CITED = 3
@ -103,14 +103,9 @@ class SrcAttributeType(GrampsType):
# 2. existing class attributes
DATE = 14
_CUSTOM = CUSTOM
_DEFAULT = SRCTEMPLATE
_DATAMAP = [
(UNKNOWN , _("Unknown"), "Unknown"),
(CUSTOM , _("Custom"), "Custom"),
# required attribute to use for Elizabeth Shown Mills citation defs
(SRCTEMPLATE , _("Source Template"), "Source Template"),
# GEDCOM support
(EVEN_REC , _("Events Recorded in Source"), "Events Recorded in Source"), # GEDCOM EVENTS_RECORDED
(EVEN_CITED , _("Event Type Used for Citation"), "Event Type Used for Citation"), # GEDCOM EVENT_TYPE_CITED_FROM
@ -267,6 +262,9 @@ class SrcAttributeType(GrampsType):
YEAR_ACCESSED = 172
YEAR_SHORT_VERSION = 212
_CUSTOM = CUSTOM
_DEFAULT = TITLE
_DATAMAPIGNORE = [
AUTHOR_SHORT_VERSION,
TITLE_SHORT_VERSION,

View File

@ -357,18 +357,12 @@ class SrcTemplate(object):
Change to the new template key for reference styling
"""
self.empty()
if template_key == UNKNOWN:
self.template_key = template_key
if template_key == UNKNOWN or template_key not in EVIDENCETEMPLATES:
#for key unknown we use styling according to GEDCOM
template_key = 'GEDCOM'
try:
self.tempstruct = EVIDENCETEMPLATES[template_key]
except:
print
raise NotImplementedError, 'SrcTemplate: Keyerror "' \
+ str(template_key) \
+ '", custom templates templates not implemented!'
self.template_key = template_key
self.tempstruct = EVIDENCETEMPLATES[template_key]
def set_attr_list(self, attr_list, attr_list_citation=None, date_citation=None):
"""
@ -482,6 +476,21 @@ class SrcTemplate(object):
self.refF = self._reference(REF_TYPE_F)
return self.refF
def __ged_page_reflist(self):
"""
Construct a derived template reflist for use to construct the gedcom
page field
"""
reflist_F = self.tempstruct[REF_TYPE_F]
reflist_L_fields = [field[1] for field in self.tempstruct[REF_TYPE_L]]
result = []
for entry in reflist_F:
if entry[1] in reflist_L_fields:
continue
if entry[1] == SrcAttributeType.DATE:
continue
result.append(entry)
def _reference(self, reftype, gedcomfield=None):
"""
Compute the reference based on data present.
@ -490,7 +499,10 @@ class SrcTemplate(object):
THIS IS UGLY CODE AT THE MOMENT! SHOULD BE ENTIRELY REWRITTEN, FOR
NOW IT JUST GIVES ME SOMETHING TO USE IN THE PROTOTYPE !!
"""
reflist = self.tempstruct[reftype]
if gedcomfield == GED_PAGE:
self.__ged_page_reflist()
else:
reflist = self.tempstruct[reftype]
# reflist is typically a list like
# [ ('', AUTHOR, '', ',', EMPTY, False, False, EMPTY, EMPTY, None, None),
# ('', TITLE, '', ',', STYLE_QUOTE, False, False, EMPTY, EMPTY, None, None),
@ -627,3 +639,8 @@ class SrcTemplate(object):
if attr_list:
self.set_attr_list(attr_list)
return self._reference(REF_TYPE_L, GED_PUBINF)
def page_gedcom(self, attr_list=None):
if attr_list:
self.set_attr_list(attr_list)
return self._reference(REF_TYPE_F, GED_PAGE)

View File

@ -66,7 +66,7 @@ class CitationBaseTest:
def test_citation_merge(self):
citation = Citation()
citation.set_reference_handle('123456')
citation.set_page('p.10')
citation.set_name('p.10')
self.titanic.add_citation(citation.handle)
self.ref_obj.add_citation(citation.handle)
self.phoenix.merge(self.titanic)
@ -385,10 +385,10 @@ class EventRefCheck(unittest.TestCase, PrivacyBaseTest, NoteBaseTest,
attr1.set_value(10)
citation1 = Citation()
citation1.set_reference_handle('123456')
citation1.set_page('p.10')
citation1.set_name('p.10')
citation2 = Citation()
citation2.set_reference_handle('234567')
citation2.set_page('p.20')
citation2.set_name('p.20')
attr1.add_citation(citation1.handle)
attr1.add_citation(citation2.handle)
attr2 = Attribute()
@ -396,10 +396,10 @@ class EventRefCheck(unittest.TestCase, PrivacyBaseTest, NoteBaseTest,
attr2.set_value(10)
citation3 = Citation()
citation3.set_reference_handle('123456')
citation3.set_page('p.10')
citation3.set_name('p.10')
citation4 = Citation()
citation4.set_reference_handle('654321')
citation4.set_page('p.20')
citation4.set_name('p.20')
attr2.add_citation(citation3.handle)
attr2.add_citation(citation4.handle)
self.phoenix.add_attribute(attr1)
@ -1539,11 +1539,11 @@ class SourceCheck(unittest.TestCase, PrivacyBaseTest, NoteBaseTest,
MediaBaseTest):
def setUp(self):
self.phoenix = Source()
self.phoenix.set_title("Source 1")
self.phoenix.set_name("Source 1")
self.titanic = Source()
self.titanic.set_title("Source 1")
self.titanic.set_name("Source 1")
self.ref_obj = Source()
self.ref_obj.set_title("Source 1")
self.ref_obj.set_name("Source 1")
def todo_test_replace(self):
pass
@ -1701,7 +1701,7 @@ class CitationBaseCheck(unittest.TestCase):
def test_replace_newpresent(self):
citation = Citation()
citation.set_reference_handle('654321')
citation.set_page('p.10')
citation.set_name('p.10')
citation2 = Citation()
citation2.set_reference_handle('234567')
self.phoenix.add_citation(citation.handle)
@ -1738,13 +1738,13 @@ class CitationCheck(unittest.TestCase, PrivacyBaseTest, MediaBaseTest,
def setUp(self):
self.phoenix = Citation()
self.phoenix.set_reference_handle('123456')
self.phoenix.set_page('p.10')
self.phoenix.set_name('p.10')
self.titanic = Citation()
self.titanic.set_reference_handle('123456')
self.titanic.set_page('p.10')
self.titanic.set_name('p.10')
self.ref_obj = Citation()
self.ref_obj.set_reference_handle('123456')
self.ref_obj.set_page('p.10')
self.ref_obj.set_name('p.10')
def test_merge_confidence(self):
known_values = ( (0, 0, 0), (0, 1, 0), (0, 2, 0), (0, 3, 0), (0, 4, 0),

View File

@ -762,7 +762,7 @@ def sanitize_citation(db, citation):
"""
new_citation = Citation()
new_citation.set_date_object(citation.get_date_object())
new_citation.set_page(citation.get_page())
new_citation.set_name(citation.get_name())
new_citation.set_confidence_level(citation.get_confidence_level())
new_citation.set_reference_handle(citation.get_reference_handle())
new_citation.set_gramps_id(citation.get_gramps_id())
@ -906,9 +906,8 @@ def sanitize_source(db, source):
"""
new_source = Source()
new_source.set_author(source.get_author())
new_source.set_title(source.get_title())
new_source.set_publication_info(source.get_publication_info())
new_source.set_name(source.get_name())
new_source.set_template(source.get_template())
new_source.set_abbreviation(source.get_abbreviation())
new_source.set_gramps_id(source.get_gramps_id())
new_source.set_handle(source.get_handle())

View File

@ -348,14 +348,14 @@ def navigation_label(db, nav_type, handle):
elif nav_type == 'Source':
obj = db.get_source_from_handle(handle)
if obj:
label = obj.get_title()
label = obj.get_name()
elif nav_type == 'Citation':
obj = db.get_citation_from_handle(handle)
if obj:
label = obj.get_page()
label = obj.get_name()
src = db.get_source_from_handle(obj.get_reference_handle())
if src:
label = src.get_title() + " " + label
label = src.get_name() + " " + label
elif nav_type == 'Repository':
obj = db.get_repository_from_handle(handle)
if obj:

View File

@ -508,9 +508,9 @@ class ClipCitation(ClipHandleWrapper):
citation.get_note_list()))
srctxtlist = [note for note in notelist
if note.get_type() == NoteType.SOURCE_TEXT]
page = citation.get_page()
if not page:
page = _('not available|NA')
cname = citation.get_name()
if not cname:
cname = _('not available|NA')
text = ""
if len(srctxtlist) > 0:
text = " ".join(srctxtlist[0].get().split())
@ -519,8 +519,8 @@ class ClipCitation(ClipHandleWrapper):
text = cuni(text)
if len(text) > 60:
text = text[:60]+"..."
self._value = _("Volume/Page: %(pag)s -- %(sourcetext)s") % {
'pag' : page,
self._value = _("Citation Name: %(name)s -- %(sourcetext)s") % {
'name' : cname,
'sourcetext' : text,
}
@ -774,7 +774,7 @@ class ClipSourceLink(ClipHandleWrapper):
source = self._db.get_source_from_handle(self._handle)
if source:
self._title = source.get_gramps_id()
self._value = source.get_title()
self._value = source.get_name()
def is_valid(self):
data = pickle.loads(self._obj)

View File

@ -97,14 +97,14 @@ class BackRefModel(Gtk.ListStore):
continue
gid = p.gramps_id
handle = p.handle
name = p.get_title()
name = p.get_name()
elif dtype == 'Citation':
p = self.db.get_citation_from_handle(ref[1])
if not p:
continue
gid = p.gramps_id
handle = p.handle
name = p.get_page()
name = p.get_name()
elif dtype == 'Event':
p = self.db.get_event_from_handle(ref[1])
if not p:

View File

@ -80,9 +80,9 @@ class CitationEmbedList(EmbeddedList, DbGUIElement):
#index = column in model. Value =
# (name, sortcol in model, width, markup/text, weigth_col
_column_names = [
(_('Title'), 0, 200, TEXT_COL, -1, None),
(_('Source Name'), 0, 200, TEXT_COL, -1, None),
(_('Author'), 1, 125, TEXT_COL, -1, None),
(_('Page'), 2, 100, TEXT_COL, -1, None),
(_('Citation Name'), 2, 140, TEXT_COL, -1, None),
(_('ID'), 3, 75, TEXT_COL, -1, None),
(_('Private'), 4, 30, ICON_COL, -1, 'gramps-lock')
]

View File

@ -41,6 +41,6 @@ class CitationRefModel(Gtk.ListStore):
for handle in citation_list:
citation = self.db.get_citation_from_handle(handle)
src = self.db.get_source_from_handle(citation.get_reference_handle())
self.append(row=[src.title, src.author, citation.page,
self.append(row=[src.get_name(), src.get_gedcom_author(), citation.get_name(),
citation.gramps_id, citation.get_privacy(),
handle, ])

View File

@ -122,8 +122,8 @@ class SrcTemplateTab(GrampsTab):
:param scrolled: GtkScrolledWindow to which to add treeview with templates
"""
templ = self.src.get_source_template()
self.temp_tv = SrcTemplateTreeView(templ[0],
templ = self.src.get_template()
self.temp_tv = SrcTemplateTreeView(templ,
sel_callback=self.on_template_selected)
scrolled.add(self.temp_tv)
@ -137,7 +137,7 @@ class SrcTemplateTab(GrampsTab):
If title of the source is what we would set with autotitle, we set
the checkbox to true. Otherwise to False
"""
srctemp = SrcTemplate(self.src.get_source_template()[0])
srctemp = SrcTemplate(self.src.get_template())
srctemp.set_attr_list(self.src.get_attribute_list())
title = srctemp.title_gedcom()
if self.src.get_title() == title:
@ -159,7 +159,7 @@ class SrcTemplateTab(GrampsTab):
"""
Selected template changed, we save this and update interface
"""
self.src.set_source_template(key)
self.src.set_template(key)
self.callback_src_changed(templatechanged=True)
#a predefined template,

View File

@ -259,14 +259,6 @@ class EditSource(EditPrimary):
self._do_close()
def _setup_fields(self):
## self.author = MonitoredEntry(self.glade.get_object("author"),
## self.obj.set_author, self.obj.get_author,
## self.db.readonly)
##
## self.pubinfo = MonitoredEntry(self.glade.get_object("pubinfo"),
## self.obj.set_publication_info,
## self.obj.get_publication_info,
## self.db.readonly)
#reference info fields of source
self.refL = self.glade.get_object("refL")
self.refF = self.glade.get_object("refF")
@ -297,7 +289,7 @@ class EditSource(EditPrimary):
self.db.readonly)
self.title = MonitoredEntry(self.glade.get_object("source_title"),
self.obj.set_title, self.obj.get_title,
self.obj.set_name, self.obj.get_name,
self.db.readonly)
#editable citation fields
@ -310,6 +302,10 @@ class EditSource(EditPrimary):
def _setup_citation_fields(self):
if self.citation_ready:
raise Exception
self.cname = MonitoredEntry(
self.glade.get_object('cname'), self.citation.set_name,
self.citation.get_name, self.db.readonly)
self.gid2 = MonitoredEntry(
self.glade.get_object('gid2'), self.citation.set_gramps_id,
self.get_citation_gramps_id, self.db.readonly)
@ -354,10 +350,10 @@ class EditSource(EditPrimary):
"""
#we only construct once the template to use to format information
if self.srctemp is None:
self.srctemp = SrcTemplate(self.obj.get_source_template()[0])
self.srctemp = SrcTemplate(self.obj.get_template())
#if source template changed, reinit template
if self.obj.get_source_template()[0] != self.srctemp.get_template_key():
self.srctemp.set_template_key(self.obj.get_source_template()[0])
if self.obj.get_template() != self.srctemp.get_template_key():
self.srctemp.set_template_key(self.obj.get_template())
#set new attrlist in template
if self.citation_loaded:
citeattr = self.citation.get_attribute_list()
@ -380,7 +376,7 @@ class EditSource(EditPrimary):
self.pubinfo.set_text(self.srctemp.pubinfo_gedcom())
if self.template_tab and self.template_tab.autoset_title:
title = self.srctemp.title_gedcom()
self.obj.set_title(title)
self.obj.set_name(title)
self.title.update()
#lastly update the window title
self.update_title(self.get_menu_title())
@ -392,7 +388,7 @@ class EditSource(EditPrimary):
"""
if templatechanged and self.tmplfields:
#the citation template fields must be changed!
self.tmplfields.reset_template_fields(self.obj.get_source_template()[0])
self.tmplfields.reset_template_fields(self.obj.get_template())
if self.attr_tab:
self.attr_tab.rebuild_callback()
self.update_attr()
@ -508,7 +504,7 @@ class EditSource(EditPrimary):
self.tmplfields = TemplateFields(self.dbstate.db, self.uistate,
self.track, self.glade.get_object('grid_citefields'),
self.obj, self.citation, None, self.callback_cite_changed)
self.tmplfields.reset_template_fields(self.obj.get_source_template()[0])
self.tmplfields.reset_template_fields(self.obj.get_template())
self.comment_tab = NoteTab(self.dbstate, self.uistate, self.track,
self.citation.get_note_list(), self.get_menu_title(),
@ -831,7 +827,7 @@ class EditSource(EditPrimary):
else:
self.citation_changed()
#the citation template fields must be changed!
self.tmplfields.reset_template_fields(self.obj.get_source_template()[0])
self.tmplfields.reset_template_fields(self.obj.get_template())
self.cinf.set_visible(True)
self.btnclose_cite.set_sensitive(True)
self.notebook_ref.set_visible(True)

View File

@ -347,10 +347,10 @@ class MyID(Gtk.Box):
name = place.get_title()
elif self.namespace == 'Source':
source = self.db.get_source_from_gramps_id(gramps_id)
name = source.get_title()
name = source.get_name()
elif self.namespace == 'Citation':
citation = self.db.get_citation_from_gramps_id(gramps_id)
name = citation.get_page()
name = citation.get_name()
elif self.namespace == 'Media':
obj = self.db.get_object_from_gramps_id(gramps_id)
name = obj.get_path()
@ -951,11 +951,11 @@ class ShowResults(ManagedWindow):
gid = event.get_gramps_id()
elif self.namespace == 'Source':
source = self.db.get_source_from_handle(handle)
name = source.get_title()
name = source.get_name()
gid = source.get_gramps_id()
elif self.namespace == 'Citation':
citation = self.db.get_citation_from_handle(handle)
name = citation.get_page()
name = citation.get_name()
gid = citation.get_gramps_id()
elif self.namespace == 'Place':
place = self.db.get_place_from_handle(handle)
@ -987,9 +987,9 @@ class ShowResults(ManagedWindow):
elif self.namespace == 'Event':
sortname = self.db.get_event_from_handle(handle).get_description()
elif self.namespace == 'Source':
sortname = self.db.get_source_from_handle(handle).get_title()
sortname = self.db.get_source_from_handle(handle).get_name()
elif self.namespace == 'Citation':
sortname = self.db.get_citation_from_handle(handle).get_page()
sortname = self.db.get_citation_from_handle(handle).get_name()
elif self.namespace == 'Place':
sortname = self.db.get_place_from_handle(handle).get_title()
elif self.namespace == 'Media':

View File

@ -136,7 +136,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@ -151,7 +151,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@ -200,7 +200,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@ -250,7 +250,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@ -265,7 +265,7 @@
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">1</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@ -309,7 +309,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="top_attach">5</property>
<property name="width">3</property>
<property name="height">1</property>
</packing>
@ -324,7 +324,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="top_attach">3</property>
<property name="width">3</property>
<property name="height">1</property>
</packing>
@ -385,11 +385,45 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="top_attach">4</property>
<property name="width">3</property>
<property name="height">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Name:</property>
<property name="mnemonic_widget">cname</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="UndoableEntry" id="cname">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Name of the citation for use inside of Gramps, for example in the list views. This fields is by default set automatically from the citation fields, but you can change it to your liking if needed.</property>
<property name="hexpand">True</property>
<property name="invisible_char">•</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
</child>
<child type="tab">
@ -494,7 +528,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Title:</property>
<property name="label" translatable="yes">_Name:</property>
<property name="use_underline">True</property>
<property name="justify">center</property>
<property name="mnemonic_widget">source_title</property>
@ -510,7 +544,7 @@
<object class="UndoableEntry" id="source_title">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Title of the source.</property>
<property name="tooltip_text" translatable="yes">Name of the source for use inside of Gramps, for example in the list views. This fields is by default set automatically from the source fields, but you can change it to your liking if needed.</property>
<property name="invisible_char">•</property>
</object>
<packing>
@ -1013,7 +1047,7 @@
</child>
<child>
<object class="GtkCheckButton" id="autotitle_checkbtn">
<property name="label" translatable="yes">Automatically set Source title from source fields</property>
<property name="label" translatable="yes">Automatically set Source name from Source fields</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>

View File

@ -19,12 +19,10 @@
<child>
<object class="GtkButton" id="citation_cancel">
<property name="label">gtk-cancel</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
@ -36,12 +34,10 @@
<child>
<object class="GtkButton" id="citation_ok">
<property name="label">gtk-ok</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
@ -53,12 +49,10 @@
<child>
<object class="GtkButton" id="citation_help">
<property name="label">gtk-help</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
@ -111,11 +105,9 @@ primary data for the merged citation.</property>
<property name="can_focus">False</property>
<child>
<object class="GtkRadioButton" id="handle_btn1">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
<child>
@ -135,11 +127,9 @@ primary data for the merged citation.</property>
</child>
<child>
<object class="GtkRadioButton" id="handle_btn2">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
<property name="group">handle_btn1</property>
@ -206,7 +196,7 @@ primary data for the merged citation.</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -222,17 +212,15 @@ primary data for the merged citation.</property>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="page_btn1">
<property name="label" translatable="yes">Volume/Page:</property>
<property name="use_action_appearance">False</property>
<object class="GtkRadioButton" id="name_btn1">
<property name="label" translatable="yes">Name:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
@ -241,21 +229,19 @@ primary data for the merged citation.</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="page_btn2">
<property name="label" translatable="yes">Volume/Page:</property>
<property name="use_action_appearance">False</property>
<object class="GtkRadioButton" id="name_btn2">
<property name="label" translatable="yes">Name:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
<property name="group">page_btn1</property>
<property name="group">name_btn1</property>
</object>
<packing>
<property name="left_attach">2</property>
@ -263,17 +249,15 @@ primary data for the merged citation.</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="date_btn1">
<property name="label" translatable="yes">Date:</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
@ -282,17 +266,15 @@ primary data for the merged citation.</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="date_btn2">
<property name="label" translatable="yes">Date:</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
@ -304,17 +286,15 @@ primary data for the merged citation.</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="confidence_btn1">
<property name="label" translatable="yes">Confidence:</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
@ -323,17 +303,15 @@ primary data for the merged citation.</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="confidence_btn2">
<property name="label" translatable="yes">Confidence:</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
@ -345,17 +323,15 @@ primary data for the merged citation.</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="gramps_btn1">
<property name="label" translatable="yes">Gramps ID:</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
@ -364,17 +340,15 @@ primary data for the merged citation.</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="gramps_btn2">
<property name="label" translatable="yes">Gramps ID:</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
@ -386,11 +360,11 @@ primary data for the merged citation.</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkEntry" id="page1">
<object class="GtkEntry" id="name1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
@ -400,11 +374,11 @@ primary data for the merged citation.</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkEntry" id="page2">
<object class="GtkEntry" id="name2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
@ -414,7 +388,7 @@ primary data for the merged citation.</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -428,7 +402,7 @@ primary data for the merged citation.</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -442,7 +416,7 @@ primary data for the merged citation.</property>
<property name="right_attach">4</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -456,7 +430,7 @@ primary data for the merged citation.</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -470,7 +444,7 @@ primary data for the merged citation.</property>
<property name="right_attach">4</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -484,7 +458,7 @@ primary data for the merged citation.</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -501,7 +475,7 @@ primary data for the merged citation.</property>
<property name="right_attach">4</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>

View File

@ -19,12 +19,10 @@
<child>
<object class="GtkButton" id="source_cancel">
<property name="label">gtk-cancel</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
@ -36,12 +34,10 @@
<child>
<object class="GtkButton" id="source_ok">
<property name="label">gtk-ok</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
@ -53,12 +49,10 @@
<child>
<object class="GtkButton" id="source_help">
<property name="label">gtk-help</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
@ -111,11 +105,9 @@ primary data for the merged source.</property>
<property name="can_focus">False</property>
<child>
<object class="GtkRadioButton" id="handle_btn1">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
<child>
@ -135,11 +127,9 @@ primary data for the merged source.</property>
</child>
<child>
<object class="GtkRadioButton" id="handle_btn2">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
<property name="group">handle_btn1</property>
@ -194,7 +184,7 @@ primary data for the merged source.</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -210,17 +200,15 @@ primary data for the merged source.</property>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="title_btn1">
<property name="label" translatable="yes">Title:</property>
<property name="use_action_appearance">False</property>
<property name="label" translatable="yes">Name:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
@ -229,17 +217,15 @@ primary data for the merged source.</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="title_btn2">
<property name="label" translatable="yes">Title:</property>
<property name="use_action_appearance">False</property>
<property name="label" translatable="yes">Name:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
@ -251,40 +237,36 @@ primary data for the merged source.</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="author_btn1">
<property name="label" translatable="yes">Author:</property>
<property name="use_action_appearance">False</property>
<object class="GtkRadioButton" id="template_btn1">
<property name="label" translatable="yes">Template:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="author_btn2">
<property name="label" translatable="yes">Author:</property>
<property name="use_action_appearance">False</property>
<object class="GtkRadioButton" id="template_btn2">
<property name="label" translatable="yes">Template:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
<property name="group">author_btn1</property>
<property name="group">template_btn1</property>
</object>
<packing>
<property name="left_attach">2</property>
@ -292,17 +274,15 @@ primary data for the merged source.</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="abbrev_btn1">
<property name="label" translatable="yes">Abbreviation:</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
@ -311,17 +291,15 @@ primary data for the merged source.</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="abbrev_btn2">
<property name="label" translatable="yes">Abbreviation:</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
@ -333,77 +311,32 @@ primary data for the merged source.</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="pub_btn1">
<property name="label" translatable="yes">Publication:</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="pub_btn2">
<property name="label" translatable="yes">Publication:</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
<property name="group">pub_btn1</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="gramps_btn1">
<property name="label" translatable="yes">Gramps ID:</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="gramps_btn2">
<property name="label" translatable="yes">Gramps ID:</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
@ -412,10 +345,10 @@ primary data for the merged source.</property>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -429,7 +362,7 @@ primary data for the merged source.</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -443,11 +376,11 @@ primary data for the merged source.</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkEntry" id="author1">
<object class="GtkEntry" id="template1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
@ -457,11 +390,11 @@ primary data for the merged source.</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkEntry" id="author2">
<object class="GtkEntry" id="template2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
@ -471,7 +404,7 @@ primary data for the merged source.</property>
<property name="right_attach">4</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -485,7 +418,7 @@ primary data for the merged source.</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -499,35 +432,7 @@ primary data for the merged source.</property>
<property name="right_attach">4</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkEntry" id="pub1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkEntry" id="pub2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -539,9 +444,9 @@ primary data for the merged source.</property>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="y_options"></property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -556,14 +461,26 @@ primary data for the merged source.</property>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="y_options"></property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"/>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>

View File

@ -71,14 +71,14 @@ class MergeCitation(ManagedWindow):
_("Merge Citations"))
# Detailed Selection widgets
page1 = self.citation1.get_page()
page2 = self.citation2.get_page()
entry1 = self.get_widget("page1")
entry2 = self.get_widget("page2")
entry1.set_text(page1)
entry2.set_text(page2)
name1 = self.citation1.get_name()
name2 = self.citation2.get_name()
entry1 = self.get_widget("name1")
entry2 = self.get_widget("name2")
entry1.set_text(name1)
entry2.set_text(name2)
if entry1.get_text() == entry2.get_text():
for widget_name in ('page1', 'page2', 'page_btn1', 'page_btn2'):
for widget_name in ('name1', 'name2', 'name_btn1', 'name_btn2'):
self.get_widget(widget_name).set_sensitive(False)
entry1 = self.get_widget("date1")
@ -126,12 +126,12 @@ class MergeCitation(ManagedWindow):
def on_handle1_toggled(self, obj):
"""first chosen citation changes"""
if obj.get_active():
self.get_widget("page_btn1").set_active(True)
self.get_widget("name_btn1").set_active(True)
self.get_widget("date_btn1").set_active(True)
self.get_widget("confidence_btn1").set_active(True)
self.get_widget("gramps_btn1").set_active(True)
else:
self.get_widget("page_btn2").set_active(True)
self.get_widget("name_btn2").set_active(True)
self.get_widget("date_btn2").set_active(True)
self.get_widget("confidence_btn2").set_active(True)
self.get_widget("gramps_btn2").set_active(True)
@ -157,8 +157,8 @@ class MergeCitation(ManagedWindow):
self.uistate.viewmanager.active_page.get_history().push(
phoenix.get_handle())
if self.get_widget("page_btn1").get_active() ^ use_handle1:
phoenix.set_page(titanic.get_page())
if self.get_widget("name_btn1").get_active() ^ use_handle1:
phoenix.set_name(titanic.get_name())
if self.get_widget("date_btn1").get_active() ^ use_handle1:
phoenix.set_date_object(titanic.get_date_object())
if self.get_widget("confidence_btn1").get_active() ^ use_handle1:

View File

@ -70,8 +70,8 @@ class MergeSource(ManagedWindow):
_("Merge Sources"))
# Detailed Selection widgets
title1 = self.src1.get_title()
title2 = self.src2.get_title()
title1 = self.src1.get_name()
title2 = self.src2.get_name()
entry1 = self.get_widget("title1")
entry2 = self.get_widget("title2")
entry1.set_text(title1)
@ -80,13 +80,13 @@ class MergeSource(ManagedWindow):
for widget_name in ('title1', 'title2', 'title_btn1', 'title_btn2'):
self.get_widget(widget_name).set_sensitive(False)
entry1 = self.get_widget("author1")
entry2 = self.get_widget("author2")
entry1.set_text(self.src1.get_author())
entry2.set_text(self.src2.get_author())
entry1 = self.get_widget("template1")
entry2 = self.get_widget("template2")
entry1.set_text(self.src1.get_template())
entry2.set_text(self.src2.get_template())
if entry1.get_text() == entry2.get_text():
for widget_name in ('author1', 'author2', 'author_btn1',
'author_btn2'):
for widget_name in ('template1', 'template2', 'template_btn1',
'template_btn2'):
self.get_widget(widget_name).set_sensitive(False)
entry1 = self.get_widget("abbrev1")
@ -98,14 +98,6 @@ class MergeSource(ManagedWindow):
'abbrev_btn2'):
self.get_widget(widget_name).set_sensitive(False)
entry1 = self.get_widget("pub1")
entry2 = self.get_widget("pub2")
entry1.set_text(self.src1.get_publication_info())
entry2.set_text(self.src2.get_publication_info())
if entry1.get_text() == entry2.get_text():
for widget_name in ('pub1', 'pub2', 'pub_btn1', 'pub_btn2'):
self.get_widget(widget_name).set_sensitive(False)
gramps1 = self.src1.get_gramps_id()
gramps2 = self.src2.get_gramps_id()
entry1 = self.get_widget("gramps1")
@ -134,15 +126,13 @@ class MergeSource(ManagedWindow):
"""first chosen source changes"""
if obj.get_active():
self.get_widget("title_btn1").set_active(True)
self.get_widget("author_btn1").set_active(True)
self.get_widget("template_btn1").set_active(True)
self.get_widget("abbrev_btn1").set_active(True)
self.get_widget("pub_btn1").set_active(True)
self.get_widget("gramps_btn1").set_active(True)
else:
self.get_widget("title_btn2").set_active(True)
self.get_widget("author_btn2").set_active(True)
self.get_widget("template_btn2").set_active(True)
self.get_widget("abbrev_btn2").set_active(True)
self.get_widget("pub_btn2").set_active(True)
self.get_widget("gramps_btn2").set_active(True)
def cb_help(self, obj):
@ -167,13 +157,11 @@ class MergeSource(ManagedWindow):
phoenix.get_handle())
if self.get_widget("title_btn1").get_active() ^ use_handle1:
phoenix.set_title(titanic.get_title())
if self.get_widget("author_btn1").get_active() ^ use_handle1:
phoenix.set_author(titanic.get_author())
phoenix.set_name(titanic.get_name())
if self.get_widget("template_btn1").get_active() ^ use_handle1:
phoenix.set_template(titanic.get_template())
if self.get_widget("abbrev_btn1").get_active() ^ use_handle1:
phoenix.set_abbreviation(titanic.get_abbreviation())
if self.get_widget("pub_btn1").get_active() ^ use_handle1:
phoenix.set_publication_info(titanic.get_publication_info())
if self.get_widget("gramps_btn1").get_active() ^ use_handle1:
phoenix.set_gramps_id(titanic.get_gramps_id())

View File

@ -56,7 +56,7 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale
COLUMN_HANDLE = 0
COLUMN_ID = 1
COLUMN_DATE = 2
COLUMN_PAGE = 3
COLUMN_NAME = 3
COLUMN_CONFIDENCE = 4
COLUMN_SOURCE = 5
COLUMN_CHANGE = 9
@ -66,13 +66,12 @@ COLUMN_PRIV = 11
# Data for the Source object
COLUMN2_HANDLE = 0
COLUMN2_ID = 1
COLUMN2_TITLE = 2
COLUMN2_AUTHOR = 3
COLUMN2_PUBINFO = 4
COLUMN2_ABBREV = 7
COLUMN2_CHANGE = 8
COLUMN2_TAGS = 11
COLUMN2_PRIV = 12
COLUMN2_NAME = 2
COLUMN2_TEMPLATE = 3
COLUMN2_ABBREV = 6
COLUMN2_CHANGE = 7
COLUMN2_TAGS = 10
COLUMN2_PRIV = 11
INVALID_DATE_FORMAT = config.get('preferences.invalid-date-format')
@ -112,8 +111,8 @@ class CitationBaseModel(object):
def citation_id(self, data):
return cuni(data[COLUMN_ID])
def citation_page(self, data):
return cuni(data[COLUMN_PAGE])
def citation_name(self, data):
return cuni(data[COLUMN_NAME])
def citation_confidence(self, data):
return cuni(confidence[data[COLUMN_CONFIDENCE]])
@ -160,7 +159,15 @@ class CitationBaseModel(object):
source_handle = data[COLUMN_SOURCE]
try:
source = self.db.get_source_from_handle(source_handle)
return cuni(source.get_title())
return cuni(source.get_name())
except:
return ''
def citation_src_template(self, data):
source_handle = data[COLUMN_SOURCE]
try:
source = self.db.get_source_from_handle(source_handle)
return cuni(source.get_template())
except:
return ''
@ -173,10 +180,11 @@ class CitationBaseModel(object):
return ''
def citation_src_auth(self, data):
return ''
source_handle = data[COLUMN_SOURCE]
try:
source = self.db.get_source_from_handle(source_handle)
return cuni(source.get_author())
return cuni(source.get_gedcom_author())
except:
return ''
@ -189,10 +197,11 @@ class CitationBaseModel(object):
return ''
def citation_src_pinfo(self, data):
return ''
source_handle = data[COLUMN_SOURCE]
try:
source = self.db.get_source_from_handle(source_handle)
return cuni(source.get_publication_info())
return cuni(source.get_gedcom_publication_info())
except:
return ''
@ -228,19 +237,24 @@ class CitationBaseModel(object):
# Fields access when 'data' is a Source
def source_src_title(self, data):
return cuni(data[COLUMN2_TITLE])
return cuni(data[COLUMN2_NAME])
def source_src_template(self, data):
return cuni(data[COLUMN2_TEMPLATE])
def source_src_id(self, data):
return cuni(data[COLUMN2_ID])
def source_src_auth(self, data):
return cuni(data[COLUMN2_AUTHOR])
source = self.db.get_source_from_handle(data[COLUMN2_HANDLE])
return cuni(source.get_gedcom_author())
def source_src_abbr(self, data):
return cuni(data[COLUMN2_ABBREV])
def source_src_pinfo(self, data):
return cuni(data[COLUMN2_PUBINFO])
source = self.db.get_source_from_handle(data[COLUMN2_HANDLE])
return cuni(source.get_gedcom_publication_info())
def source_src_private(self, data):
if data[COLUMN2_PRIV]:

View File

@ -62,7 +62,7 @@ class CitationListModel(CitationBaseModel, FlatBaseModel):
self.map = db.get_raw_citation_data
self.gen_cursor = db.get_citation_cursor
self.fmap = [
self.citation_page,
self.citation_name,
self.citation_id,
self.citation_date,
self.citation_confidence,
@ -71,15 +71,15 @@ class CitationListModel(CitationBaseModel, FlatBaseModel):
self.citation_change,
self.citation_src_title,
self.citation_src_id,
self.citation_src_auth,
#self.citation_src_auth,
self.citation_src_abbr,
self.citation_src_pinfo,
#self.citation_src_pinfo,
self.citation_src_private,
self.citation_src_chan,
self.citation_tag_color
]
self.smap = [
self.citation_page,
self.citation_name,
self.citation_id,
self.citation_sort_date,
self.citation_confidence,
@ -88,9 +88,9 @@ class CitationListModel(CitationBaseModel, FlatBaseModel):
self.citation_sort_change,
self.citation_src_title,
self.citation_src_id,
self.citation_src_auth,
#self.citation_src_auth,
self.citation_src_abbr,
self.citation_src_pinfo,
#self.citation_src_pinfo,
self.citation_src_private,
self.citation_src_chan,
self.citation_tag_color
@ -113,7 +113,7 @@ class CitationListModel(CitationBaseModel, FlatBaseModel):
"""
Return the color column.
"""
return 14
return 12
def on_get_n_columns(self):
return len(self.fmap)+1

View File

@ -82,6 +82,7 @@ class CitationTreeModel(CitationBaseModel, TreeBaseModel):
self.source_src_private, # COL_PRIV (both Source & Citation)
self.source_src_tags, # COL_TAGS (both Source & Citation)
self.source_src_chan, # COL_CHAN (both Source & Citation)
self.source_src_template,# COL_TEMPLATE (Source only)
self.source_src_auth, # COL_SRC_AUTH (Source only)
self.source_src_abbr, # COL_SRC_ABBR (Source only)
self.source_src_pinfo, # COL_SRC_PINFO (Source only)
@ -95,6 +96,7 @@ class CitationTreeModel(CitationBaseModel, TreeBaseModel):
self.source_src_private,
self.source_src_tags,
self.source_sort2_change,
self.source_src_template,
self.source_src_auth,
self.source_src_abbr,
self.source_src_pinfo,
@ -132,7 +134,7 @@ class CitationTreeModel(CitationBaseModel, TreeBaseModel):
self.map2 = self.db.get_raw_citation_data
self.gen_cursor2 = self.db.get_citation_cursor
self.fmap2 = [
self.citation_page,
self.citation_name,
self.citation_id,
self.citation_date,
self.citation_confidence,
@ -142,10 +144,11 @@ class CitationTreeModel(CitationBaseModel, TreeBaseModel):
None,
None,
None,
None,
self.citation_tag_color
]
self.smap2 = [
self.citation_page,
self.citation_name,
self.citation_id,
self.citation_sort_date,
self.citation_confidence,
@ -155,6 +158,7 @@ class CitationTreeModel(CitationBaseModel, TreeBaseModel):
self.dummy_sort_key,
self.dummy_sort_key,
self.dummy_sort_key,
self.dummy_sort_key,
self.citation_tag_color
]
@ -162,7 +166,7 @@ class CitationTreeModel(CitationBaseModel, TreeBaseModel):
"""
Return the color column.
"""
return 10
return 11
def get_tree_levels(self):
"""

View File

@ -44,6 +44,16 @@ from gramps.gen.constfunc import cuni
from .flatbasemodel import FlatBaseModel
from gramps.gen.const import GRAMPS_LOCALE as glocale
COLUMN_HANDLE = 0
COLUMN_ID = 1
COLUMN_NAME = 2
COLUMN_TEMPLATE = 3
COLUMN_ABBREV = 6
COLUMN_CHANGE = 7
COLUMN_TAGS = 10
COLUMN_PRIV = 11
#-------------------------------------------------------------------------
#
# SourceModel
@ -56,22 +66,24 @@ class SourceModel(FlatBaseModel):
self.map = db.get_raw_source_data
self.gen_cursor = db.get_source_cursor
self.fmap = [
self.column_title,
self.column_name,
self.column_id,
self.column_author,
self.column_abbrev,
self.column_pubinfo,
self.column_template,
self.column_private,
self.column_tags,
self.column_change,
self.column_tag_color
]
self.smap = [
self.column_title,
self.column_name,
self.column_id,
self.column_author,
self.column_abbrev,
self.column_pubinfo,
self.column_template,
self.column_private,
self.column_tags,
self.sort_change,
@ -95,38 +107,43 @@ class SourceModel(FlatBaseModel):
"""
Return the color column.
"""
return 8
return 9
def on_get_n_columns(self):
return len(self.fmap)+1
def column_title(self,data):
return cuni(data[2])
def column_name(self, data):
return cuni(data[COLUMN_NAME])
def column_author(self,data):
return cuni(data[3])
def column_author(self, data):
source = self.db.get_source_from_handle(data[COLUMN_HANDLE])
return cuni(source.get_gedcom_author())
def column_abbrev(self,data):
return cuni(data[7])
def column_template(self, data):
return cuni(data[COLUMN_TEMPLATE])
def column_id(self,data):
return cuni(data[1])
def column_abbrev(self, data):
return cuni(data[COLUMN_ABBREV])
def column_pubinfo(self,data):
return cuni(data[4])
def column_id(self, data):
return cuni(data[COLUMN_ID])
def column_pubinfo(self, data):
source = self.db.get_source_from_handle(data[COLUMN_HANDLE])
return cuni(source.get_gedcom_publication_info())
def column_private(self, data):
if data[12]:
if data[COLUMN_PRIV]:
return 'gramps-lock'
else:
# There is a problem returning None here.
return ''
def column_change(self,data):
return format_time(data[8])
return format_time(data[COLUMN_CHANGE])
def sort_change(self,data):
return "%012x" % data[8]
return "%012x" % data[COLUMN_CHANGE]
def get_tag_name(self, tag_handle):
"""
@ -140,7 +157,7 @@ class SourceModel(FlatBaseModel):
"""
tag_color = "#000000000000"
tag_priority = None
for handle in data[11]:
for handle in data[COLUMN_TAGS]:
tag = self.db.get_tag_from_handle(handle)
if tag:
this_priority = tag.get_priority()
@ -153,5 +170,5 @@ class SourceModel(FlatBaseModel):
"""
Return the sorted list of tags.
"""
tag_list = list(map(self.get_tag_name, data[11]))
tag_list = list(map(self.get_tag_name, data[COLUMN_TAGS]))
return ', '.join(sorted(tag_list, key=glocale.sort_key))

View File

@ -102,7 +102,7 @@ def get_primary_source_title(db, obj):
citation = db.get_citation_from_handle(citation_handle)
source = db.get_source_from_handle(citation.get_reference_handle())
if source:
return source.get_title()
return source.get_name()
return ""
#-------------------------------------------------------------------------

View File

@ -909,14 +909,17 @@ class GedcomWriter(UpdateCallback):
source = self.dbase.get_source_from_handle(handle)
if source is None: continue
self._writeln(0, '@%s@' % source_id, 'SOUR')
if source.get_title():
self._writeln(1, 'TITL', source.get_title())
stitle = source.get_gedcom_title()
if stitle:
self._writeln(1, 'TITL', stitle)
if source.get_author():
self._writeln(1, "AUTH", source.get_author())
sauth = source.get_gedcom_author()
if sauth:
self._writeln(1, "AUTH", sauth)
if source.get_publication_info():
self._writeln(1, "PUBL", source.get_publication_info())
spubi = source.get_gedcom_publication_info()
if spubi:
self._writeln(1, "PUBL", spubi)
if source.get_abbreviation():
self._writeln(1, 'ABBR', source.get_abbreviation())
@ -1267,11 +1270,12 @@ class GedcomWriter(UpdateCallback):
# Reference to the source
self._writeln(level, "SOUR", "@%s@" % src.get_gramps_id())
if citation.get_page() != "":
gedcom_page = citation.get_gedcom_page(src.get_template())
if gedcom_page != "":
# PAGE <WHERE_WITHIN_SOURCE> can not have CONC lines.
# WHERE_WITHIN_SOURCE:= {Size=1:248}
# Maximize line to 248 and set limit to 248, for no line split
self._writeln(level+1, 'PAGE', citation.get_page()[0:248],
self._writeln(level+1, 'PAGE', gedcom_page[0:248],
limit=248)

View File

@ -178,7 +178,7 @@ class GeneWebWriter(object):
)
)
def write_sources(self,reflist):
def write_sources(self, reflist):
# FIXME
#if self.restrict and self.exclnotes:
# return
@ -190,7 +190,7 @@ class GeneWebWriter(object):
source = self.db.get_source_from_handle(src_handle)
if source:
self.writeln( "src %s" %
(self.rem_spaces(source.get_title()))
(self.rem_spaces(source.get_name()))
)
def write_children(self,family, father):
@ -422,7 +422,7 @@ class GeneWebWriter(object):
return ret
def get_primary_source(self,reflist):
def get_primary_source(self, reflist):
ret = ""
if reflist:
for handle in reflist:
@ -432,7 +432,7 @@ class GeneWebWriter(object):
if source:
if ret != "":
ret = ret + ", "
ret = ret + source.get_title()
ret = ret + source.get_name()
return ret
def format_single_date(self, subdate, cal, mode):

View File

@ -579,7 +579,7 @@ class GrampsXmlWriter(UpdateCallback):
sp = " " * index
self.write_primary_tag("citation", citation, index)
self.write_date(citation.get_date_object(), index+1)
self.write_line("page", citation.get_page(), index+1)
self.write_line("cname", citation.get_name(), index+1)
self.write_line("confidence", citation.get_confidence_level(), index+1)
self.write_note_list(citation.get_note_list(), index+1)
self.write_media_list(citation.get_media_list(), index+1)
@ -594,9 +594,8 @@ class GrampsXmlWriter(UpdateCallback):
def write_source(self, source, index=1):
sp = " "*index
self.write_primary_tag("source", source, index)
self.write_force_line("stitle", source.get_title(), index+1)
self.write_line("sauthor", source.get_author(), index+1)
self.write_line("spubinfo", source.get_publication_info(), index+1)
self.write_force_line("sname", source.get_name(), index+1)
self.write_line("stemplate", source.get_template(), index+1)
self.write_line("sabbrev", source.get_abbreviation(), index+1)
self.write_note_list(source.get_note_list(), index+1)
self.write_media_list(source.get_media_list(), index+1)

View File

@ -50,7 +50,9 @@ LOG = logging.getLogger(".ImportCSV")
#-------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext
from gramps.gen.lib import ChildRef, Citation, Event, EventRef, EventType, Family, FamilyRelType, Name, NameType, Note, NoteType, Person, Place, Source, Surname, Tag
from gramps.gen.lib import (ChildRef, Citation, Event, EventRef, EventType,
Family, FamilyRelType, Name, NameType, Note, NoteType, Person, Place,
Source, Surname, SrcAttribute, SrcAttributeType, Tag)
from gramps.gen.db import DbTxn
from gramps.gen.plug.utils import OpenFileOrStdin
from gramps.gen.datehandler import parser as _dp
@ -829,12 +831,16 @@ class CSVParser(object):
LOG.debug("get_or_create_source: looking for: %s", source_text)
for source_handle in source_list:
source = self.db.get_source_from_handle(source_handle)
if source.get_title() == source_text:
if source.get_name() == source_text:
LOG.debug(" returning existing source")
return (0, source)
LOG.debug(" creating source")
source = Source()
source.set_title(source_text)
source.set_name(source_text)
sattr = SrcAttribute()
sattr.set_type(SrcAttributeType.TITLE)
sattr.set_value(source_text)
source.add_attribute(sattr)
self.db.add_source(source, self.trans)
return (1, source)

View File

@ -50,7 +50,10 @@ LOG = logging.getLogger(".ImportGeneWeb")
#
#-------------------------------------------------------------------------
from gramps.gen.errors import GedcomError
from gramps.gen.lib import Attribute, AttributeType, ChildRef, Citation, Date, Event, EventRef, EventRoleType, EventType, Family, FamilyRelType, Name, NameType, Note, Person, PersonRef, Place, Source
from gramps.gen.lib import (Attribute, AttributeType, ChildRef, Citation, Date,
Event, EventRef, EventRoleType, EventType, Family, FamilyRelType,
Name, NameType, Note, Person, PersonRef, Place, Source,
SrcAttribute, SrcAttributeType)
from gramps.gen.db import DbTxn
from gramps.gen.constfunc import STRTYPE, cuni, conv_to_unicode
if sys.version_info[0] < 3:
@ -876,9 +879,13 @@ class GeneWebParser(object):
source = self.db.get_source_from_handle(self.skeys[source_name])
else:
source = Source()
source.set_title(source_name)
self.db.add_source(source,self.trans)
self.db.commit_source(source,self.trans)
source.set_name(source_name)
sattr = SrcAttribute()
sattr.set_type(SrcAttributeType.TITLE)
sattr.set_value(source_name)
source.add_attribute(sattr)
self.db.add_source(source, self.trans)
self.db.commit_source(source, self.trans)
self.skeys[source_name] = source.get_handle()
citation = Citation()
citation.set_reference_handle(source.get_handle())

View File

@ -55,7 +55,8 @@ from gramps.gui.utils import ProgressMeter
from gramps.gen.lib import (Attribute, AttributeType, ChildRef, Date, Event,
EventRef, EventType, Family, FamilyRelType, Name,
NameType, Note, NoteType, Person, Place, Source,
Surname, Citation, Location, NameOriginType)
Surname, Citation, Location, NameOriginType,
SrcAttribute, SrcAttributeType)
from gramps.gen.db import DbTxn
class ProgenError(Exception):
@ -611,7 +612,11 @@ class ProgenParser(object):
else:
# Create a new Source
source = Source()
source.set_title(source_name)
source.set_name(source_name)
sattr = SrcAttribute()
sattr.set_type(SrcAttributeType.TITLE)
sattr.set_value(source_name)
source.add_attribute(sattr)
self.db.add_source(source, self.trans)
self.db.commit_source(source, self.trans)
self.skeys[source_name] = source.get_handle()

View File

@ -625,7 +625,7 @@ class GrampsParser(UpdateCallback):
"attribute": (self.start_attribute, self.stop_attribute),
"attr_type": (None, self.stop_attr_type),
"attr_value": (None, self.stop_attr_value),
"srcattribute": (self.start_srcattribute, self.stop_srcattribute),
"srcattribute": (self.start_srcattribute, self.stop_srcattribute), #new in 1.6.0
"bookmark": (self.start_bmark, None),
"bookmarks": (None, None),
"format": (self.start_format, None),
@ -673,7 +673,8 @@ class GrampsParser(UpdateCallback):
"objref": (self.start_objref, self.stop_objref),
"object": (self.start_object, self.stop_object),
"file": (self.start_file, None),
"page": (None, self.stop_page),
"page": (None, self.stop_page), #deprecated in 1.6.0
"cname": (None, self.stop_cname),
"place": (self.start_place, self.stop_place),
"dateval": (self.start_dateval, None),
"daterange": (self.start_daterange, None),
@ -701,17 +702,19 @@ class GrampsParser(UpdateCallback):
"respostal": (None, self.stop_respostal),
"resphone": (None, self.stop_resphone),
"resemail": (None, self.stop_resemail),
"sauthor": (None, self.stop_sauthor),
"sauthor": (None, self.stop_sauthor), #deprecated in 1.6.0
"sabbrev": (None, self.stop_sabbrev),
"scomments": (None, self.stop_scomments),
"source": (self.start_source, self.stop_source),
"sourceref": (self.start_sourceref, self.stop_sourceref),
"sources": (None, None),
"spage": (None, self.stop_spage),
"spubinfo": (None, self.stop_spubinfo),
"spage": (None, self.stop_spage), #deprecated
"spubinfo": (None, self.stop_spubinfo), #deprecated in 1.6.0
"state": (None, self.stop_state),
"stext": (None, self.stop_stext),
"stitle": (None, self.stop_stitle),
"stitle": (None, self.stop_stitle), #deprecated in 1.6.0
"sname": (None, self.stop_sname), #new in 1.6.0
"stemplate": (None, self.stop_stemplate), #new in 1.6.0
"street": (None, self.stop_street),
"style": (self.start_style, None),
"tag": (self.start_tag, self.stop_tag),
@ -2725,8 +2728,22 @@ class GrampsParser(UpdateCallback):
else:
self.person.set_gender (Person.UNKNOWN)
def stop_sname(self, tag):
#store descriptive name of the source
self.source.name = tag
def stop_stemplate(self, tag):
#store template of the source
self.source.template = tag
def stop_stitle(self, tag):
self.source.title = tag
#title was deprecated and converted to name and attribute TITLE in 1.6.0
if not self.source.name:
self.source.name = tag
sattr = SrcAttribute()
sattr.set_type(SrcAttributeType.TITLE)
sattr.set_value(tag)
self.source.add_attribute(sattr)
def stop_sourceref(self, *tag):
# if we are in an old style sourceref we need to commit the citation
@ -2747,7 +2764,11 @@ class GrampsParser(UpdateCallback):
self.citation = None
def stop_sauthor(self, tag):
self.source.author = tag
#author was deprecated and converted to attribute AUTHOR in 1.6.0
sattr = SrcAttribute()
sattr.set_type(SrcAttributeType.AUTHOR)
sattr.set_value(tag)
self.source.add_attribute(sattr)
def stop_phone(self, tag):
self.address.phone = tag
@ -2775,11 +2796,25 @@ class GrampsParser(UpdateCallback):
def stop_spage(self, tag):
# Valid for version <= 1.4.0
self.citation.set_page(tag)
if not self.citation.name:
self.citation.set_name(tag)
sattr = SrcAttribute()
sattr.set_type(SrcAttributeType.PAGE)
sattr.set_value(tag)
self.citation.add_attribute(sattr)
def stop_cname(self, tag):
self.citation.set_name(tag)
def stop_page(self, tag):
# Valid for version >= 1.5.0
self.citation.set_page(tag)
# page was deprecated and converted to name and attribute PAGE in 1.6.0
if not self.citation.name:
self.citation.set_name(tag)
sattr = SrcAttribute()
sattr.set_type(SrcAttributeType.PAGE)
sattr.set_value(tag)
self.citation.add_attribute(sattr)
def stop_confidence(self, tag):
# Valid for version >= 1.5.0
@ -2789,7 +2824,11 @@ class GrampsParser(UpdateCallback):
self.ord = None
def stop_spubinfo(self, tag):
self.source.set_publication_info(tag)
#pubinfo was deprecated and converted to attribute PUB_INFO in 1.6.0
sattr = SrcAttribute()
sattr.set_type(SrcAttributeType.PUB_INFO)
sattr.set_value(tag)
self.source.add_attribute(sattr)
def stop_sabbrev(self, tag):
self.source.set_abbreviation(tag)

View File

@ -1852,7 +1852,12 @@ class GedcomParser(UpdateCallback):
if self.use_def_src:
self.def_src = Source()
fname = os.path.basename(filename).split('\\')[-1]
self.def_src.set_title(_("Import from GEDCOM (%s)") % fname)
stitle = _("Import from GEDCOM (%s)") % fname
self.def_src.set_name(stitle)
sattr = SrcAttribute()
sattr.set_type(SrcAttributeType.TITLE)
sattr.set_value(stitle)
self.def_src.add_attribute(sattr)
if default_tag_format:
name = time.strftime(default_tag_format)
tag = self.dbase.get_tag_from_name(name)
@ -2664,7 +2669,11 @@ class GedcomParser(UpdateCallback):
for title, handle in self.inline_srcs.items():
src = Source()
src.set_handle(handle)
src.set_title(title)
src.set_name(title)
sattr = SrcAttribute()
sattr.set_type(SrcAttributeType.TITLE)
sattr.set_value(title)
src.add_attribute(sattr)
self.dbase.add_source(src, self.trans)
self.__clean_up()
@ -3380,7 +3389,11 @@ class GedcomParser(UpdateCallback):
# A source formatted in a single line, for example:
# 0 @S62@ SOUR This is the title of the source
source = self.__find_or_create_source(self.sid_map[line.data])
source.set_title(line.data[5:])
sattr = SrcAttribute()
sattr.set_type(SrcAttributeType.TITLE)
sattr.set_value(line.data[5:])
source.add_attribute(sattr)
source.set_name(line.data[5:])
self.dbase.commit_source(source, self.trans)
elif key[0:4] == "NOTE":
try:
@ -5865,7 +5878,12 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
state.citation.set_page(line.data)
page = line.data
sattr = SrcAttribute()
sattr.set_type(SrcAttributeType.PAGE)
sattr.set_value(page)
state.citation.add_attribute(sattr)
state.citation.set_name(page)
def __citation_date(self, line, state):
"""
@ -6052,7 +6070,7 @@ class GedcomParser(UpdateCallback):
state = CurrentState()
state.source = self.__find_or_create_source(self.sid_map[name])
# SOURce with the given gramps_id had no title
state.source.set_title(_("No title - ID %s") %
state.source.set_name(_("No title - ID %s") %
state.source.get_gramps_id())
state.level = level
@ -6247,7 +6265,10 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
state.source.set_author(line.data)
sattr = SrcAttribute()
sattr.set_type(SrcAttributeType.AUTHOR)
sattr.set_value(line.data)
state.source.add_attribute(sattr)
def __source_publ(self, line, state):
"""
@ -6256,7 +6277,10 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
state.source.set_publication_info(line.data)
sattr = SrcAttribute()
sattr.set_type(SrcAttributeType.PUB_INFO)
sattr.set_value(line.data)
state.source.add_attribute(sattr)
self.__skip_subordinate_levels(state.level+1, state)
def __source_title(self, line, state):
@ -6266,7 +6290,12 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
state.source.set_title(line.data.replace('\n', ' '))
title = line.data.replace('\n', ' ')
state.source.set_name(title)
sattr = SrcAttribute()
sattr.set_type(SrcAttributeType.TITLE)
sattr.set_value(title)
state.source.add_attribute(sattr)
def __source_taxt_peri(self, line, state):
"""
@ -6275,8 +6304,13 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
if state.source.get_title() == "":
state.source.set_title(line.data.replace('\n', ' '))
if state.source.get_gedcom_title() == "":
title = line.data.replace('\n', ' ')
sattr = SrcAttribute()
sattr.set_type(SrcAttributeType.TITLE)
sattr.set_value(title)
src.add_attribute(sattr)
state.source.set_name(title)
#----------------------------------------------------------------------
#
@ -6873,7 +6907,12 @@ class GedcomParser(UpdateCallback):
if self.use_def_src:
filename = os.path.basename(line.data).split('\\')[-1]
# feature request 2356: avoid genitive form
self.def_src.set_title(_("Import from %s") % filename)
title = _("Import from %s") % filename
sattr = SrcAttribute()
sattr.set_type(SrcAttributeType.TITLE)
sattr.set_value(title)
src.add_attribute(sattr)
self.def_src.set_name(title)
def __header_copr(self, line, state):
"""
@ -6883,7 +6922,10 @@ class GedcomParser(UpdateCallback):
@type state: CurrentState
"""
if self.use_def_src:
self.def_src.set_publication_info(line.data)
sattr = SrcAttribute()
sattr.set_type(SrcAttributeType.PUB_INFO)
sattr.set_value(line.data)
self.def_src.add_attribute(sattr)
def __header_subm(self, line, state):
"""
@ -7088,7 +7130,10 @@ class GedcomParser(UpdateCallback):
@type state: CurrentState
"""
if self.use_def_src:
self.def_src.set_author(line.data)
sattr = SrcAttribute()
sattr.set_type(SrcAttributeType.AUTHOR)
sattr.set_value(line.data)
self.def_src.add_attribute(sattr)
def __parse_note(self, line, obj, level, state):
if line.token == TOKEN_RNOTE:
@ -7245,13 +7290,13 @@ class GedcomParser(UpdateCallback):
self.inline_srcs[title] = handle
else:
src = self.__find_or_create_source(self.sid_map[line.data])
# We need to set the title to the cross reference identifier of the
# We need to set the name to the cross reference identifier of the
# SOURce record, just in case we never find the source record. If we
# din't find the source record, then the source object would have
# got deleted by Chack and repair because the record is empty. If we
# got deleted by Check and repair because the record is empty. If we
# find the source record, the title is overwritten in
# __source_title.
src.set_title(line.data)
src.set_name(line.data)
self.dbase.commit_source(src, self.trans)
self.__parse_source_reference(citation, level, src.handle, state)
citation.set_reference_handle(src.handle)

View File

@ -75,7 +75,7 @@ IGNORE_CONFIDENCE = 2
IGNORE_BOTH = 3
_val2label = {
ALL_FIELDS : _("Match on Page/Volume, Date and Confidence"),
ALL_FIELDS : _("Match on Citation Name, Date and Confidence"),
IGNORE_DATE : _("Ignore Date"),
IGNORE_CONFIDENCE : _("Ignore Confidence"),
IGNORE_BOTH : _("Ignore Date and Confidence")
@ -198,7 +198,7 @@ class MergeCitations(tool.BatchTool,ManagedWindow):
"that has a citation reference." % class_name)
citation = db.get_citation_from_handle(citation_handle)
key = citation.get_page()
key = citation.get_name()
if fields != IGNORE_DATE and fields != IGNORE_BOTH:
key += "\n" + get_date(citation)
if fields != IGNORE_CONFIDENCE and fields != IGNORE_BOTH:
@ -297,10 +297,10 @@ class MergeCitationsOptions(tool.ToolOptions):
}
self.options_help = {
'dont_merge_notes' :
("=0/1","Whether to merge citations if they have notes",
("=0/1", "Whether to merge citations if they have notes",
["Merge citations with notes",
"Do not merge citations with notes"],
False),
'fields' : ("=num","Threshold for matching",
"Integer number")
'fields' : ("=num", "Threshold for matching",
"Integer number")
}

View File

@ -354,11 +354,11 @@ class TestcaseGenerator(tool.BatchTool):
handle = o.get_handle()
o = Source()
o.set_title("dup 2" + self.rand_text(self.SHORT))
if randint(0,1) == 1:
o.set_author( self.rand_text(self.SHORT))
if randint(0,1) == 1:
o.set_publication_info( self.rand_text(self.LONG))
o.set_name("dup 2" + self.rand_text(self.SHORT))
## if randint(0,1) == 1:
## o.set_author( self.rand_text(self.SHORT))
## if randint(0,1) == 1:
## o.set_publication_info( self.rand_text(self.LONG))
if randint(0,1) == 1:
o.set_abbreviation( self.rand_text(self.SHORT))
while randint(0,1) == 1:
@ -402,7 +402,7 @@ class TestcaseGenerator(tool.BatchTool):
self.db.add_object(m, self.trans)
s = Source()
s.set_title('media should be removed from this source')
s.set_name('media should be removed from this source')
r = MediaRef()
r.set_reference_handle(m.handle)
s.add_media_reference(r)
@ -411,7 +411,7 @@ class TestcaseGenerator(tool.BatchTool):
c = Citation()
self.fill_object(c)
c.set_reference_handle(s.handle)
c.set_page('media should be removed from this citation')
c.set_name('media should be removed from this citation')
r = MediaRef()
r.set_reference_handle(m.handle)
c.add_media_reference(r)
@ -843,25 +843,25 @@ class TestcaseGenerator(tool.BatchTool):
c = Citation()
self.fill_object(c)
c.set_reference_handle("unknownsourcehandle")
c.set_page('unreferenced citation with invalid source ref')
c.set_name('unreferenced citation with invalid source ref')
self.db.add_citation(c, self.trans)
c = Citation()
self.fill_object(c)
c.set_reference_handle(None)
c.set_page('unreferenced citation with invalid source ref')
c.set_name('unreferenced citation with invalid source ref')
self.db.add_citation(c, self.trans)
c = Citation()
self.fill_object(c)
c.set_reference_handle("unknownsourcehandle")
c.set_page('citation and references to it should be removed')
c.set_name('citation and references to it should be removed')
c_h1 = self.db.add_citation(c, self.trans)
c = Citation()
self.fill_object(c)
c.set_reference_handle(None)
c.set_page('citation and references to it should be removed')
c.set_name('citation and references to it should be removed')
c_h2 = self.db.add_citation(c, self.trans)
self.create_all_possible_citations([c_h1, c_h2], "Broken21",
@ -1693,11 +1693,11 @@ class TestcaseGenerator(tool.BatchTool):
o.set_name( self.rand_text(self.SHORT))
if isinstance(o,Source):
o.set_title( self.rand_text(self.SHORT))
if randint(0,1) == 1:
o.set_author( self.rand_text(self.SHORT))
if randint(0,1) == 1:
o.set_publication_info( self.rand_text(self.LONG))
o.set_name( self.rand_text(self.SHORT))
## if randint(0,1) == 1:
## o.set_author( self.rand_text(self.SHORT))
## if randint(0,1) == 1:
## o.set_publication_info( self.rand_text(self.LONG))
if randint(0,1) == 1:
o.set_abbreviation( self.rand_text(self.SHORT))
while randint(0,1) == 1:
@ -1728,7 +1728,7 @@ class TestcaseGenerator(tool.BatchTool):
self.generated_sources.append( s.get_handle())
o.set_reference_handle( choice( self.generated_sources))
if randint(0,1) == 1:
o.set_page( self.rand_text(self.NUMERIC))
o.set_name( self.rand_text(self.NUMERIC))
#if randint(0,1) == 1:
# o.set_text( self.rand_text(self.SHORT))
#if randint(0,1) == 1:

View File

@ -81,7 +81,7 @@ class CitationListView(ListView):
"""
# The data items here have to correspond, in order, to the items in
# src/giu/views/treemodels/citationlismodel.py
COL_TITLE_PAGE = 0
COL_TITLE_NAME = 0
COL_ID = 1
COL_DATE = 2
COL_CONFIDENCE = 3
@ -90,14 +90,12 @@ class CitationListView(ListView):
COL_CHAN = 6
COL_SRC_TITLE = 7
COL_SRC_ID = 8
COL_SRC_AUTH = 9
COL_SRC_ABBR = 10
COL_SRC_PINFO = 11
COL_SRC_PRIV = 12
COL_SRC_CHAN = 13
COL_SRC_ABBR = 9
COL_SRC_PRIV = 10
COL_SRC_CHAN = 11
# column definitions
COLUMNS = [
(_('Volume/Page'), TEXT, None),
(_('Name'), TEXT, None),
(_('ID'), TEXT, None),
(_('Date'), MARKUP, None),
(_('Confidence'), TEXT, None),
@ -106,22 +104,22 @@ class CitationListView(ListView):
(_('Last Changed'), TEXT, None),
(_('Source: Title'), TEXT, None),
(_('Source: ID'), TEXT, None),
(_('Source: Author'), TEXT, None),
#(_('Source: Author'), TEXT, None),
(_('Source: Abbreviation'), TEXT, None),
(_('Source: Publication Information'), TEXT, None),
#(_('Source: Publication Information'), TEXT, None),
(_('Source: Private'), ICON, 'gramps-lock'),
(_('Source: Last Changed'), TEXT, None),
]
# default setting with visible columns, order of the col, and their size
CONFIGSETTINGS = (
('columns.visible', [COL_TITLE_PAGE, COL_ID, COL_DATE,
('columns.visible', [COL_TITLE_NAME, COL_ID, COL_DATE,
COL_CONFIDENCE]),
('columns.rank', [COL_TITLE_PAGE, COL_ID, COL_DATE, COL_CONFIDENCE,
('columns.rank', [COL_TITLE_NAME, COL_ID, COL_DATE, COL_CONFIDENCE,
COL_PRIV, COL_TAGS, COL_CHAN, COL_SRC_TITLE,
COL_SRC_ID, COL_SRC_AUTH, COL_SRC_ABBR, COL_SRC_PINFO,
COL_SRC_ID, COL_SRC_ABBR,
COL_SRC_PRIV, COL_SRC_CHAN]),
('columns.size', [200, 75, 100, 100, 40, 100, 100, 200, 75, 75, 100,
150, 40, 100])
('columns.size', [200, 75, 100, 100, 40, 100, 100, 200, 75, 100,
40, 100])
)
ADD_MSG = _("Add a new citation and a new source")
ADD_SOURCE_MSG = _("Add a new source")

View File

@ -80,45 +80,48 @@ class CitationTreeView(ListView):
"""
# The data items here have to correspond, in order, to the items in
# src/giu/views/treemodels/citationtreemodel.py
COL_TITLE_PAGE = 0
COL_TITLE_NAME = 0
COL_ID = 1
COL_DATE = 2
COL_CONFIDENCE = 3
COL_PRIV = 4
COL_TAGS = 5
COL_CHAN = 6
COL_SRC_AUTH = 7
COL_SRC_ABBR = 8
COL_SRC_PINFO = 9
COL_SRC_TEMPLATE = 7
COL_SRC_AUTH = 8
COL_SRC_ABBR = 9
COL_SRC_PINFO = 10
# column definitions
COLUMNS = [
(_('Title or Page'), TEXT, None),
(_('Name'), TEXT, None),
(_('ID'), TEXT, None),
(_('Date'), MARKUP, None),
(_('Confidence'), TEXT, None),
(_('Private'), ICON, 'gramps-lock'),
(_('Tags'), TEXT, None),
(_('Last Changed'), TEXT, None),
(_('Source: Template'), TEXT, None),
(_('Source: Author'), TEXT, None),
(_('Source: Abbreviation'), TEXT, None),
(_('Source: Publication Information'), TEXT, None),
]
COLUMN_FILTERABLE = [
COL_TITLE_PAGE,
COL_TITLE_NAME,
COL_ID,
COL_CHAN,
COL_SRC_TEMPLATE,
COL_SRC_AUTH,
COL_SRC_ABBR,
COL_SRC_PINFO
]
# default setting with visible columns, order of the col, and their size
CONFIGSETTINGS = (
('columns.visible', [COL_TITLE_PAGE, COL_ID, COL_SRC_AUTH,
('columns.visible', [COL_TITLE_NAME, COL_ID, COL_SRC_AUTH,
COL_SRC_PINFO]),
('columns.rank', [COL_TITLE_PAGE, COL_ID, COL_DATE, COL_CONFIDENCE,
('columns.rank', [COL_TITLE_NAME, COL_ID, COL_DATE, COL_CONFIDENCE,
COL_PRIV, COL_TAGS, COL_CHAN, COL_SRC_AUTH,
COL_SRC_ABBR, COL_SRC_PINFO]),
('columns.size', [200, 75, 100, 75, 40, 100, 100, 150, 100, 150])
COL_SRC_ABBR, COL_SRC_PINFO, COL_SRC_TEMPLATE]),
('columns.size', [200, 75, 100, 75, 40, 100, 100, 150, 100, 150, 50])
)
ADD_MSG = _("Add a new citation and a new source")
ADD_SOURCE_MSG = _("Add a new source")

View File

@ -70,32 +70,34 @@ _ = glocale.translation.gettext
class SourceView(ListView):
""" sources listview class
"""
COL_TITLE = 0
COL_NAME = 0
COL_ID = 1
COL_AUTH = 2
COL_ABBR = 3
COL_PINFO = 4
COL_PRIV = 5
COL_TAGS = 6
COL_CHAN = 7
COL_TEMPLATE = 5
COL_PRIV = 6
COL_TAGS = 7
COL_CHAN = 8
# column definitions
COLUMNS = [
(_('Title'), TEXT, None),
(_('Name'), TEXT, None),
(_('ID'), TEXT, None),
(_('Author'), TEXT, None),
(_('Abbreviation'), TEXT, None),
(_('Publication Information'), TEXT, None),
(_('Template'), TEXT, None),
(_('Private'), ICON, 'gramps-lock'),
(_('Tags'), TEXT, None),
(_('Last Changed'), TEXT, None),
]
# default setting with visible columns, order of the col, and their size
CONFIGSETTINGS = (
('columns.visible', [COL_TITLE, COL_ID, COL_AUTH, COL_PINFO]),
('columns.rank', [COL_TITLE, COL_ID, COL_AUTH, COL_ABBR, COL_PINFO,
COL_PRIV, COL_TAGS, COL_CHAN]),
('columns.size', [200, 75, 150, 100, 150, 40, 100, 100])
('columns.visible', [COL_NAME, COL_ID, COL_AUTH, COL_PINFO]),
('columns.rank', [COL_NAME, COL_ID, COL_AUTH, COL_ABBR, COL_PINFO,
COL_TEMPLATE, COL_PRIV, COL_TAGS, COL_CHAN]),
('columns.size', [200, 75, 150, 100, 150, 50, 40, 100, 100])
)
ADD_MSG = _("Add a new source")
EDIT_MSG = _("Edit the selected source")

View File

@ -7446,7 +7446,7 @@ class NavWebReport(Report):
citation = self.database.get_citation_from_handle(citation_handle)
# If Page is none, we want to make sure that a tuple is generated for
# the source backreference
citation_name = citation.get_page() or ""
citation_name = citation.get_name() or ""
source_handle = citation.get_reference_handle()
self.obj_dict[Citation][citation_handle] = ("", citation_name,
citation.gramps_id)