* src/ChooseParents.py: Fix widget sensitivity problem, assign

integer value instead of string to relationship type
* src/FamilyView.py: fix child relationship display value
* src/GrampsBSDDB.py: upgrade to DB version 4 (remove string
relationship types)


svn: r4152
This commit is contained in:
Don Allingham 2005-03-10 01:38:08 +00:00
parent ebedde9f09
commit b1b8d68b83
4 changed files with 49 additions and 17 deletions

View File

@ -1,4 +1,9 @@
2005-03-09 Don Allingham <don@gramps-project.org>
* src/ChooseParents.py: Fix widget sensitivity problem, assign
integer value instead of string to relationship type
* src/FamilyView.py: fix child relationship display value
* src/GrampsBSDDB.py: upgrade to DB version 4 (remove string
relationship types)
* src/EditPerson.py: call new_after_edit instead of update_after_edit
for new people.
* src/EditPerson.py: add srcref as a drag and drop item

View File

@ -418,16 +418,16 @@ class ChooseParents:
def save_parents_clicked(self,obj):
"""
Called with the OK button is pressed. Saves the selected people as parents
of the main perosn.
Called with the OK button is pressed. Saves the selected people
as parents of the main person.
"""
try:
mother_rel = self.keys[self.mcombo.get_active()]
mother_rel = self.mcombo.get_active()
except KeyError:
mother_rel = RelLib.Person.CHILD_REL_BIRTH
try:
father_rel = self.keys[self.fcombo.get_active()]
father_rel = self.fcombo.get_active()
except KeyError:
father_rel = RelLib.Person.CHILD_REL_BIRTH
@ -589,6 +589,8 @@ class ModifyParents:
self.father_rel = self.glade.get_widget("frel")
self.flabel = self.glade.get_widget("flabel")
self.mlabel = self.glade.get_widget("mlabel")
self.fcombo = self.glade.get_widget('fcombo')
self.mcombo = self.glade.get_widget('mcombo')
self.orig_mrel = RelLib.Person.CHILD_REL_BIRTH
self.orig_frel = RelLib.Person.CHILD_REL_BIRTH
@ -610,18 +612,17 @@ class ModifyParents:
self.mlabel.set_label('<b>%s</b>' % _("Mother"))
self.flabel.set_label('<b>%s</b>' % _("Father"))
if self.father:
fname = NameDisplay.displayer.display(self.father)
self.glade.get_widget("fname").set_text(fname)
else:
self.father_rel.set_sensitive(False)
self.fcombo.set_sensitive(False)
if self.mother:
mname = NameDisplay.displayer.display(self.mother)
self.glade.get_widget("mname").set_text(mname)
else:
self.mother_rel.set_sensitive(False)
self.mcombo.set_sensitive(False)
self.pref = self.glade.get_widget('preferred')
if len(self.person.get_parent_family_handle_list()) > 1:
@ -635,9 +636,6 @@ class ModifyParents:
if parent_window:
self.window.set_transient_for(parent_window)
self.fcombo = self.glade.get_widget('fcombo')
self.mcombo = self.glade.get_widget('mcombo')
if self.db.readonly:
self.fcombo.set_sensitive(False)
self.mcombo.set_sensitive(False)
@ -669,8 +667,8 @@ class ModifyParents:
def save_parents_clicked(self):
"""
Called with the OK button nis pressed. Saves the selected people as parents
of the main perosn.
Called with the OK button nis pressed. Saves the selected people
as parents of the main person.
"""
mother_rel = self.mcombo.get_active()

View File

@ -238,7 +238,8 @@ class FamilyView:
self.spouse_list.append_column(column)
self.selected_spouse = None
self.child_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,ACTION_COPY)
self.child_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,
pycode_tgts,ACTION_COPY)
self.child_list.drag_source_set(BUTTON1_MASK, pycode_tgts, ACTION_COPY)
self.child_list.connect('drag_data_get', self.drag_data_get)
self.child_list.connect('drag_data_received',self.drag_data_received)
@ -1065,8 +1066,11 @@ class FamilyView:
mother_handle = fam.get_mother_handle()
f = self.parent.db.get_person_from_handle(father_handle)
m = self.parent.db.get_person_from_handle(mother_handle)
father = self.nameof(_("Father"),f,frel)
mother = self.nameof(_("Mother"),m,mrel)
father = self.nameof(_("Father"),f,
const.child_rel_list[frel])
mother = self.nameof(_("Mother"),m,
const.child_rel_list[mrel])
node = model.append()
if not sel:

View File

@ -33,7 +33,7 @@ from RelLib import *
from GrampsDbBase import *
from bsddb import dbshelve, db
_DBVERSION = 3
_DBVERSION = 4
def find_surname(key,data):
return str(data[3].get_surname())
@ -407,4 +407,29 @@ class GrampsBSDDB(GrampsDbBase):
self.commit_person(person,None)
data = cursor.next()
cursor.close()
self.metadata['version'] = 3
if version < 4:
print "Upgrading to DB version 4"
cursor = self.get_person_cursor()
data = cursor.first()
while data:
handle,info = data
person = Person()
person.unserialize(info)
plist = person.get_parent_family_handle_list()
new_list = []
change = False
for (f,mrel,frel) in plist:
if type(mrel) == str:
mrel = child_rel_notrans.index(mrel)
change = True
if type(frel) == str:
frel = child_rel_notrans.index(frel)
change = True
new_list.append((f,mrel,frel))
if change:
person.parent_family_list = new_list
self.commit_person(person,None)
data = cursor.next()
cursor.close()
self.metadata['version'] = _DBVERSION