7960: Store custom event attribute types in the metadata
This commit is contained in:
parent
737e8eb74b
commit
643e742556
@ -257,6 +257,13 @@ class DbReadBase(object):
|
|||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def get_event_attribute_types(self):
|
||||||
|
"""
|
||||||
|
Return a list of all Attribute types assocated with Event instances
|
||||||
|
in the database.
|
||||||
|
"""
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
def get_event_types(self):
|
def get_event_types(self):
|
||||||
"""
|
"""
|
||||||
Return a list of all event types in the database.
|
Return a list of all event types in the database.
|
||||||
|
@ -1507,6 +1507,13 @@ class DbBsddbRead(DbReadBase, Callback):
|
|||||||
"""Set the save path for the database."""
|
"""Set the save path for the database."""
|
||||||
self.path = path
|
self.path = path
|
||||||
|
|
||||||
|
def get_event_attribute_types(self):
|
||||||
|
"""
|
||||||
|
Return a list of all Attribute types assocated with Event instances
|
||||||
|
in the database.
|
||||||
|
"""
|
||||||
|
return list(self.event_attributes)
|
||||||
|
|
||||||
def get_event_types(self):
|
def get_event_types(self):
|
||||||
"""
|
"""
|
||||||
Return a list of all event types in the database.
|
Return a list of all event types in the database.
|
||||||
|
@ -43,6 +43,7 @@ class DbTest(unittest.TestCase):
|
|||||||
"get_child_reference_types",
|
"get_child_reference_types",
|
||||||
"get_default_handle",
|
"get_default_handle",
|
||||||
"get_default_person",
|
"get_default_person",
|
||||||
|
"get_event_attribute_types",
|
||||||
"get_event_bookmarks",
|
"get_event_bookmarks",
|
||||||
"get_event_cursor",
|
"get_event_cursor",
|
||||||
"get_event_from_gramps_id",
|
"get_event_from_gramps_id",
|
||||||
|
@ -979,6 +979,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
|||||||
self.source_media_types = set(meta(b'sm_types'))
|
self.source_media_types = set(meta(b'sm_types'))
|
||||||
self.url_types = set(meta(b'url_types'))
|
self.url_types = set(meta(b'url_types'))
|
||||||
self.media_attributes = set(meta(b'mattr_names'))
|
self.media_attributes = set(meta(b'mattr_names'))
|
||||||
|
self.event_attributes = set(meta(b'eattr_names'))
|
||||||
|
|
||||||
# surname list
|
# surname list
|
||||||
self.surname_list = meta(b'surname_list')
|
self.surname_list = meta(b'surname_list')
|
||||||
@ -1450,6 +1451,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
|||||||
txn.put(b'sm_types', list(self.source_media_types))
|
txn.put(b'sm_types', list(self.source_media_types))
|
||||||
txn.put(b'url_types', list(self.url_types))
|
txn.put(b'url_types', list(self.url_types))
|
||||||
txn.put(b'mattr_names', list(self.media_attributes))
|
txn.put(b'mattr_names', list(self.media_attributes))
|
||||||
|
txn.put(b'eattr_names', list(self.event_attributes))
|
||||||
|
|
||||||
# name display formats
|
# name display formats
|
||||||
txn.put(b'surname_list', self.surname_list)
|
txn.put(b'surname_list', self.surname_list)
|
||||||
@ -2051,10 +2053,16 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
|||||||
Commit the specified Event to the database, storing the changes as
|
Commit the specified Event to the database, storing the changes as
|
||||||
part of the transaction.
|
part of the transaction.
|
||||||
"""
|
"""
|
||||||
if event.type.is_custom():
|
|
||||||
self.event_names.add(str(event.type))
|
|
||||||
self.commit_base(event, self.event_map, EVENT_KEY,
|
self.commit_base(event, self.event_map, EVENT_KEY,
|
||||||
transaction, change_time)
|
transaction, change_time)
|
||||||
|
|
||||||
|
self.event_attributes.update(
|
||||||
|
[str(attr.type) for attr in event.attribute_list
|
||||||
|
if attr.type.is_custom() and str(attr.type)])
|
||||||
|
|
||||||
|
if event.type.is_custom():
|
||||||
|
self.event_names.add(str(event.type))
|
||||||
|
|
||||||
attr_list = []
|
attr_list = []
|
||||||
for mref in event.media_list:
|
for mref in event.media_list:
|
||||||
attr_list += [str(attr.type) for attr in mref.attribute_list
|
attr_list += [str(attr.type) for attr in mref.attribute_list
|
||||||
|
@ -722,6 +722,11 @@ class ProxyDbBase(DbReadBase):
|
|||||||
"""returns the save path of the file, or "" if one does not exist"""
|
"""returns the save path of the file, or "" if one does not exist"""
|
||||||
return self.db.get_save_path()
|
return self.db.get_save_path()
|
||||||
|
|
||||||
|
def get_event_attribute_types(self):
|
||||||
|
"""returns a list of all Attribute types associated with Event
|
||||||
|
instances in the database"""
|
||||||
|
return self.db.get_event_attribute_types()
|
||||||
|
|
||||||
def get_event_types(self):
|
def get_event_types(self):
|
||||||
"""returns a list of all event types in the database"""
|
"""returns a list of all event types in the database"""
|
||||||
return self.db.get_event_types()
|
return self.db.get_event_types()
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
# gui/editors/__init__.py
|
# gui/editors/__init__.py
|
||||||
|
|
||||||
from .editaddress import EditAddress
|
from .editaddress import EditAddress
|
||||||
from .editattribute import EditAttribute, EditFamilyAttribute, EditSrcAttribute
|
from .editattribute import EditAttribute, EditSrcAttribute
|
||||||
from .editchildref import EditChildRef
|
from .editchildref import EditChildRef
|
||||||
from .editcitation import EditCitation, DeleteCitationQuery
|
from .editcitation import EditCitation, DeleteCitationQuery
|
||||||
from .editdate import EditDate
|
from .editdate import EditDate
|
||||||
|
@ -38,6 +38,7 @@ from .addrembedlist import AddrEmbedList
|
|||||||
from .altnameembedlist import AltNameEmbedList
|
from .altnameembedlist import AltNameEmbedList
|
||||||
from .attrembedlist import AttrEmbedList
|
from .attrembedlist import AttrEmbedList
|
||||||
from .backreflist import BackRefList
|
from .backreflist import BackRefList
|
||||||
|
from .eventattrembedlist import EventAttrEmbedList
|
||||||
from .eventbackreflist import EventBackRefList
|
from .eventbackreflist import EventBackRefList
|
||||||
from .eventembedlist import EventEmbedList
|
from .eventembedlist import EventEmbedList
|
||||||
from .familyattrembedlist import FamilyAttrEmbedList
|
from .familyattrembedlist import FamilyAttrEmbedList
|
||||||
|
43
gramps/gui/editors/displaytabs/eventattrembedlist.py
Normal file
43
gramps/gui/editors/displaytabs/eventattrembedlist.py
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Gramps classes
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from .attrembedlist import AttrEmbedList
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# EventAttrEmbedList
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class EventAttrEmbedList(AttrEmbedList):
|
||||||
|
|
||||||
|
def __init__(self, dbstate, uistate, track, data):
|
||||||
|
AttrEmbedList.__init__(self, dbstate, uistate, track, data)
|
||||||
|
|
||||||
|
def get_editor(self):
|
||||||
|
from .. import EditAttribute
|
||||||
|
return EditAttribute
|
||||||
|
|
||||||
|
def get_user_values(self):
|
||||||
|
return self.dbstate.db.get_event_attribute_types()
|
@ -36,8 +36,8 @@ class FamilyAttrEmbedList(AttrEmbedList):
|
|||||||
AttrEmbedList.__init__(self, dbstate, uistate, track, data)
|
AttrEmbedList.__init__(self, dbstate, uistate, track, data)
|
||||||
|
|
||||||
def get_editor(self):
|
def get_editor(self):
|
||||||
from .. import EditFamilyAttribute
|
from .. import EditAttribute
|
||||||
return EditFamilyAttribute
|
return EditAttribute
|
||||||
|
|
||||||
def get_user_values(self):
|
def get_user_values(self):
|
||||||
return self.dbstate.db.get_family_attribute_types()
|
return self.dbstate.db.get_family_attribute_types()
|
||||||
|
@ -49,7 +49,7 @@ from .objectentries import PlaceEntry
|
|||||||
from ..glade import Glade
|
from ..glade import Glade
|
||||||
from ..dialog import ErrorDialog
|
from ..dialog import ErrorDialog
|
||||||
from .displaytabs import (CitationEmbedList, NoteTab, GalleryTab,
|
from .displaytabs import (CitationEmbedList, NoteTab, GalleryTab,
|
||||||
EventBackRefList, AttrEmbedList)
|
EventBackRefList, EventAttrEmbedList)
|
||||||
from ..widgets import (MonitoredEntry, PrivacyButton, MonitoredDataType,
|
from ..widgets import (MonitoredEntry, PrivacyButton, MonitoredDataType,
|
||||||
MonitoredDate, MonitoredTagList)
|
MonitoredDate, MonitoredTagList)
|
||||||
from gramps.gen.utils.db import get_participant_from_event
|
from gramps.gen.utils.db import get_participant_from_event
|
||||||
@ -199,10 +199,10 @@ class EditEvent(EditPrimary):
|
|||||||
self.obj.get_media_list())
|
self.obj.get_media_list())
|
||||||
self._add_tab(notebook, self.gallery_list)
|
self._add_tab(notebook, self.gallery_list)
|
||||||
|
|
||||||
self.attr_list = AttrEmbedList(self.dbstate,
|
self.attr_list = EventAttrEmbedList(self.dbstate,
|
||||||
self.uistate,
|
self.uistate,
|
||||||
self.track,
|
self.track,
|
||||||
self.obj.get_attribute_list())
|
self.obj.get_attribute_list())
|
||||||
self._add_tab(notebook, self.attr_list)
|
self._add_tab(notebook, self.attr_list)
|
||||||
|
|
||||||
handle_list = self.dbstate.db.find_backlink_handles(self.obj.handle)
|
handle_list = self.dbstate.db.find_backlink_handles(self.obj.handle)
|
||||||
|
@ -547,6 +547,8 @@ class EditRule(ManagedWindow):
|
|||||||
additional = self.db.get_person_attribute_types()
|
additional = self.db.get_person_attribute_types()
|
||||||
elif v == _('Family attribute:'):
|
elif v == _('Family attribute:'):
|
||||||
additional = self.db.get_family_attribute_types()
|
additional = self.db.get_family_attribute_types()
|
||||||
|
elif v == _('Event attribute:'):
|
||||||
|
additional = self.db.get_event_attribute_types()
|
||||||
elif v == _('Media attribute:'):
|
elif v == _('Media attribute:'):
|
||||||
additional = self.db.get_media_attribute_types()
|
additional = self.db.get_media_attribute_types()
|
||||||
elif v == _('Relationship type:'):
|
elif v == _('Relationship type:'):
|
||||||
|
@ -291,6 +291,7 @@ gramps/gui/editors/displaytabs/childmodel.py
|
|||||||
gramps/gui/editors/displaytabs/citationbackreflist.py
|
gramps/gui/editors/displaytabs/citationbackreflist.py
|
||||||
gramps/gui/editors/displaytabs/citationrefmodel.py
|
gramps/gui/editors/displaytabs/citationrefmodel.py
|
||||||
gramps/gui/editors/displaytabs/datamodel.py
|
gramps/gui/editors/displaytabs/datamodel.py
|
||||||
|
gramps/gui/editors/displaytabs/eventattrembedlist.py
|
||||||
gramps/gui/editors/displaytabs/eventbackreflist.py
|
gramps/gui/editors/displaytabs/eventbackreflist.py
|
||||||
gramps/gui/editors/displaytabs/familyattrembedlist.py
|
gramps/gui/editors/displaytabs/familyattrembedlist.py
|
||||||
gramps/gui/editors/displaytabs/grampstab.py
|
gramps/gui/editors/displaytabs/grampstab.py
|
||||||
|
Loading…
x
Reference in New Issue
Block a user