* src/AttrEdit.py: don't used reserved word "list"

* src/EditPerson.py: Pass correct attribute list to editor
* src/GrampsBSDDB.py: persistently load/save attribute lists
* src/GrampsDbBase.py: update attributes on commit
* src/Marriage.py: Pass correct attribute list to editor


svn: r5017
This commit is contained in:
Don Allingham 2005-08-04 20:46:41 +00:00
parent db62a824fb
commit ac235ff7be
6 changed files with 35 additions and 12 deletions

View File

@ -1,3 +1,10 @@
2005-08-04 Don Allingham <don@gramps-project.org>
* src/AttrEdit.py: don't used reserved word "list"
* src/EditPerson.py: Pass correct attribute list to editor
* src/GrampsBSDDB.py: persistently load/save attribute lists
* src/GrampsDbBase.py: update attributes on commit
* src/Marriage.py: Pass correct attribute list to editor
2005-08-04 Alex Roitman <shura@gramps-project.org>
* NEWS: Update.
* src/MergePeople.py: Typos.

View File

@ -64,7 +64,7 @@ class AttributeEditor:
"""
Displays a dialog that allows the user to edit an attribute.
"""
def __init__(self, parent, attrib, title, list, callback,
def __init__(self, parent, attrib, title, data_list, callback,
parent_window=None):
"""
Displays the dialog box.
@ -88,7 +88,7 @@ class AttributeEditor:
self.attrib = attrib
self.callback = callback
self.child_windows = {}
self.alist = list
self.alist = data_list
self.top = gtk.glade.XML(const.dialogFile, "attr_edit","gramps")
self.slist = self.top.get_widget("slist")
@ -122,7 +122,7 @@ class AttributeEditor:
l = self.top.get_widget("title")
Utils.set_titles(self.window,l,title,_('Attribute Editor'))
AutoComp.fill_combo(self.attrib_menu,list)
AutoComp.fill_combo(self.attrib_menu,data_list)
if attrib != None:
self.type_field.set_text(const.display_attr(attrib.get_type()))

View File

@ -28,6 +28,7 @@
import cPickle as pickle
import os
import locale
import sets
from gettext import gettext as _
#-------------------------------------------------------------------------
@ -1182,8 +1183,9 @@ class EditPerson:
"""Brings up the AttributeEditor for a new attribute"""
import AttrEdit
pname = self.nd.display(self.person)
AttrEdit.AttributeEditor(self,None,pname,const.personalAttributes,
self.attr_edit_callback,self.window)
attr_list = list(sets.Set(const.personalAttributes + self.db.get_person_attribute_types()))
AttrEdit.AttributeEditor(
self,None,pname, attr_list, self.attr_edit_callback,self.window)
def on_up_clicked(self,obj):
sel = obj.get_selection()
@ -1465,7 +1467,8 @@ class EditPerson:
if node:
attr = self.atree.get_object(node)
pname = self.nd.display(self.person)
AttrEdit.AttributeEditor(self,attr,pname,const.personalAttributes,
attr_list = list(sets.Set(const.personalAttributes + self.db.get_person_attribute_types()))
AttrEdit.AttributeEditor(self,attr,pname,attr_list,
self.attr_edit_callback,self.window)
def on_update_addr_clicked(self,obj):

View File

@ -186,6 +186,8 @@ class GrampsBSDDB(GrampsDbBase):
self.bookmarks = self.metadata.get('bookmarks')
self.family_event_names = sets.Set(self.metadata.get('fevent_names',[]))
self.individual_event_names = sets.Set(self.metadata.get('pevent_names',[]))
self.family_attributes = sets.Set(self.metadata.get('fattr_names',[]))
self.individual_attributes = sets.Set(self.metadata.get('pattr_names',[]))
gstats = self.metadata.get('gender_stats')
@ -314,6 +316,8 @@ class GrampsBSDDB(GrampsDbBase):
self.metadata['gender_stats'] = self.genderStats.save_stats()
self.metadata['fevent_names'] = list(self.family_event_names)
self.metadata['pevent_names'] = list(self.individual_event_names)
self.metadata['fattr_names'] = list(self.family_attributes)
self.metadata['pattr_names'] = list(self.individual_attributes)
self.metadata.close()
self.surnames.close()
self.id_trans.close()

View File

@ -155,6 +155,8 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
self.family_event_names = sets.Set()
self.individual_event_names = sets.Set()
self.individual_attributes = sets.Set()
self.family_attributes = sets.Set()
self.set_person_id_prefix(GrampsKeys.get_person_id_prefix())
self.set_object_id_prefix(GrampsKeys.get_object_id_prefix())
@ -298,6 +300,9 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
else:
self.genderStats.count_person(person,self)
for attr in person.attribute_list:
self.individual_attributes.add(attr.type)
self.person_map[handle] = person.serialize()
if old_data:
self.emit('person-update',([handle],))
@ -409,6 +414,9 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
transaction.add(FAMILY_KEY,handle,old_data)
self.family_map[handle] = family.serialize()
for attr in family.attribute_list:
self.family_attributes.add(attr.type)
if old_data:
self.emit('family-update',([handle],))
else:
@ -1137,12 +1145,12 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
def get_person_attribute_types(self):
"""returns a list of all Attribute types assocated with Person
instances in the database"""
return []
return list(self.individual_attributes)
def get_family_attribute_types(self):
"""returns a list of all Attribute types assocated with Family
instances in the database"""
return []
return list(self.family_attributes)
def get_family_event_types(self):
"""returns a list of all Event types assocated with Family

View File

@ -27,6 +27,7 @@
#-------------------------------------------------------------------------
import cPickle as pickle
from gettext import gettext as _
import sets
#-------------------------------------------------------------------------
#
@ -814,9 +815,9 @@ class Marriage:
name = NameDisplay.displayer.display(father)
else:
name = NameDisplay.displayer.display(mother)
attr_list = list(sets.Set(const.familyAttributes + self.db.get_family_attribute_types()))
AttrEdit.AttributeEditor(
self, attr, name, const.familyAttributes,
self.attr_edit_callback, self.window)
self, attr, name, attr_list, self.attr_edit_callback, self.window)
def on_delete_attr_clicked(self,obj):
if Utils.delete_selected(obj,self.alist):
@ -837,9 +838,9 @@ class Marriage:
name = NameDisplay.displayer.display(father)
else:
name = NameDisplay.displayer.display(mother)
attr_list = list(sets.Set(const.familyAttributes + self.db.get_family_attribute_types()))
AttrEdit.AttributeEditor(
self, None, name, const.familyAttributes,
self.attr_edit_callback, self.window)
self, None, name, attr_list, self.attr_edit_callback, self.window)
def move_element(self,list,src,dest):
if src == -1: