* src/DataViews/_PedigreeView.py: Fix ChildRef, Show person references
* src/Editors/_EditFamily.py: Typo * src/GrampsDb/_GrampsDbBase.py (get_active_person): Handle case of no active person * src/plugins/TestcaseGenerator.py: really generate shared events; use new GrampsType; randomize name type * src/DataViews/_PersonView.py: DnD only for lines of persons; Fix set for python 2.3; fix get_parent_family_handle_list usage svn: r6342
This commit is contained in:
parent
2f16d73b53
commit
75e4f7b39b
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
2006-04-13 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
||||||
|
* src/DataViews/_PedigreeView.py: Fix ChildRef, Show person references
|
||||||
|
* src/Editors/_EditFamily.py: Typo
|
||||||
|
* src/GrampsDb/_GrampsDbBase.py (get_active_person): Handle case of no
|
||||||
|
active person
|
||||||
|
* src/plugins/TestcaseGenerator.py: really generate shared events; use
|
||||||
|
new GrampsType; randomize name type
|
||||||
|
* src/DataViews/_PersonView.py: DnD only for lines of persons; Fix set
|
||||||
|
for python 2.3; fix get_parent_family_handle_list usage
|
||||||
|
|
||||||
2006-04-13 Don Allingham <don@gramps-project.org>
|
2006-04-13 Don Allingham <don@gramps-project.org>
|
||||||
* src/DataViews/_FamilyView.py: Type class support
|
* src/DataViews/_FamilyView.py: Type class support
|
||||||
* src/DataViews/_PedigreeView.py: Type class support
|
* src/DataViews/_PedigreeView.py: Type class support
|
||||||
|
@ -990,7 +990,9 @@ class PedigreeView(PageView.PersonNavView):
|
|||||||
family = self.dbstate.db.get_family_from_handle(family_handle)
|
family = self.dbstate.db.get_family_from_handle(family_handle)
|
||||||
else: # no parents -> create new family
|
else: # no parents -> create new family
|
||||||
family = RelLib.Family()
|
family = RelLib.Family()
|
||||||
family.add_child_handle(person_handle)
|
childref = RelLib.ChildRef()
|
||||||
|
childref.set_reference_handle(person_handle)
|
||||||
|
family.add_child_ref(childref)
|
||||||
try:
|
try:
|
||||||
EditFamily(self.dbstate,self.uistate,[],family)
|
EditFamily(self.dbstate,self.uistate,[],family)
|
||||||
except Errors.WindowActiveError:
|
except Errors.WindowActiveError:
|
||||||
@ -1540,23 +1542,26 @@ def find_witnessed_people(db,p):
|
|||||||
people = []
|
people = []
|
||||||
for event_ref in p.get_event_ref_list():
|
for event_ref in p.get_event_ref_list():
|
||||||
for l in db.find_backlink_handles( event_ref.ref):
|
for l in db.find_backlink_handles( event_ref.ref):
|
||||||
if l[0] == 'Person' and l[1] != p.get_handle():
|
if l[0] == 'Person' and l[1] != p.get_handle() and l[1] not in people:
|
||||||
people.append(l[1])
|
people.append(l[1])
|
||||||
if l[0] == 'Family':
|
if l[0] == 'Family':
|
||||||
fam = db.get_family_from_handle(l[1])
|
fam = db.get_family_from_handle(l[1])
|
||||||
if fam:
|
if fam:
|
||||||
father_handle = fam.get_father_handle()
|
father_handle = fam.get_father_handle()
|
||||||
if father_handle and father_handle != p.get_handle():
|
if father_handle and father_handle != p.get_handle() and father_handle not in people:
|
||||||
people.append(father_handle)
|
people.append(father_handle)
|
||||||
mother_handle = fam.get_mother_handle()
|
mother_handle = fam.get_mother_handle()
|
||||||
if mother_handle and mother_handle != p.get_handle():
|
if mother_handle and mother_handle != p.get_handle() and mother_handle not in people:
|
||||||
people.append(mother_handle)
|
people.append(mother_handle)
|
||||||
for f in p.get_family_handle_list():
|
for f in p.get_family_handle_list():
|
||||||
family = db.get_family_from_handle(f)
|
family = db.get_family_from_handle(f)
|
||||||
for event_ref in family.get_event_ref_list():
|
for event_ref in family.get_event_ref_list():
|
||||||
for l in db.find_backlink_handles( event_ref.ref):
|
for l in db.find_backlink_handles( event_ref.ref):
|
||||||
if l[0] == 'Person' and l[1] != p.get_handle():
|
if l[0] == 'Person' and l[1] != p.get_handle() and l[1] not in people:
|
||||||
people.append(l[1])
|
people.append(l[1])
|
||||||
|
for pref in p.get_person_ref_list():
|
||||||
|
if pref.ref != p.get_handle and pref.ref not in people:
|
||||||
|
people.append(pref.ref)
|
||||||
return people
|
return people
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
@ -30,6 +30,11 @@
|
|||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
import cPickle as pickle
|
import cPickle as pickle
|
||||||
|
|
||||||
|
try:
|
||||||
|
set()
|
||||||
|
except:
|
||||||
|
from sets import Set as set
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# gtk
|
# gtk
|
||||||
@ -431,7 +436,7 @@ class PersonView(PageView.PersonNavView):
|
|||||||
else:
|
else:
|
||||||
self.dbstate.db.commit_family(family,trans)
|
self.dbstate.db.commit_family(family,trans)
|
||||||
|
|
||||||
for (family_handle,mrel,frel) in self.active_person.get_parent_family_handle_list():
|
for family_handle in self.active_person.get_parent_family_handle_list():
|
||||||
if family_handle:
|
if family_handle:
|
||||||
family = self.dbstate.db.get_family_from_handle(family_handle)
|
family = self.dbstate.db.get_family_from_handle(family_handle)
|
||||||
family.remove_child_handle(self.active_person.get_handle())
|
family.remove_child_handle(self.active_person.get_handle())
|
||||||
@ -504,10 +509,10 @@ class PersonView(PageView.PersonNavView):
|
|||||||
|
|
||||||
def drag_data_get(self, widget, context, sel_data, info, time):
|
def drag_data_get(self, widget, context, sel_data, info, time):
|
||||||
selected_ids = self.get_selected_objects()
|
selected_ids = self.get_selected_objects()
|
||||||
|
nonempty_ids = [h for h in selected_ids if h]
|
||||||
data = (DdTargets.PERSON_LINK.drag_type, id(self), selected_ids[0], 0)
|
if nonempty_ids:
|
||||||
|
data = (DdTargets.PERSON_LINK.drag_type, id(self), nonempty_ids[0], 0)
|
||||||
sel_data.set(sel_data.target, 8 ,pickle.dumps(data))
|
sel_data.set(sel_data.target, 8 ,pickle.dumps(data))
|
||||||
|
|
||||||
def person_added(self,handle_list):
|
def person_added(self,handle_list):
|
||||||
self.model.clear_cache()
|
self.model.clear_cache()
|
||||||
|
@ -826,9 +826,9 @@ class EditFamily(EditPrimary):
|
|||||||
|
|
||||||
# for each child, add the family handle to the child
|
# for each child, add the family handle to the child
|
||||||
for ref in self.obj.get_child_ref_list():
|
for ref in self.obj.get_child_ref_list():
|
||||||
child = self.db.get_person_from_handle(handle)
|
child = self.db.get_person_from_handle(ref.ref)
|
||||||
# fix - relationships need to be extracted from the list
|
# fix - relationships need to be extracted from the list
|
||||||
child.add_parent_family_ref(ref)
|
child.add_parent_family_handle(self.obj.handle)
|
||||||
self.db.commit_person(child,trans)
|
self.db.commit_person(child,trans)
|
||||||
|
|
||||||
self.db.add_family(self.obj,trans)
|
self.db.add_family(self.obj,trans)
|
||||||
@ -878,4 +878,3 @@ class EditFamily(EditPrimary):
|
|||||||
self.db.transaction_commit(trans,_("Edit Family"))
|
self.db.transaction_commit(trans,_("Edit Family"))
|
||||||
|
|
||||||
self.close_window()
|
self.close_window()
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ from this class.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
__author__ = "Donald N. Allingham"
|
__author__ = "Donald N. Allingham"
|
||||||
__revision__ = "$Revision:$"
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -2072,7 +2072,8 @@ class DbState(GrampsDBCallback):
|
|||||||
self.change_active_person(self.db.get_person_from_handle(handle))
|
self.change_active_person(self.db.get_person_from_handle(handle))
|
||||||
|
|
||||||
def get_active_person(self):
|
def get_active_person(self):
|
||||||
self.active = self.db.get_person_from_handle(self.active.handle)
|
if self.active: # Fetch a fresh version from DB to not return a stale one
|
||||||
|
self.active = self.db.get_person_from_handle(self.active.handle)
|
||||||
return self.active
|
return self.active
|
||||||
|
|
||||||
def change_database(self, database):
|
def change_database(self, database):
|
||||||
@ -2097,4 +2098,3 @@ class DbState(GrampsDBCallback):
|
|||||||
|
|
||||||
def get_place_completion(self):
|
def get_place_completion(self):
|
||||||
return self.places
|
return self.places
|
||||||
|
|
||||||
|
@ -821,10 +821,11 @@ class TestcaseGenerator(Tool.Tool):
|
|||||||
if self.generated_events:
|
if self.generated_events:
|
||||||
while randint(0,5) == 1:
|
while randint(0,5) == 1:
|
||||||
e_h = choice(self.generated_events)
|
e_h = choice(self.generated_events)
|
||||||
ref = RelLib.EventRef()
|
eref = RelLib.EventRef()
|
||||||
self.fill_object( ref)
|
self.fill_object( eref)
|
||||||
ref.set_reference_handle(e_h)
|
eref.set_reference_handle(e_h)
|
||||||
ref.set_role( self.rand_type(Utils.event_roles))
|
eref.set_role( self.rand_type(Utils.event_roles))
|
||||||
|
np.add_event_ref(eref)
|
||||||
|
|
||||||
person_handle = self.db.add_person(np,self.trans)
|
person_handle = self.db.add_person(np,self.trans)
|
||||||
|
|
||||||
@ -1050,9 +1051,9 @@ class TestcaseGenerator(Tool.Tool):
|
|||||||
|
|
||||||
if isinstance(o,RelLib.ChildRef):
|
if isinstance(o,RelLib.ChildRef):
|
||||||
if randint(0,3) == 1:
|
if randint(0,3) == 1:
|
||||||
o.set_mother_relation( self.rand_type( Utils.child_relations))
|
o.set_mother_relation( self.rand_type( RelLib.ChildRefType()))
|
||||||
if randint(0,3) == 1:
|
if randint(0,3) == 1:
|
||||||
o.set_father_relation( self.rand_type( Utils.child_relations))
|
o.set_father_relation( self.rand_type( RelLib.ChildRefType()))
|
||||||
|
|
||||||
if issubclass(o.__class__,RelLib._DateBase.DateBase):
|
if issubclass(o.__class__,RelLib._DateBase.DateBase):
|
||||||
if randint(0,1) == 1:
|
if randint(0,1) == 1:
|
||||||
@ -1113,6 +1114,9 @@ class TestcaseGenerator(Tool.Tool):
|
|||||||
if randint(0,1) == 1:
|
if randint(0,1) == 1:
|
||||||
o.set_rectangle( (randint(0,200),randint(0,200),randint(0,200),randint(0,200)))
|
o.set_rectangle( (randint(0,200),randint(0,200),randint(0,200),randint(0,200)))
|
||||||
|
|
||||||
|
if isinstance(o,RelLib.Name):
|
||||||
|
o.set_type( self.rand_type( RelLib.NameType()))
|
||||||
|
|
||||||
if issubclass(o.__class__,RelLib._NoteBase.NoteBase):
|
if issubclass(o.__class__,RelLib._NoteBase.NoteBase):
|
||||||
o.set_note( self.rand_text(self.NOTE))
|
o.set_note( self.rand_text(self.NOTE))
|
||||||
o.set_note_format( choice( (True,False)))
|
o.set_note_format( choice( (True,False)))
|
||||||
@ -1233,11 +1237,21 @@ class TestcaseGenerator(Tool.Tool):
|
|||||||
return (year, event_ref)
|
return (year, event_ref)
|
||||||
|
|
||||||
def rand_type( self, list):
|
def rand_type( self, list):
|
||||||
key = choice(list.keys())
|
if type(list) == dict:
|
||||||
value = list[key]
|
key = choice(list.keys())
|
||||||
if value == _("Custom"):
|
value = list[key]
|
||||||
value = self.rand_text(self.SHORT)
|
if value == _("Custom"):
|
||||||
return( (key,value))
|
value = self.rand_text(self.SHORT)
|
||||||
|
return( (key,value))
|
||||||
|
elif issubclass( list.__class__, RelLib.GrampsType):
|
||||||
|
map = list.get_map()
|
||||||
|
key = choice( map.keys())
|
||||||
|
if key == list.get_custom():
|
||||||
|
value = self.rand_text(self.SHORT)
|
||||||
|
else:
|
||||||
|
value = ''
|
||||||
|
list.set( (key,value))
|
||||||
|
return list
|
||||||
|
|
||||||
def rand_place( self):
|
def rand_place( self):
|
||||||
if not self.generated_places or randint(0,10) == 1:
|
if not self.generated_places or randint(0,10) == 1:
|
||||||
@ -1306,7 +1320,7 @@ class TestcaseGenerator(Tool.Tool):
|
|||||||
maxsyllables = 3
|
maxsyllables = 3
|
||||||
|
|
||||||
if type == self.NOTE:
|
if type == self.NOTE:
|
||||||
result = result + "Geberated by TestcaseGenerator."
|
result = result + "Generated by TestcaseGenerator."
|
||||||
minwords = 20
|
minwords = 20
|
||||||
maxwords = 100
|
maxwords = 100
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user