Enable Attributes gramplet support on Source/Citation bars; not backported yet because of #8144
This commit is contained in:
parent
660cf1b5af
commit
a36a2a36e6
@ -190,3 +190,59 @@ class MediaAttributes(Attributes):
|
|||||||
self.set_has_data(False)
|
self.set_has_data(False)
|
||||||
else:
|
else:
|
||||||
self.set_has_data(False)
|
self.set_has_data(False)
|
||||||
|
|
||||||
|
class SourceAttributes(Attributes):
|
||||||
|
"""
|
||||||
|
Displays the attributes of a source object.
|
||||||
|
"""
|
||||||
|
def db_changed(self):
|
||||||
|
self.dbstate.db.connect('source-update', self.update)
|
||||||
|
self.connect_signal('Source', self.update)
|
||||||
|
|
||||||
|
def update_has_data(self):
|
||||||
|
active_handle = self.get_active('Source')
|
||||||
|
if active_handle:
|
||||||
|
active = self.dbstate.db.get_source_from_handle(active_handle)
|
||||||
|
self.set_has_data(self.get_has_data(active))
|
||||||
|
else:
|
||||||
|
self.set_has_data(False)
|
||||||
|
|
||||||
|
def main(self):
|
||||||
|
self.model.clear()
|
||||||
|
active_handle = self.get_active('Source')
|
||||||
|
if active_handle:
|
||||||
|
active = self.dbstate.db.get_source_from_handle(active_handle)
|
||||||
|
if active:
|
||||||
|
self.display_attributes(active)
|
||||||
|
else:
|
||||||
|
self.set_has_data(False)
|
||||||
|
else:
|
||||||
|
self.set_has_data(False)
|
||||||
|
|
||||||
|
class CitationAttributes(Attributes):
|
||||||
|
"""
|
||||||
|
Displays the attributes of a citation object.
|
||||||
|
"""
|
||||||
|
def db_changed(self):
|
||||||
|
self.dbstate.db.connect('citation-update', self.update)
|
||||||
|
self.connect_signal('Citation', self.update)
|
||||||
|
|
||||||
|
def update_has_data(self):
|
||||||
|
active_handle = self.get_active('Citation')
|
||||||
|
if active_handle:
|
||||||
|
active = self.dbstate.db.get_citation_from_handle(active_handle)
|
||||||
|
self.set_has_data(self.get_has_data(active))
|
||||||
|
else:
|
||||||
|
self.set_has_data(False)
|
||||||
|
|
||||||
|
def main(self):
|
||||||
|
self.model.clear()
|
||||||
|
active_handle = self.get_active('Citation')
|
||||||
|
if active_handle:
|
||||||
|
active = self.dbstate.db.get_citation_from_handle(active_handle)
|
||||||
|
if active:
|
||||||
|
self.display_attributes(active)
|
||||||
|
else:
|
||||||
|
self.set_has_data(False)
|
||||||
|
else:
|
||||||
|
self.set_has_data(False)
|
||||||
|
@ -604,6 +604,34 @@ register(GRAMPLET,
|
|||||||
navtypes=["Media"],
|
navtypes=["Media"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
register(GRAMPLET,
|
||||||
|
id="Source Attributes",
|
||||||
|
name=_("Source Attributes"),
|
||||||
|
description = _("Gramplet showing the attributes of a source object"),
|
||||||
|
version="1.0.0",
|
||||||
|
gramps_target_version=MODULE_VERSION,
|
||||||
|
status = STABLE,
|
||||||
|
fname="attributes.py",
|
||||||
|
height=200,
|
||||||
|
gramplet = 'SourceAttributes',
|
||||||
|
gramplet_title=_("Attributes"),
|
||||||
|
navtypes=["Source"],
|
||||||
|
)
|
||||||
|
|
||||||
|
register(GRAMPLET,
|
||||||
|
id="Citation Attributes",
|
||||||
|
name=_("Citation Attributes"),
|
||||||
|
description = _("Gramplet showing the attributes of a citation object"),
|
||||||
|
version="1.0.0",
|
||||||
|
gramps_target_version=MODULE_VERSION,
|
||||||
|
status = STABLE,
|
||||||
|
fname="attributes.py",
|
||||||
|
height=200,
|
||||||
|
gramplet = 'CitationAttributes',
|
||||||
|
gramplet_title=_("Attributes"),
|
||||||
|
navtypes=["Citation"],
|
||||||
|
)
|
||||||
|
|
||||||
register(GRAMPLET,
|
register(GRAMPLET,
|
||||||
id="Person Notes",
|
id="Person Notes",
|
||||||
name=_("Person Notes"),
|
name=_("Person Notes"),
|
||||||
|
Loading…
Reference in New Issue
Block a user