Citation refinements
svn: r18584
This commit is contained in:
parent
ef463c851e
commit
7d5eebfebc
@ -923,6 +923,9 @@ class SimpleAccess(object):
|
|||||||
return "%s: %s [%s]" % (_(object_class),
|
return "%s: %s [%s]" % (_(object_class),
|
||||||
self.title(obj),
|
self.title(obj),
|
||||||
self.gid(obj))
|
self.gid(obj))
|
||||||
|
elif isinstance(obj, gen.lib.Citation):
|
||||||
|
return "%s: [%s]" % (_(object_class),
|
||||||
|
self.gid(obj))
|
||||||
elif isinstance(obj, gen.lib.Place):
|
elif isinstance(obj, gen.lib.Place):
|
||||||
return "%s: %s [%s]" % (_(object_class),
|
return "%s: %s [%s]" % (_(object_class),
|
||||||
place_name(self.dbase,
|
place_name(self.dbase,
|
||||||
@ -965,10 +968,10 @@ class SimpleAccess(object):
|
|||||||
return "%s and %s" % (mother_text, father_text)
|
return "%s and %s" % (mother_text, father_text)
|
||||||
elif isinstance(obj, gen.lib.MediaObject):
|
elif isinstance(obj, gen.lib.MediaObject):
|
||||||
return obj.desc
|
return obj.desc
|
||||||
|
elif isinstance(obj, gen.lib.Citation):
|
||||||
|
return obj.gramps_id
|
||||||
elif isinstance(obj, gen.lib.Source):
|
elif isinstance(obj, gen.lib.Source):
|
||||||
return self.title(obj)
|
return self.title(obj)
|
||||||
elif isinstance(obj, gen.lib.Citation):
|
|
||||||
return self.page(obj)
|
|
||||||
elif isinstance(obj, gen.lib.Place):
|
elif isinstance(obj, gen.lib.Place):
|
||||||
return place_name(self.dbase, obj.handle)
|
return place_name(self.dbase, obj.handle)
|
||||||
elif isinstance(obj, gen.lib.Repository):
|
elif isinstance(obj, gen.lib.Repository):
|
||||||
|
@ -156,7 +156,7 @@ class SimpleTable(object):
|
|||||||
if (objclass == 'Filter' and
|
if (objclass == 'Filter' and
|
||||||
handle[0] in ['Person', 'Family', 'Place', 'Event',
|
handle[0] in ['Person', 'Family', 'Place', 'Event',
|
||||||
'Repository', 'Note', 'MediaObject',
|
'Repository', 'Note', 'MediaObject',
|
||||||
'Source']):
|
'Citation', 'Source']):
|
||||||
menu_item = gtk.MenuItem(_("See data not in Filter"))
|
menu_item = gtk.MenuItem(_("See data not in Filter"))
|
||||||
menu_item.connect("activate",
|
menu_item.connect("activate",
|
||||||
lambda widget: self.show_not_in_filter(handle[0]))
|
lambda widget: self.show_not_in_filter(handle[0]))
|
||||||
@ -178,7 +178,7 @@ class SimpleTable(object):
|
|||||||
"""
|
"""
|
||||||
Handle events on tables. obj is a treeview
|
Handle events on tables. obj is a treeview
|
||||||
"""
|
"""
|
||||||
from gui.editors import (EditPerson, EditEvent, EditFamily, EditSource,
|
from gui.editors import (EditPerson, EditEvent, EditFamily, EditCitation, EditSource,
|
||||||
EditPlace, EditRepository, EditNote, EditMedia)
|
EditPlace, EditRepository, EditNote, EditMedia)
|
||||||
selection = obj.get_selection()
|
selection = obj.get_selection()
|
||||||
store, paths = selection.get_selected_rows()
|
store, paths = selection.get_selected_rows()
|
||||||
@ -219,6 +219,15 @@ class SimpleTable(object):
|
|||||||
return True # handled event
|
return True # handled event
|
||||||
except Errors.WindowActiveError:
|
except Errors.WindowActiveError:
|
||||||
pass
|
pass
|
||||||
|
elif objclass == 'Citation':
|
||||||
|
ref = self.access.dbase.get_citation_from_handle(handle)
|
||||||
|
if ref:
|
||||||
|
try:
|
||||||
|
EditCitation(self.simpledoc.doc.dbstate,
|
||||||
|
self.simpledoc.doc.uistate, [], ref)
|
||||||
|
return True # handled event
|
||||||
|
except Errors.WindowActiveError:
|
||||||
|
pass
|
||||||
elif objclass == 'Source':
|
elif objclass == 'Source':
|
||||||
ref = self.access.dbase.get_source_from_handle(handle)
|
ref = self.access.dbase.get_source_from_handle(handle)
|
||||||
if ref:
|
if ref:
|
||||||
@ -349,14 +358,14 @@ class SimpleTable(object):
|
|||||||
retval.append(self.access.describe(item))
|
retval.append(self.access.describe(item))
|
||||||
if (self.__link_col == col or link is None):
|
if (self.__link_col == col or link is None):
|
||||||
link = ('Family', item.handle)
|
link = ('Family', item.handle)
|
||||||
elif isinstance(item, gen.lib.Source):
|
|
||||||
retval.append(self.access.describe(item))
|
|
||||||
if (self.__link_col == col or link is None):
|
|
||||||
link = ('Source', item.handle)
|
|
||||||
elif isinstance(item, gen.lib.Citation):
|
elif isinstance(item, gen.lib.Citation):
|
||||||
retval.append(self.access.describe(item))
|
retval.append(self.access.describe(item))
|
||||||
if (self.__link_col == col or link is None):
|
if (self.__link_col == col or link is None):
|
||||||
link = ('Citation', item.handle)
|
link = ('Citation', item.handle)
|
||||||
|
elif isinstance(item, gen.lib.Source):
|
||||||
|
retval.append(self.access.describe(item))
|
||||||
|
if (self.__link_col == col or link is None):
|
||||||
|
link = ('Source', item.handle)
|
||||||
elif isinstance(item, gen.lib.Event):
|
elif isinstance(item, gen.lib.Event):
|
||||||
retval.append(self.access.describe(item))
|
retval.append(self.access.describe(item))
|
||||||
if (self.__link_col == col or link is None):
|
if (self.__link_col == col or link is None):
|
||||||
|
@ -78,7 +78,7 @@
|
|||||||
<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
|
<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
|
||||||
<li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#tab-events">Events</a></li>
|
<li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#tab-events">Events</a></li>
|
||||||
<li class="ui-corner-top ui-state-default"><a href="#tab-names">Names</a></li>
|
<li class="ui-corner-top ui-state-default"><a href="#tab-names">Names</a></li>
|
||||||
<li class="ui-corner-top ui-state-default"><a href="#tab-sources">Sources</a></li>
|
<li class="ui-corner-top ui-state-default"><a href="#tab-citations">Citations</a></li>
|
||||||
<li class="ui-corner-top ui-state-default"><a href="#tab-attributes">Attributes</a></li>
|
<li class="ui-corner-top ui-state-default"><a href="#tab-attributes">Attributes</a></li>
|
||||||
<li class="ui-corner-top ui-state-default"><a href="#tab-addresses">Addresses</a></li>
|
<li class="ui-corner-top ui-state-default"><a href="#tab-addresses">Addresses</a></li>
|
||||||
<li class="ui-corner-top ui-state-default"><a href="#tab-notes">Notes</a></li>
|
<li class="ui-corner-top ui-state-default"><a href="#tab-notes">Notes</a></li>
|
||||||
@ -95,8 +95,8 @@
|
|||||||
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-names">
|
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-names">
|
||||||
{% name_table person user action "/person/%s/name" person.handle %}
|
{% name_table person user action "/person/%s/name" person.handle %}
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-sources">
|
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-citations">
|
||||||
{% source_table person user action "/person/%s/source" person.handle %}
|
{% citation_table person user action "/person/%s/citation" person.handle %}
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-attributes">
|
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-attributes">
|
||||||
{% attribute_table person user action "/person/%s/attribute" person.handle %}
|
{% attribute_table person user action "/person/%s/attribute" person.handle %}
|
||||||
|
@ -257,8 +257,8 @@ def name_table(obj, user, action, url=None, *args):
|
|||||||
links = []
|
links = []
|
||||||
for name in obj.name_set.all().order_by("order"):
|
for name in obj.name_set.all().order_by("order"):
|
||||||
obj_type = ContentType.objects.get_for_model(name)
|
obj_type = ContentType.objects.get_for_model(name)
|
||||||
sourceq = dji.SourceRef.filter(object_type=obj_type,
|
citationq = dji.CitationRef.filter(object_type=obj_type,
|
||||||
object_id=name.id).count() > 0
|
object_id=name.id).count() > 0
|
||||||
note_refs = dji.NoteRef.filter(object_type=obj_type,
|
note_refs = dji.NoteRef.filter(object_type=obj_type,
|
||||||
object_id=name.id)
|
object_id=name.id)
|
||||||
note = ""
|
note = ""
|
||||||
@ -270,7 +270,7 @@ def name_table(obj, user, action, url=None, *args):
|
|||||||
table.row(make_name(name, user),
|
table.row(make_name(name, user),
|
||||||
str(name.name_type) + ["", " (preferred)"][int(name.preferred)],
|
str(name.name_type) + ["", " (preferred)"][int(name.preferred)],
|
||||||
name.group_as,
|
name.group_as,
|
||||||
["No", "Yes"][sourceq],
|
["No", "Yes"][citationq],
|
||||||
note)
|
note)
|
||||||
links.append(('URL',
|
links.append(('URL',
|
||||||
# url is "/person/%s/name"
|
# url is "/person/%s/name"
|
||||||
@ -292,15 +292,17 @@ def source_table(obj, user, action, url=None, *args):
|
|||||||
_("Page"))
|
_("Page"))
|
||||||
if user.is_authenticated():
|
if user.is_authenticated():
|
||||||
obj_type = ContentType.objects.get_for_model(obj)
|
obj_type = ContentType.objects.get_for_model(obj)
|
||||||
source_refs = dji.SourceRef.filter(object_type=obj_type,
|
citation_refs = dji.CitationRef.filter(object_type=obj_type,
|
||||||
object_id=obj.id)
|
object_id=obj.id)
|
||||||
for source_ref in source_refs:
|
for citation_ref in citation_refs:
|
||||||
source = table.db.get_source_from_handle(source_ref.ref_object.handle)
|
if citation_ref.citation:
|
||||||
table.row(source,
|
if citation_ref.citation.source:
|
||||||
source_ref.ref_object.title,
|
source = citation_ref.citation.source
|
||||||
source_ref.ref_object.author,
|
table.row(source,
|
||||||
source_ref.page,
|
source_ref.ref_object.title,
|
||||||
)
|
source_ref.ref_object.author,
|
||||||
|
source_ref.page,
|
||||||
|
)
|
||||||
retval += table.get_html()
|
retval += table.get_html()
|
||||||
if user.is_authenticated() and url and action == "view":
|
if user.is_authenticated() and url and action == "view":
|
||||||
retval += make_button(_("Add source"), (url + "/add") % args)
|
retval += make_button(_("Add source"), (url + "/add") % args)
|
||||||
@ -319,11 +321,12 @@ def citation_table(obj, user, action, url=None, *args):
|
|||||||
citation_refs = dji.CitationRef.filter(object_type=obj_type,
|
citation_refs = dji.CitationRef.filter(object_type=obj_type,
|
||||||
object_id=obj.id)
|
object_id=obj.id)
|
||||||
for citation_ref in citation_refs:
|
for citation_ref in citation_refs:
|
||||||
citation = table.db.get_citation_from_handle(citation_ref.citation.handle)
|
if citation_ref.citation:
|
||||||
table.row(citation,
|
citation = citation_ref.citation
|
||||||
citation.confidence,
|
table.row(citation,
|
||||||
citation.page,
|
str(citation.confidence),
|
||||||
)
|
str(citation.page),
|
||||||
|
)
|
||||||
retval += table.get_html()
|
retval += table.get_html()
|
||||||
if user.is_authenticated() and url and action == "view":
|
if user.is_authenticated() and url and action == "view":
|
||||||
retval += make_button(_("Add citation"), (url + "/add") % args)
|
retval += make_button(_("Add citation"), (url + "/add") % args)
|
||||||
|
Loading…
Reference in New Issue
Block a user