Removal of redundant SourceRef and related modules. Minor consequent changes.
svn: r18516
This commit is contained in:
parent
bafe7870c7
commit
26cb74474b
10
src/Utils.py
10
src/Utils.py
@ -89,11 +89,11 @@ def format_gender( type):
|
|||||||
return gender.get(type[0], _("Invalid"))
|
return gender.get(type[0], _("Invalid"))
|
||||||
|
|
||||||
confidence = {
|
confidence = {
|
||||||
gen.lib.SourceRef.CONF_VERY_HIGH : _("Very High"),
|
gen.lib.Citation.CONF_VERY_HIGH : _("Very High"),
|
||||||
gen.lib.SourceRef.CONF_HIGH : _("High"),
|
gen.lib.Citation.CONF_HIGH : _("High"),
|
||||||
gen.lib.SourceRef.CONF_NORMAL : _("Normal"),
|
gen.lib.Citation.CONF_NORMAL : _("Normal"),
|
||||||
gen.lib.SourceRef.CONF_LOW : _("Low"),
|
gen.lib.Citation.CONF_LOW : _("Low"),
|
||||||
gen.lib.SourceRef.CONF_VERY_LOW : _("Very Low"),
|
gen.lib.Citation.CONF_VERY_LOW : _("Very Low"),
|
||||||
}
|
}
|
||||||
|
|
||||||
family_rel_descriptions = {
|
family_rel_descriptions = {
|
||||||
|
@ -56,11 +56,9 @@ pkgdata_PYTHON = \
|
|||||||
repotype.py \
|
repotype.py \
|
||||||
researcher.py \
|
researcher.py \
|
||||||
secondaryobj.py \
|
secondaryobj.py \
|
||||||
srcbase.py \
|
|
||||||
srcmediatype.py \
|
srcmediatype.py \
|
||||||
srcnote.py \
|
srcnote.py \
|
||||||
src.py \
|
src.py \
|
||||||
srcref.py \
|
|
||||||
surname.py \
|
surname.py \
|
||||||
surnamebase.py \
|
surnamebase.py \
|
||||||
styledtext.py \
|
styledtext.py \
|
||||||
|
@ -36,7 +36,6 @@ from gen.lib.ldsord import LdsOrd
|
|||||||
from gen.lib.mediaref import MediaRef
|
from gen.lib.mediaref import MediaRef
|
||||||
from gen.lib.name import Name
|
from gen.lib.name import Name
|
||||||
from gen.lib.reporef import RepoRef
|
from gen.lib.reporef import RepoRef
|
||||||
from gen.lib.srcref import SourceRef
|
|
||||||
from gen.lib.surname import Surname
|
from gen.lib.surname import Surname
|
||||||
from gen.lib.url import Url
|
from gen.lib.url import Url
|
||||||
from gen.lib.witness import Witness
|
from gen.lib.witness import Witness
|
||||||
|
@ -1,196 +0,0 @@
|
|||||||
#
|
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
|
||||||
#
|
|
||||||
# Copyright (C) 2006 Donald N. Allingham
|
|
||||||
# Copyright (C) 2010 Michiel D. Nauta
|
|
||||||
# Copyright (C) 2011 Tim G L Lyons
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
# $Id$
|
|
||||||
|
|
||||||
"""
|
|
||||||
SourceBase class for GRAMPS.
|
|
||||||
"""
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# GRAMPS modules
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
from gen.lib.srcref import SourceRef
|
|
||||||
from gen.lib.const import IDENTICAL, EQUAL, DIFFERENT
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# SourceBase classes
|
|
||||||
# FIXME: CITATION: As of Gramps 3.4, SourceBase is no longer used so this module
|
|
||||||
# needs to be removed
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
class SourceBase(object):
|
|
||||||
"""
|
|
||||||
Base class for storing source references.
|
|
||||||
"""
|
|
||||||
def __init__(self, source=None):
|
|
||||||
"""
|
|
||||||
Create a new SourceBase, copying from source if not None.
|
|
||||||
|
|
||||||
:param source: Object used to initialize the new object
|
|
||||||
:type source: SourceBase
|
|
||||||
"""
|
|
||||||
|
|
||||||
self.source_list = map(SourceRef, source.source_list) if source else []
|
|
||||||
|
|
||||||
def serialize(self):
|
|
||||||
"""
|
|
||||||
Convert the object to a serialized tuple of data.
|
|
||||||
"""
|
|
||||||
return [sref.serialize() for sref in self.source_list]
|
|
||||||
|
|
||||||
def unserialize(self, data):
|
|
||||||
"""
|
|
||||||
Convert a serialized tuple of data to an object.
|
|
||||||
"""
|
|
||||||
self.source_list = [SourceRef().unserialize(item) for item in data]
|
|
||||||
|
|
||||||
def add_source_reference(self, src_ref) :
|
|
||||||
"""
|
|
||||||
Add a source reference to this object.
|
|
||||||
|
|
||||||
:param src_ref: The source reference to be added to the
|
|
||||||
SourceNote's list of source references.
|
|
||||||
:type src_ref: :class:`~gen.lib.srcref.SourceRef`
|
|
||||||
"""
|
|
||||||
self.source_list.append(src_ref)
|
|
||||||
|
|
||||||
def get_source_references(self) :
|
|
||||||
"""
|
|
||||||
Return the list of source references associated with the object.
|
|
||||||
|
|
||||||
:returns: Returns the list of :class:`~gen.lib.srcref.SourceRef` objects associated with
|
|
||||||
the object.
|
|
||||||
:rtype: list
|
|
||||||
"""
|
|
||||||
return self.source_list
|
|
||||||
|
|
||||||
def get_sourcref_child_list(self):
|
|
||||||
"""
|
|
||||||
Return the list of child secondary objects that may refer sources.
|
|
||||||
|
|
||||||
:returns: Returns the list of child secondary child objects that may
|
|
||||||
refer sources.
|
|
||||||
:rtype: list
|
|
||||||
"""
|
|
||||||
return []
|
|
||||||
|
|
||||||
def has_source_reference(self, src_handle) :
|
|
||||||
"""
|
|
||||||
Return True if the object or any of it's child objects has reference
|
|
||||||
to this source handle.
|
|
||||||
|
|
||||||
:param src_handle: The source handle to be checked.
|
|
||||||
:type src_handle: str
|
|
||||||
:returns: Returns whether the object or any of it's child objects has
|
|
||||||
reference to this source handle.
|
|
||||||
:rtype: bool
|
|
||||||
"""
|
|
||||||
for src_ref in self.source_list:
|
|
||||||
# Using direct access here, not the getter method -- efficiency!
|
|
||||||
if src_ref.ref == src_handle:
|
|
||||||
return True
|
|
||||||
|
|
||||||
for item in self.get_sourcref_child_list():
|
|
||||||
if item.has_source_reference(src_handle):
|
|
||||||
return True
|
|
||||||
|
|
||||||
return False
|
|
||||||
|
|
||||||
def remove_source_references(self, src_handle_list):
|
|
||||||
"""
|
|
||||||
Remove references to all source handles in the list in this object
|
|
||||||
and all child objects.
|
|
||||||
|
|
||||||
:param src_handle_list: The list of source handles to be removed.
|
|
||||||
:type src_handle_list: list
|
|
||||||
"""
|
|
||||||
new_source_list = [src_ref for src_ref in self.source_list
|
|
||||||
if src_ref.ref not in src_handle_list]
|
|
||||||
self.source_list = new_source_list
|
|
||||||
|
|
||||||
for item in self.get_sourcref_child_list():
|
|
||||||
item.remove_source_references(src_handle_list)
|
|
||||||
|
|
||||||
def replace_source_references(self, old_handle, new_handle):
|
|
||||||
"""
|
|
||||||
Replace references to source handles in the list in this object and
|
|
||||||
all child objects and merge equivalent entries.
|
|
||||||
|
|
||||||
:param old_handle: The source handle to be replaced.
|
|
||||||
:type old_handle: str
|
|
||||||
:param new_handle: The source handle to replace the old one with.
|
|
||||||
:type new_handle: str
|
|
||||||
"""
|
|
||||||
refs_list = [ src_ref.ref for src_ref in self.source_list ]
|
|
||||||
new_ref = None
|
|
||||||
if new_handle in refs_list:
|
|
||||||
new_ref = self.source_list[refs_list.index(new_handle)]
|
|
||||||
n_replace = refs_list.count(old_handle)
|
|
||||||
for ix_replace in xrange(n_replace):
|
|
||||||
idx = refs_list.index(old_handle)
|
|
||||||
self.source_list[idx].ref = new_handle
|
|
||||||
refs_list[idx] = new_handle
|
|
||||||
if new_ref:
|
|
||||||
src_ref = self.source_list[idx]
|
|
||||||
equi = new_ref.is_equivalent(src_ref)
|
|
||||||
if equi != DIFFERENT:
|
|
||||||
if equi == EQUAL:
|
|
||||||
new_ref.merge(src_ref)
|
|
||||||
self.source_list.pop(idx)
|
|
||||||
refs_list.pop(idx)
|
|
||||||
|
|
||||||
for item in self.get_sourcref_child_list():
|
|
||||||
item.replace_source_references(old_handle, new_handle)
|
|
||||||
|
|
||||||
def set_source_reference_list(self, src_ref_list) :
|
|
||||||
"""
|
|
||||||
Assign the passed list to the object's list of source references.
|
|
||||||
|
|
||||||
:param src_ref_list: List of source references to ba associated
|
|
||||||
with the object
|
|
||||||
:type src_ref_list: list of :class:`~gen.lib.srcref.SourceRef` instances
|
|
||||||
"""
|
|
||||||
self.source_list = src_ref_list
|
|
||||||
|
|
||||||
def _merge_source_reference_list(self, acquisition):
|
|
||||||
"""
|
|
||||||
Merge the list of source references from acquisition with our own.
|
|
||||||
|
|
||||||
:param acquisition: the source references list of this object will be
|
|
||||||
merged with the current source references list.
|
|
||||||
:rtype acquisition: SourceRef
|
|
||||||
"""
|
|
||||||
srcref_list = self.source_list[:]
|
|
||||||
for addendum in acquisition.get_source_references():
|
|
||||||
for srcref in srcref_list:
|
|
||||||
equi = srcref.is_equivalent(addendum)
|
|
||||||
if equi == IDENTICAL:
|
|
||||||
break
|
|
||||||
elif equi == EQUAL:
|
|
||||||
srcref.merge(addendum)
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
self.source_list.append(addendum)
|
|
@ -1,176 +0,0 @@
|
|||||||
#
|
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
|
||||||
#
|
|
||||||
# Copyright (C) 2000-2007 Donald N. Allingham
|
|
||||||
# Copyright (C) 2010 Michiel D. Nauta
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
# $Id$
|
|
||||||
|
|
||||||
"""
|
|
||||||
Source Reference class for GRAMPS.
|
|
||||||
"""
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# Python modules
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
from warnings import warn
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# GRAMPS modules
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
from gen.lib.secondaryobj import SecondaryObject
|
|
||||||
from gen.lib.datebase import DateBase
|
|
||||||
from gen.lib.privacybase import PrivacyBase
|
|
||||||
from gen.lib.notebase import NoteBase
|
|
||||||
from gen.lib.refbase import RefBase
|
|
||||||
from gen.lib.const import IDENTICAL, EQUAL, DIFFERENT
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# Source References for all primary objects
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
class SourceRef(SecondaryObject, DateBase, PrivacyBase, NoteBase, RefBase):
|
|
||||||
"""
|
|
||||||
Source reference, containing detailed information about how a referenced
|
|
||||||
source relates to it.
|
|
||||||
"""
|
|
||||||
|
|
||||||
CONF_VERY_HIGH = 4
|
|
||||||
CONF_HIGH = 3
|
|
||||||
CONF_NORMAL = 2
|
|
||||||
CONF_LOW = 1
|
|
||||||
CONF_VERY_LOW = 0
|
|
||||||
|
|
||||||
def __init__(self, source=None):
|
|
||||||
"""Create a new SourceRef, copying from the source if present."""
|
|
||||||
DateBase.__init__(self, source)
|
|
||||||
PrivacyBase.__init__(self, source)
|
|
||||||
NoteBase.__init__(self, source)
|
|
||||||
RefBase.__init__(self, source)
|
|
||||||
if source:
|
|
||||||
self.confidence = source.confidence
|
|
||||||
self.page = source.page
|
|
||||||
else:
|
|
||||||
self.confidence = SourceRef.CONF_NORMAL
|
|
||||||
self.page = ""
|
|
||||||
|
|
||||||
def serialize(self):
|
|
||||||
"""
|
|
||||||
Convert the object to a serialized tuple of data.
|
|
||||||
"""
|
|
||||||
return (DateBase.serialize(self),
|
|
||||||
PrivacyBase.serialize(self),
|
|
||||||
NoteBase.serialize(self),
|
|
||||||
self.confidence,
|
|
||||||
RefBase.serialize(self),
|
|
||||||
self.page)
|
|
||||||
|
|
||||||
def unserialize(self, data):
|
|
||||||
"""
|
|
||||||
Convert a serialized tuple of data to an object.
|
|
||||||
"""
|
|
||||||
(date, privacy, note_list,
|
|
||||||
self.confidence, ref, self.page) = data
|
|
||||||
DateBase.unserialize(self, date)
|
|
||||||
PrivacyBase.unserialize(self, privacy)
|
|
||||||
NoteBase.unserialize(self, note_list)
|
|
||||||
RefBase.unserialize(self, ref)
|
|
||||||
return self
|
|
||||||
|
|
||||||
def get_text_data_list(self):
|
|
||||||
"""
|
|
||||||
Return the list of all textual attributes of the object.
|
|
||||||
|
|
||||||
:returns: Returns the list of all textual attributes of the object.
|
|
||||||
:rtype: list
|
|
||||||
"""
|
|
||||||
return [self.page]
|
|
||||||
|
|
||||||
def get_referenced_handles(self):
|
|
||||||
"""
|
|
||||||
Return the list of (classname, handle) tuples for all directly
|
|
||||||
referenced primary objects.
|
|
||||||
|
|
||||||
:returns: List of (classname, handle) tuples for referenced objects.
|
|
||||||
:rtype: list
|
|
||||||
"""
|
|
||||||
ret = self.get_referenced_note_handles()
|
|
||||||
if self.ref:
|
|
||||||
ret += [('Source', self.ref)]
|
|
||||||
return ret
|
|
||||||
|
|
||||||
def is_equivalent(self, other):
|
|
||||||
"""
|
|
||||||
Return if this source reference is equivalent, that is agreees in
|
|
||||||
reference, source page and date, to other.
|
|
||||||
|
|
||||||
:param other: The source reference to compare this one to.
|
|
||||||
:rtype other: SourceRef
|
|
||||||
;returns: Constant indicating degree of equivalence.
|
|
||||||
:rtype: int
|
|
||||||
"""
|
|
||||||
if self.ref != other.ref or \
|
|
||||||
self.page != other.page or \
|
|
||||||
self.get_date_object() != other.get_date_object():
|
|
||||||
return DIFFERENT
|
|
||||||
else:
|
|
||||||
if self.is_equal(other):
|
|
||||||
return IDENTICAL
|
|
||||||
else:
|
|
||||||
return EQUAL
|
|
||||||
|
|
||||||
def merge(self, acquisition):
|
|
||||||
"""
|
|
||||||
Merge the content of acquisition into this source reference.
|
|
||||||
|
|
||||||
:param acquisition: The source reference to merge with the present one.
|
|
||||||
:rtype acquisition: SourceRef
|
|
||||||
"""
|
|
||||||
self._merge_privacy(acquisition)
|
|
||||||
self._merge_note_list(acquisition)
|
|
||||||
# merge confidence
|
|
||||||
level_priority = [0, 4, 1, 3, 2]
|
|
||||||
idx = min(level_priority.index(self.confidence),
|
|
||||||
level_priority.index(acquisition.confidence))
|
|
||||||
self.confidence = level_priority[idx]
|
|
||||||
|
|
||||||
def set_confidence_level(self, val):
|
|
||||||
"""Set the confidence level."""
|
|
||||||
self.confidence = val
|
|
||||||
|
|
||||||
def get_confidence_level(self):
|
|
||||||
"""Return the confidence level."""
|
|
||||||
return self.confidence
|
|
||||||
|
|
||||||
def set_page(self, page):
|
|
||||||
"""Set the page indicator of the SourceRef."""
|
|
||||||
self.page = page
|
|
||||||
|
|
||||||
def get_page(self):
|
|
||||||
"""Get the page indicator of the SourceRef."""
|
|
||||||
return self.page
|
|
||||||
|
|
||||||
def are_equal(self, other):
|
|
||||||
"""Deprecated function - use is_equal instead."""
|
|
||||||
warn( "Use is_equal instead of are_equal", DeprecationWarning, 2)
|
|
||||||
return self.is_equal(other)
|
|
@ -26,7 +26,7 @@ Contain and organize bibliographic information.
|
|||||||
"""
|
"""
|
||||||
import string
|
import string
|
||||||
import math
|
import math
|
||||||
from gen.lib import SourceRef
|
import gen.lib
|
||||||
|
|
||||||
class Citation(object):
|
class Citation(object):
|
||||||
"""
|
"""
|
||||||
@ -212,7 +212,8 @@ class Bibliography(object):
|
|||||||
return True
|
return True
|
||||||
if ( self.mode & self.MODE_CONF ) == self.MODE_CONF:
|
if ( self.mode & self.MODE_CONF ) == self.MODE_CONF:
|
||||||
confidence = source_ref.get_confidence_level()
|
confidence = source_ref.get_confidence_level()
|
||||||
if confidence is not None and confidence != SourceRef.CONF_NORMAL:
|
if confidence is not None and confidence != \
|
||||||
|
gen.lib.Citation.CONF_NORMAL:
|
||||||
return True
|
return True
|
||||||
if ( self.mode & self.MODE_NOTE ) == self.MODE_NOTE:
|
if ( self.mode & self.MODE_NOTE ) == self.MODE_NOTE:
|
||||||
if len(source_ref.get_note_list()) != 0:
|
if len(source_ref.get_note_list()) != 0:
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
Provide utilities for printing endnotes in text reports.
|
Provide utilities for printing endnotes in text reports.
|
||||||
"""
|
"""
|
||||||
from gen.plug.docgen import FontStyle, ParagraphStyle, FONT_SANS_SERIF
|
from gen.plug.docgen import FontStyle, ParagraphStyle, FONT_SANS_SERIF
|
||||||
from gen.lib import NoteType, SourceRef
|
from gen.lib import NoteType, Citation
|
||||||
from gen.ggettext import gettext as _
|
from gen.ggettext import gettext as _
|
||||||
from Utils import confidence
|
from Utils import confidence
|
||||||
from DateHandler import displayer
|
from DateHandler import displayer
|
||||||
@ -84,7 +84,7 @@ def cite_source(bibliography, database, obj):
|
|||||||
@param bibliography: The bibliography to contain the citations.
|
@param bibliography: The bibliography to contain the citations.
|
||||||
@type bibliography: L{Bibliography}
|
@type bibliography: L{Bibliography}
|
||||||
@param obj: An object with source references.
|
@param obj: An object with source references.
|
||||||
@type obj: L{gen.lib.srcbase}
|
@type obj: L{gen.lib.CitationBase}
|
||||||
"""
|
"""
|
||||||
txt = ""
|
txt = ""
|
||||||
slist = obj.get_citation_list()
|
slist = obj.get_citation_list()
|
||||||
@ -188,7 +188,7 @@ def _format_ref_text(ref, key):
|
|||||||
ref_txt = ref.get_page()
|
ref_txt = ref.get_page()
|
||||||
|
|
||||||
# Print only confidence level if it is not Normal
|
# Print only confidence level if it is not Normal
|
||||||
if ref.get_confidence_level() != SourceRef.CONF_NORMAL:
|
if ref.get_confidence_level() != Citation.CONF_NORMAL:
|
||||||
ref_txt += " [" + confidence[ref.get_confidence_level()] + "]"
|
ref_txt += " [" + confidence[ref.get_confidence_level()] + "]"
|
||||||
|
|
||||||
return ref_txt
|
return ref_txt
|
||||||
|
@ -34,7 +34,6 @@ pkgdata_PYTHON = \
|
|||||||
editreporef.py \
|
editreporef.py \
|
||||||
editsecondary.py \
|
editsecondary.py \
|
||||||
editsource.py \
|
editsource.py \
|
||||||
editsourceref.py \
|
|
||||||
editurl.py \
|
editurl.py \
|
||||||
objectentries.py
|
objectentries.py
|
||||||
|
|
||||||
|
@ -41,7 +41,6 @@ from editplace import EditPlace, DeletePlaceQuery
|
|||||||
from editrepository import EditRepository, DeleteRepositoryQuery
|
from editrepository import EditRepository, DeleteRepositoryQuery
|
||||||
from editreporef import EditRepoRef
|
from editreporef import EditRepoRef
|
||||||
from editsource import EditSource, DeleteSrcQuery
|
from editsource import EditSource, DeleteSrcQuery
|
||||||
from editsourceref import EditSourceRef
|
|
||||||
from editurl import EditUrl
|
from editurl import EditUrl
|
||||||
from editlink import EditLink
|
from editlink import EditLink
|
||||||
|
|
||||||
|
@ -43,8 +43,6 @@ pkgdata_PYTHON = \
|
|||||||
repoembedlist.py \
|
repoembedlist.py \
|
||||||
reporefmodel.py \
|
reporefmodel.py \
|
||||||
sourcebackreflist.py \
|
sourcebackreflist.py \
|
||||||
sourceembedlist.py \
|
|
||||||
sourcerefmodel.py \
|
|
||||||
surnamemodel.py \
|
surnamemodel.py \
|
||||||
surnametab.py \
|
surnametab.py \
|
||||||
webembedlist.py \
|
webembedlist.py \
|
||||||
|
@ -60,5 +60,4 @@ from placebackreflist import PlaceBackRefList
|
|||||||
from repoembedlist import RepoEmbedList
|
from repoembedlist import RepoEmbedList
|
||||||
from surnametab import SurnameTab
|
from surnametab import SurnameTab
|
||||||
from sourcebackreflist import SourceBackRefList
|
from sourcebackreflist import SourceBackRefList
|
||||||
from sourceembedlist import SourceEmbedList
|
|
||||||
from webembedlist import WebEmbedList
|
from webembedlist import WebEmbedList
|
||||||
|
@ -1,230 +0,0 @@
|
|||||||
#
|
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
|
||||||
#
|
|
||||||
# Copyright (C) 2000-2006 Donald N. Allingham
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
# $Id$
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# Python classes
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
from gen.ggettext import gettext as _
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# GRAMPS classes
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
import gen.lib
|
|
||||||
from gui.dbguielement import DbGUIElement
|
|
||||||
from gui.selectors import SelectorFactory
|
|
||||||
import Errors
|
|
||||||
from DdTargets import DdTargets
|
|
||||||
from sourcerefmodel import SourceRefModel
|
|
||||||
from embeddedlist import EmbeddedList
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# SourceEmbedList
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
class SourceEmbedList(EmbeddedList, DbGUIElement):
|
|
||||||
|
|
||||||
_HANDLE_COL = 4
|
|
||||||
_DND_TYPE = DdTargets.SOURCEREF
|
|
||||||
_DND_EXTRA = DdTargets.SOURCE_LINK
|
|
||||||
|
|
||||||
_MSG = {
|
|
||||||
'add' : _('Create and add a new source'),
|
|
||||||
'del' : _('Remove the existing source'),
|
|
||||||
'edit' : _('Edit the selected source'),
|
|
||||||
'share' : _('Add an existing source'),
|
|
||||||
'up' : _('Move the selected source upwards'),
|
|
||||||
'down' : _('Move the selected source downwards'),
|
|
||||||
}
|
|
||||||
|
|
||||||
#index = column in model. Value =
|
|
||||||
# (name, sortcol in model, width, markup/text, weigth_col
|
|
||||||
_column_names = [
|
|
||||||
(_('ID'), 0, 75, 0, -1),
|
|
||||||
(_('Title'), 1, 200, 0, -1),
|
|
||||||
(_('Author'), 2, 125, 0, -1),
|
|
||||||
(_('Page'), 3, 100, 0, -1),
|
|
||||||
]
|
|
||||||
|
|
||||||
def __init__(self, dbstate, uistate, track, obj):
|
|
||||||
self.obj = obj
|
|
||||||
EmbeddedList.__init__(self, dbstate, uistate, track, _('_Sources'),
|
|
||||||
SourceRefModel, share_button=True,
|
|
||||||
move_buttons=True)
|
|
||||||
DbGUIElement.__init__(self, dbstate.db)
|
|
||||||
self.callman.register_handles({'source': [sref.ref for sref
|
|
||||||
in self.obj.get_source_references()]})
|
|
||||||
|
|
||||||
def _connect_db_signals(self):
|
|
||||||
"""
|
|
||||||
Implement base class DbGUIElement method
|
|
||||||
"""
|
|
||||||
#note: source-rebuild closes the editors, so no need to connect to it
|
|
||||||
self.callman.register_callbacks(
|
|
||||||
{'source-delete': self.source_delete, # delete a source we track
|
|
||||||
'source-update': self.source_update, # change a source we track
|
|
||||||
})
|
|
||||||
self.callman.connect_all(keys=['source'])
|
|
||||||
|
|
||||||
def get_icon_name(self):
|
|
||||||
return 'gramps-source'
|
|
||||||
|
|
||||||
def get_data(self):
|
|
||||||
return self.obj.get_source_references()
|
|
||||||
|
|
||||||
def column_order(self):
|
|
||||||
return ((1, 0), (1, 1), (1, 2), (1, 3))
|
|
||||||
|
|
||||||
def add_button_clicked(self, obj):
|
|
||||||
from gui.editors import EditSourceRef
|
|
||||||
try:
|
|
||||||
sref = gen.lib.SourceRef()
|
|
||||||
src = gen.lib.Source()
|
|
||||||
EditSourceRef(
|
|
||||||
self.dbstate,
|
|
||||||
self.uistate,
|
|
||||||
self.track,
|
|
||||||
src,
|
|
||||||
sref,
|
|
||||||
self.object_added)
|
|
||||||
except Errors.WindowActiveError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def __blocked_text(self):
|
|
||||||
"""
|
|
||||||
Return the common text used when sourceref cannot be edited
|
|
||||||
"""
|
|
||||||
return _("This source reference cannot be edited at this time. "
|
|
||||||
"Either the associated source is already being edited "
|
|
||||||
"or another source reference that is associated with "
|
|
||||||
"the same source is being edited.\n\nTo edit this "
|
|
||||||
"source reference, you need to close the source.")
|
|
||||||
|
|
||||||
def share_button_clicked(self, obj):
|
|
||||||
from gui.editors import EditSourceRef
|
|
||||||
SelectSource = SelectorFactory('Source')
|
|
||||||
|
|
||||||
sel = SelectSource(self.dbstate,self.uistate,self.track)
|
|
||||||
src = sel.run()
|
|
||||||
if src:
|
|
||||||
try:
|
|
||||||
ref = gen.lib.SourceRef()
|
|
||||||
EditSourceRef(self.dbstate,
|
|
||||||
self.uistate,
|
|
||||||
self.track,
|
|
||||||
src,
|
|
||||||
ref,
|
|
||||||
self.object_added)
|
|
||||||
|
|
||||||
except Errors.WindowActiveError:
|
|
||||||
from QuestionDialog import WarningDialog
|
|
||||||
WarningDialog(_("Cannot share this reference"),
|
|
||||||
self.__blocked_text())
|
|
||||||
|
|
||||||
def edit_button_clicked(self, obj):
|
|
||||||
from gui.editors import EditSourceRef
|
|
||||||
sref = self.get_selected()
|
|
||||||
if sref:
|
|
||||||
src = self.dbstate.db.get_source_from_handle(sref.ref)
|
|
||||||
|
|
||||||
try:
|
|
||||||
EditSourceRef(self.dbstate, self.uistate, self.track,
|
|
||||||
src, sref, self.object_edited)
|
|
||||||
except Errors.WindowActiveError:
|
|
||||||
from QuestionDialog import WarningDialog
|
|
||||||
WarningDialog(_("Cannot edit this reference"),
|
|
||||||
self.__blocked_text())
|
|
||||||
|
|
||||||
def object_added(self, reference, primary):
|
|
||||||
"""
|
|
||||||
Callback from sourceref editor after adding a new reference (to a new
|
|
||||||
or an existing source).
|
|
||||||
Note that if it was to an existing source already present in the
|
|
||||||
sourcelist, then the source-update signal will also cause a rebuild
|
|
||||||
at that time.
|
|
||||||
"""
|
|
||||||
reference.ref = primary.handle
|
|
||||||
self.get_data().append(reference)
|
|
||||||
self.callman.register_handles({'source': [primary.handle]})
|
|
||||||
self.changed = True
|
|
||||||
self.rebuild()
|
|
||||||
|
|
||||||
def object_edited(self, refererence, primary):
|
|
||||||
"""
|
|
||||||
Callback from sourceref editor. If the source changes itself, also
|
|
||||||
the source-change signal will cause a rebuild.
|
|
||||||
This could be solved in the source editor if it only calls this
|
|
||||||
method in the case the sourceref part only changes.
|
|
||||||
"""
|
|
||||||
self.changed = True
|
|
||||||
self.rebuild()
|
|
||||||
|
|
||||||
def handle_extra_type(self, objtype, obj):
|
|
||||||
from gui.editors import EditSourceRef
|
|
||||||
sref = gen.lib.SourceRef()
|
|
||||||
src = self.dbstate.db.get_source_from_handle(obj)
|
|
||||||
try:
|
|
||||||
EditSourceRef(self.dbstate, self.uistate, self.track,
|
|
||||||
src, sref, self.object_added)
|
|
||||||
except Errors.WindowActiveError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def source_delete(self, del_src_handle_list):
|
|
||||||
"""
|
|
||||||
Outside of this tab source objects have been deleted. Check if tab
|
|
||||||
and object must be changed.
|
|
||||||
Note: delete of object will cause reference on database to be removed,
|
|
||||||
so this method need not do this
|
|
||||||
"""
|
|
||||||
rebuild = False
|
|
||||||
sourceref_list = self.get_data()
|
|
||||||
ref_handles = [sref.ref for sref in sourceref_list]
|
|
||||||
for handle in del_src_handle_list :
|
|
||||||
while 1:
|
|
||||||
pos = None
|
|
||||||
try :
|
|
||||||
pos = ref_handles.index(handle)
|
|
||||||
except ValueError :
|
|
||||||
break
|
|
||||||
|
|
||||||
if pos is not None:
|
|
||||||
#oeps, we need to remove this reference, and rebuild tab
|
|
||||||
del sourceref_list[pos]
|
|
||||||
del ref_handles[pos]
|
|
||||||
rebuild = True
|
|
||||||
if rebuild:
|
|
||||||
self.rebuild()
|
|
||||||
|
|
||||||
def source_update(self, upd_src_handle_list):
|
|
||||||
"""
|
|
||||||
Outside of this tab media objects have been changed. Check if tab
|
|
||||||
and object must be changed.
|
|
||||||
"""
|
|
||||||
ref_handles = [sref.ref for sref in self.get_data()]
|
|
||||||
for handle in upd_src_handle_list :
|
|
||||||
if handle in ref_handles:
|
|
||||||
self.rebuild()
|
|
||||||
break
|
|
@ -1,50 +0,0 @@
|
|||||||
#
|
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
|
||||||
#
|
|
||||||
# Copyright (C) 2000-2006 Donald N. Allingham
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
# $Id$
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# GTK libraries
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
import gtk
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# GRAMPS classes
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# SourceRefModel
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
class SourceRefModel(gtk.ListStore):
|
|
||||||
|
|
||||||
def __init__(self, sref_list, db):
|
|
||||||
gtk.ListStore.__init__(self, str, str, str, str, object)
|
|
||||||
self.db = db
|
|
||||||
for sref in sref_list:
|
|
||||||
src = self.db.get_source_from_handle(sref.get_reference_handle())
|
|
||||||
self.append(row=[src.gramps_id, src.title, src.author,
|
|
||||||
sref.page, sref, ])
|
|
@ -1,228 +0,0 @@
|
|||||||
#
|
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
|
||||||
#
|
|
||||||
# Copyright (C) 2000-2006 Donald N. Allingham
|
|
||||||
# 2009 Gary Burton
|
|
||||||
# 2011 Michiel D. Nauta / MathieuMD
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
# $Id$
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# Python modules
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
from gen.ggettext import gettext as _
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# gramps modules
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
import gen.lib
|
|
||||||
from gen.db import DbTxn
|
|
||||||
from glade import Glade
|
|
||||||
from displaytabs import (NoteTab, GalleryTab, SourceBackRefList,
|
|
||||||
DataEmbedList, RepoEmbedList)
|
|
||||||
from gui.widgets import (PrivacyButton, MonitoredEntry, MonitoredMenu,
|
|
||||||
MonitoredDate)
|
|
||||||
from editreference import RefTab, EditReference
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# EditSourceRef class
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
class EditSourceRef(EditReference):
|
|
||||||
|
|
||||||
def __init__(self, state, uistate, track, source, source_ref, update):
|
|
||||||
|
|
||||||
EditReference.__init__(self, state, uistate, track, source,
|
|
||||||
source_ref, update)
|
|
||||||
|
|
||||||
def _local_init(self):
|
|
||||||
self.width_key = 'interface.event-ref-width'
|
|
||||||
self.height_key = 'interface.event-ref-height'
|
|
||||||
|
|
||||||
self.top = Glade()
|
|
||||||
|
|
||||||
self.set_window(self.top.toplevel,
|
|
||||||
self.top.get_object('source_title'),
|
|
||||||
_('Source Reference Editor'))
|
|
||||||
|
|
||||||
self.define_warn_box(self.top.get_object("warn_box"))
|
|
||||||
self.define_expander(self.top.get_object("src_expander"))
|
|
||||||
|
|
||||||
tblref = self.top.get_object('table67')
|
|
||||||
notebook = self.top.get_object('notebook_ref')
|
|
||||||
#recreate start page as GrampsTab
|
|
||||||
notebook.remove_page(0)
|
|
||||||
self.reftab = RefTab(self.dbstate, self.uistate, self.track,
|
|
||||||
_('General'), tblref)
|
|
||||||
tblref = self.top.get_object('table68')
|
|
||||||
notebook = self.top.get_object('notebook_src')
|
|
||||||
#recreate start page as GrampsTab
|
|
||||||
notebook.remove_page(0)
|
|
||||||
self.primtab = RefTab(self.dbstate, self.uistate, self.track,
|
|
||||||
_('General'), tblref)
|
|
||||||
|
|
||||||
def _post_init(self):
|
|
||||||
title = self.top.get_object('title')
|
|
||||||
volume = self.top.get_object('volume')
|
|
||||||
if not title.get_text_length():
|
|
||||||
title.grab_focus();
|
|
||||||
elif not volume.get_text_length():
|
|
||||||
volume.grab_focus();
|
|
||||||
|
|
||||||
def _connect_signals(self):
|
|
||||||
self.define_ok_button(self.top.get_object('ok'),self.ok_clicked)
|
|
||||||
self.define_cancel_button(self.top.get_object('cancel'))
|
|
||||||
self.define_help_button(self.top.get_object("help"))
|
|
||||||
|
|
||||||
def _connect_db_signals(self):
|
|
||||||
"""
|
|
||||||
Connect any signals that need to be connected.
|
|
||||||
Called by the init routine of the base class (_EditPrimary).
|
|
||||||
"""
|
|
||||||
self._add_db_signal('source-rebuild', self.close)
|
|
||||||
self._add_db_signal('source-delete', self.check_for_close)
|
|
||||||
#note: at the moment, a source cannot be updated while an editor with
|
|
||||||
# that source shown is open. So no need to connect to source-update
|
|
||||||
|
|
||||||
def _setup_fields(self):
|
|
||||||
self.ref_privacy = PrivacyButton(
|
|
||||||
self.top.get_object('privacy'), self.source_ref, self.db.readonly)
|
|
||||||
|
|
||||||
self.volume = MonitoredEntry(
|
|
||||||
self.top.get_object("volume"), self.source_ref.set_page,
|
|
||||||
self.source_ref.get_page, self.db.readonly)
|
|
||||||
|
|
||||||
self.gid = MonitoredEntry(
|
|
||||||
self.top.get_object('gid'), self.source.set_gramps_id,
|
|
||||||
self.source.get_gramps_id,self.db.readonly)
|
|
||||||
|
|
||||||
self.source_privacy = PrivacyButton(
|
|
||||||
self.top.get_object("private"),
|
|
||||||
self.source, self.db.readonly)
|
|
||||||
|
|
||||||
self.title = MonitoredEntry(
|
|
||||||
self.top.get_object('title'),
|
|
||||||
self.source.set_title,
|
|
||||||
self.source.get_title,
|
|
||||||
self.db.readonly)
|
|
||||||
|
|
||||||
self.abbrev = MonitoredEntry(
|
|
||||||
self.top.get_object('abbrev'), self.source.set_abbreviation,
|
|
||||||
self.source.get_abbreviation,self.db.readonly)
|
|
||||||
|
|
||||||
self.author = MonitoredEntry(
|
|
||||||
self.top.get_object('author'), self.source.set_author,
|
|
||||||
self.source.get_author,self.db.readonly)
|
|
||||||
|
|
||||||
self.pubinfo = MonitoredEntry(
|
|
||||||
self.top.get_object('pub_info'), self.source.set_publication_info,
|
|
||||||
self.source.get_publication_info,self.db.readonly)
|
|
||||||
|
|
||||||
self.type_mon = MonitoredMenu(
|
|
||||||
self.top.get_object('confidence'),
|
|
||||||
self.source_ref.set_confidence_level,
|
|
||||||
self.source_ref.get_confidence_level, [
|
|
||||||
(_('Very Low'), gen.lib.SourceRef.CONF_VERY_LOW),
|
|
||||||
(_('Low'), gen.lib.SourceRef.CONF_LOW),
|
|
||||||
(_('Normal'), gen.lib.SourceRef.CONF_NORMAL),
|
|
||||||
(_('High'), gen.lib.SourceRef.CONF_HIGH),
|
|
||||||
(_('Very High'), gen.lib.SourceRef.CONF_VERY_HIGH)],
|
|
||||||
self.db.readonly)
|
|
||||||
|
|
||||||
self.date = MonitoredDate(
|
|
||||||
self.top.get_object("date_entry"),
|
|
||||||
self.top.get_object("date_stat"),
|
|
||||||
self.source_ref.get_date_object(),
|
|
||||||
self.uistate,
|
|
||||||
self.track,
|
|
||||||
self.db.readonly)
|
|
||||||
|
|
||||||
def _create_tabbed_pages(self):
|
|
||||||
"""
|
|
||||||
Create the notebook tabs and inserts them into the main
|
|
||||||
window.
|
|
||||||
"""
|
|
||||||
notebook_src = self.top.get_object('notebook_src')
|
|
||||||
notebook_ref = self.top.get_object('notebook_ref')
|
|
||||||
|
|
||||||
self._add_tab(notebook_src, self.primtab)
|
|
||||||
self._add_tab(notebook_ref, self.reftab)
|
|
||||||
|
|
||||||
self.note_tab = NoteTab(self.dbstate, self.uistate, self.track,
|
|
||||||
self.source.get_note_list(),
|
|
||||||
notetype=gen.lib.NoteType.SOURCE)
|
|
||||||
self._add_tab(notebook_src, self.note_tab)
|
|
||||||
self.track_ref_for_deletion("note_tab")
|
|
||||||
|
|
||||||
self.gallery_tab = GalleryTab(self.dbstate, self.uistate, self.track,
|
|
||||||
self.source.get_media_list())
|
|
||||||
self._add_tab(notebook_src, self.gallery_tab)
|
|
||||||
self.track_ref_for_deletion("gallery_tab")
|
|
||||||
|
|
||||||
self.data_tab = DataEmbedList(self.dbstate, self.uistate, self.track,
|
|
||||||
self.source)
|
|
||||||
self._add_tab(notebook_src, self.data_tab)
|
|
||||||
self.track_ref_for_deletion("data_tab")
|
|
||||||
|
|
||||||
self.repo_tab = RepoEmbedList(self.dbstate, self.uistate, self.track,
|
|
||||||
self.source.get_reporef_list())
|
|
||||||
self._add_tab(notebook_src, self.repo_tab)
|
|
||||||
self.track_ref_for_deletion("repo_tab")
|
|
||||||
|
|
||||||
self.srcref_list = SourceBackRefList(self.dbstate,self.uistate, self.track,
|
|
||||||
self.db.find_backlink_handles(self.source.handle),
|
|
||||||
self.enable_warnbox
|
|
||||||
)
|
|
||||||
self._add_tab(notebook_src, self.srcref_list)
|
|
||||||
self.track_ref_for_deletion("srcref_list")
|
|
||||||
|
|
||||||
self.comment_tab = NoteTab(self.dbstate, self.uistate, self.track,
|
|
||||||
self.source_ref.get_note_list(),
|
|
||||||
notetype=gen.lib.NoteType.SOURCEREF)
|
|
||||||
self._add_tab(notebook_ref, self.comment_tab)
|
|
||||||
self.track_ref_for_deletion("comment_tab")
|
|
||||||
|
|
||||||
self._setup_notebook_tabs( notebook_src)
|
|
||||||
self._setup_notebook_tabs( notebook_ref)
|
|
||||||
|
|
||||||
def build_menu_names(self,sourceref):
|
|
||||||
if self.source:
|
|
||||||
source_name = self.source.get_title()
|
|
||||||
submenu_label = _('Source: %s') % source_name
|
|
||||||
else:
|
|
||||||
submenu_label = _('New Source')
|
|
||||||
return (_('Source Reference Editor'),submenu_label)
|
|
||||||
|
|
||||||
def ok_clicked(self, obj):
|
|
||||||
|
|
||||||
if self.source.handle:
|
|
||||||
with DbTxn(_("Modify Source"), self.db) as trans:
|
|
||||||
self.db.commit_source(self.source,trans)
|
|
||||||
else:
|
|
||||||
with DbTxn(_("Add Source"), self.db) as trans:
|
|
||||||
self.db.add_source(self.source,trans)
|
|
||||||
|
|
||||||
if self.update:
|
|
||||||
self.update(self.source_ref,self.source)
|
|
||||||
|
|
||||||
self.close()
|
|
@ -110,10 +110,10 @@ MIME2GED = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QUALITY_MAP = {
|
QUALITY_MAP = {
|
||||||
gen.lib.SourceRef.CONF_VERY_HIGH : "3",
|
gen.lib.Citation.CONF_VERY_HIGH : "3",
|
||||||
gen.lib.SourceRef.CONF_HIGH : "2",
|
gen.lib.Citation.CONF_HIGH : "2",
|
||||||
gen.lib.SourceRef.CONF_LOW : "1",
|
gen.lib.Citation.CONF_LOW : "1",
|
||||||
gen.lib.SourceRef.CONF_VERY_LOW : "0",
|
gen.lib.Citation.CONF_VERY_LOW : "0",
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -1310,8 +1310,8 @@ class GedcomWriter(UpdateCallback):
|
|||||||
|
|
||||||
|
|
||||||
conf = min(citation.get_confidence_level(),
|
conf = min(citation.get_confidence_level(),
|
||||||
gen.lib.SourceRef.CONF_VERY_HIGH)
|
gen.lib.Citation.CONF_VERY_HIGH)
|
||||||
if conf != gen.lib.SourceRef.CONF_NORMAL and conf != -1:
|
if conf != gen.lib.Citation.CONF_NORMAL and conf != -1:
|
||||||
self.__writeln(level+1, "QUAY", QUALITY_MAP[conf])
|
self.__writeln(level+1, "QUAY", QUALITY_MAP[conf])
|
||||||
|
|
||||||
if not citation.get_date_object().is_empty():
|
if not citation.get_date_object().is_empty():
|
||||||
|
@ -1366,11 +1366,11 @@ class Narrator(object):
|
|||||||
:type translate_text: callable(str)
|
:type translate_text: callable(str)
|
||||||
:param get_endnote_numbers: A callable to use for getting a string
|
:param get_endnote_numbers: A callable to use for getting a string
|
||||||
representing endnote numbers.
|
representing endnote numbers.
|
||||||
The function takes a :class:`~gen.lib.srcbase,SourceBase` instance.
|
The function takes a :class:`~gen.lib.CitationBase` instance.
|
||||||
A typical return value from get_endnote_numbers() would be "2a" and
|
A typical return value from get_endnote_numbers() would be "2a" and
|
||||||
would represent a reference to an endnote in a document.
|
would represent a reference to an endnote in a document.
|
||||||
:type get_endnote_numbers:
|
:type get_endnote_numbers:
|
||||||
callable( :class:`~gen.lib.srcbase,SourceBase` )
|
callable( :class:`~gen.lib.CitationBase` )
|
||||||
"""
|
"""
|
||||||
self.__db = dbase
|
self.__db = dbase
|
||||||
self.__verbose = verbose
|
self.__verbose = verbose
|
||||||
|
Loading…
Reference in New Issue
Block a user