* src/FamilyView.py: fix reordering of children
* src/ChooseParents.py: get filters working again * src/AddSpouse.py: update display after addition of person * src/Utils.py: new id generation algorithm svn: r3245
This commit is contained in:
parent
29d18998d1
commit
3421c1971a
@ -1,3 +1,9 @@
|
|||||||
|
2004-06-29 Don Allingham <dallingham@users.sourceforge.net>
|
||||||
|
* src/FamilyView.py: fix reordering of children
|
||||||
|
* src/ChooseParents.py: get filters working again
|
||||||
|
* src/AddSpouse.py: update display after addition of person
|
||||||
|
* src/Utils.py: new id generation algorithm
|
||||||
|
|
||||||
2004-06-28 Don Allingham <dallingham@users.sourceforge.net>
|
2004-06-28 Don Allingham <dallingham@users.sourceforge.net>
|
||||||
* src/ChooseParents.py: fix parent selection
|
* src/ChooseParents.py: fix parent selection
|
||||||
* src/FamilyView.py: fix update of parents after selction
|
* src/FamilyView.py: fix update of parents after selction
|
||||||
|
@ -214,12 +214,28 @@ class AddSpouse:
|
|||||||
been closed.
|
been closed.
|
||||||
"""
|
"""
|
||||||
person = epo.person
|
person = epo.person
|
||||||
if person.get_id() == "":
|
trans = self.db.start_transaction()
|
||||||
self.db.add_person(person)
|
id = person.get_id()
|
||||||
|
if id == "":
|
||||||
|
id = self.db.add_person(person,trans)
|
||||||
else:
|
else:
|
||||||
self.db.add_person_no_map(person,person.get_id())
|
self.db.add_person_no_map(person,id,trans)
|
||||||
|
|
||||||
|
person = self.db.try_to_find_person_from_id(id)
|
||||||
|
n = person.get_primary_name().get_name()
|
||||||
|
self.db.add_transaction(trans,_('Add Person (%s)' % n))
|
||||||
self.addperson(person)
|
self.addperson(person)
|
||||||
self.update_data(person.get_id())
|
self.update_data(id)
|
||||||
|
|
||||||
|
self.slist = PeopleModel.PeopleModel(self.db)
|
||||||
|
self.slist.rebuild_data()
|
||||||
|
self.spouse_list.set_model(self.slist)
|
||||||
|
|
||||||
|
path = self.slist.on_get_path(person.get_id())
|
||||||
|
top_path = self.slist.on_get_path(person.get_primary_name().get_surname())
|
||||||
|
self.spouse_list.expand_row(top_path,0)
|
||||||
|
self.selection.select_path(path)
|
||||||
|
#self.spouse_list.scroll_to_cell(path,None,1,0.5,0)
|
||||||
#self.slist.center_selected()
|
#self.slist.center_selected()
|
||||||
|
|
||||||
def select_spouse_clicked(self,obj):
|
def select_spouse_clicked(self,obj):
|
||||||
|
@ -300,8 +300,18 @@ class ChooseParents:
|
|||||||
"""Redraws the potential father list"""
|
"""Redraws the potential father list"""
|
||||||
self.father_nsort = PeopleModel.PeopleModel(self.db)
|
self.father_nsort = PeopleModel.PeopleModel(self.db)
|
||||||
self.father_nsort.rebuild_data()
|
self.father_nsort.rebuild_data()
|
||||||
self.father_model = gtk.TreeModelSort(self.father_nsort)
|
self.father_nsort.reset_visible()
|
||||||
|
|
||||||
|
for pid in self.db.get_person_keys():
|
||||||
|
person = self.db.try_to_find_person_from_id(pid)
|
||||||
|
visible = self.father_filter(person)
|
||||||
|
if visible:
|
||||||
|
self.father_nsort.set_visible(pid,visible)
|
||||||
|
|
||||||
|
self.father_model = gtk.TreeModelSort(self.father_nsort).filter_new()
|
||||||
|
self.father_model.set_visible_column(PeopleModel.COLUMN_VIEW)
|
||||||
self.father_list.set_model(self.father_model)
|
self.father_list.set_model(self.father_model)
|
||||||
|
self.father_model.refilter()
|
||||||
|
|
||||||
if self.type == "Partners":
|
if self.type == "Partners":
|
||||||
self.flabel.set_label("<b>%s</b>" % _("Par_ent"))
|
self.flabel.set_label("<b>%s</b>" % _("Par_ent"))
|
||||||
@ -312,8 +322,18 @@ class ChooseParents:
|
|||||||
"""Redraws the potential mother list"""
|
"""Redraws the potential mother list"""
|
||||||
self.mother_nsort = PeopleModel.PeopleModel(self.db)
|
self.mother_nsort = PeopleModel.PeopleModel(self.db)
|
||||||
self.mother_nsort.rebuild_data()
|
self.mother_nsort.rebuild_data()
|
||||||
self.mother_model = gtk.TreeModelSort(self.mother_nsort)
|
self.mother_nsort.reset_visible()
|
||||||
|
|
||||||
|
for pid in self.db.get_person_keys():
|
||||||
|
person = self.db.try_to_find_person_from_id(pid)
|
||||||
|
visible = self.mother_filter(person)
|
||||||
|
if visible:
|
||||||
|
self.mother_nsort.set_visible(pid,visible)
|
||||||
|
|
||||||
|
self.mother_model = gtk.TreeModelSort(self.mother_nsort).filter_new()
|
||||||
|
self.mother_model.set_visible_column(PeopleModel.COLUMN_VIEW)
|
||||||
self.mother_list.set_model(self.mother_model)
|
self.mother_list.set_model(self.mother_model)
|
||||||
|
self.mother_model.refilter()
|
||||||
|
|
||||||
if self.type == "Partners":
|
if self.type == "Partners":
|
||||||
self.mlabel.set_label("<b>%s</b>" % _("Pa_rent"))
|
self.mlabel.set_label("<b>%s</b>" % _("Pa_rent"))
|
||||||
@ -547,8 +567,18 @@ class ChooseParents:
|
|||||||
self.parent_relation_changed(self.prel)
|
self.parent_relation_changed(self.prel)
|
||||||
elif person.get_gender() == RelLib.Person.male:
|
elif person.get_gender() == RelLib.Person.male:
|
||||||
self.redrawf()
|
self.redrawf()
|
||||||
|
path = self.father_model.on_get_path(id)
|
||||||
|
top_path = self.father_model.on_get_path(person.get_primary_name().get_surname())
|
||||||
|
self.father_list.expand_row(top_path,0)
|
||||||
|
self.father_selection.select_path(path)
|
||||||
|
self.father_list.scroll_to_cell(path,None,1,0.5,0)
|
||||||
else:
|
else:
|
||||||
self.redrawm()
|
self.redrawm()
|
||||||
|
path = self.mother_model.on_get_path(id)
|
||||||
|
top_path = self.mother_model.on_get_path(person.get_primary_name().get_surname())
|
||||||
|
self.mother_list.expand_row(top_path,0)
|
||||||
|
self.mother_selection.select_path(path)
|
||||||
|
self.mother_list.scroll_to_cell(path,None,1,0.5,0)
|
||||||
self.full_update()
|
self.full_update()
|
||||||
|
|
||||||
def add_parent_clicked(self,obj):
|
def add_parent_clicked(self,obj):
|
||||||
|
@ -1324,6 +1324,9 @@ class FamilyView:
|
|||||||
_("Children must be ordered by their birth dates."))
|
_("Children must be ordered by their birth dates."))
|
||||||
return
|
return
|
||||||
self.family.set_child_id_list(list)
|
self.family.set_child_id_list(list)
|
||||||
|
trans = self.parent.db.start_transaction()
|
||||||
|
self.parent.db.commit_family(self.family,trans)
|
||||||
|
self.parent.db.add_transaction(trans,_('Reorder children'))
|
||||||
self.display_marriage(self.family)
|
self.display_marriage(self.family)
|
||||||
|
|
||||||
def drag_data_get(self,widget, context, sel_data, info, time):
|
def drag_data_get(self,widget, context, sel_data, info, time):
|
||||||
|
30
src/Utils.py
30
src/Utils.py
@ -28,7 +28,6 @@
|
|||||||
import string
|
import string
|
||||||
import os
|
import os
|
||||||
import locale
|
import locale
|
||||||
import time
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -54,15 +53,6 @@ import GrampsMime
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# Random
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
import random
|
|
||||||
|
|
||||||
rand = random.Random(time.time())
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# modified flag
|
# modified flag
|
||||||
@ -537,7 +527,21 @@ def unbold_label(label):
|
|||||||
label.set_text(text)
|
label.set_text(text)
|
||||||
label.set_use_markup(0)
|
label.set_use_markup(0)
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# create_id
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
import random
|
||||||
|
import time
|
||||||
|
rand = random.Random(time.time())
|
||||||
|
|
||||||
def create_id():
|
def create_id():
|
||||||
return str("%08x%08x" % (
|
s = ""
|
||||||
int(time.time()*10000),
|
for val in [ int(time.time()*10000) & 0x7fffffff,
|
||||||
rand.randint(0,0x7fffffff)))
|
rand.randint(0,0x7fffffff),
|
||||||
|
rand.randint(0,0x7fffffff)]:
|
||||||
|
while val != 0:
|
||||||
|
s += chr(val%57+65)
|
||||||
|
val = int(val/57)
|
||||||
|
return s
|
||||||
|
Loading…
Reference in New Issue
Block a user