@@ -54,12 +54,14 @@ def __init__(self):
5454 ActionBase .__init__ (self )
5555 pass
5656
57- def populate_model (self , dbstate , citation , form_event , model ):
57+ def get_actions (self , dbstate , citation , form_event ):
5858 db = dbstate .db
59- parent = model . append ( None , ( _ ( "Add Primary Name citation" ), None , None ))
59+ actions = []
6060 for (person , attr ) in ActionBase .get_form_person_attr (db , form_event .get_handle (), 'Name' ):
61- model .append (parent , (name_displayer .display (person ), attr .get_value (),
61+ pass
62+ actions .append ((name_displayer .display (person ), attr .get_value (),
6263 lambda dbstate , uistate , track , citation_handle = citation .handle , person_handle = person .handle : PrimaryNameCitation .command (dbstate , uistate , track , citation_handle , person_handle )))
64+ return (_ ("Add Primary Name citation" ), actions )
6365
6466 def command (dbstate , uistate , track , citation_handle , person_handle ):
6567 db = dbstate .db
@@ -73,11 +75,11 @@ def __init__(self):
7375 ActionBase .__init__ (self )
7476 pass
7577
76- def populate_model (self , dbstate , citation , form_event , model ):
78+ def get_actions (self , dbstate , citation , form_event ):
7779 db = dbstate .db
80+ actions = []
7881 # if there is no date on the form, no actions can be performed
7982 if form_event .get_date_object ():
80- parent = model .append (None , (_ ("Add Birth event" ), None , None ))
8183 for (person , attr ) in ActionBase .get_form_person_attr (db , form_event .get_handle (), 'Age' ):
8284 age_string = attr .get_value ()
8385 if age_string and represents_int (age_string ):
@@ -97,19 +99,21 @@ def populate_model(self, dbstate, citation, form_event, model):
9799 birth_date .set (Date .QUAL_NONE , Date .MOD_RANGE , birth_date .get_calendar (), birth_range , newyear = birth_date .get_new_year ())
98100 birth_date .set_quality (Date .QUAL_CALCULATED )
99101
100- model .append (parent , (name_displayer .display (person ), date_displayer .display (birth_date ),
102+ actions .append ((name_displayer .display (person ), date_displayer .display (birth_date ),
101103 lambda dbstate , uistate , track , citation_handle = citation .handle , person_handle = person .handle , birth_date_ = birth_date : ActionBase .add_event_to_person (dbstate , uistate , track , person_handle , EventType .BIRTH , birth_date_ , None , citation_handle , EventRoleType .PRIMARY )))
104+ return (_ ("Add Birth event" ), actions )
102105
103106class OccupationEvent (ActionBase ):
104107 def __init__ (self ):
105108 ActionBase .__init__ (self )
106109 pass
107110
108- def populate_model (self , dbstate , citation , form_event , model ):
111+ def get_actions (self , dbstate , citation , form_event ):
109112 db = dbstate .db
110- parent = model . append ( None , ( _ ( 'Add Occupation event' ), None , None ))
113+ actions = []
111114 for (person , attr ) in ActionBase .get_form_person_attr (db , form_event .get_handle (), 'Occupation' ):
112115 occupation = attr .get_value ()
113116 if (occupation ) :
114- model .append (parent , (name_displayer .display (person ), occupation ,
115- lambda dbstate , uistate , track , citation_handle = citation .handle , person_handle = person .handle , occupation_ = occupation : ActionBase .add_event_to_person (dbstate , uistate , track , person_handle , EventType .OCCUPATION , form_event .get_date_object (), occupation_ , citation_handle , EventRoleType .PRIMARY )))
117+ actions .append ((name_displayer .display (person ), occupation ,
118+ lambda dbstate , uistate , track , citation_handle = citation .handle , person_handle = person .handle , occupation_ = occupation : ActionBase .add_event_to_person (dbstate , uistate , track , person_handle , EventType .OCCUPATION , form_event .get_date_object (), occupation_ , citation_handle , EventRoleType .PRIMARY )))
119+ return (_ ("Add Occupation event" ), actions )
0 commit comments