36
36
# Gramplet modules
37
37
#
38
38
#------------------------------------------------------------------------
39
- from actionbase import ActionBase , represents_int
39
+ import actionutils
40
40
41
41
#------------------------------------------------------------------------
42
42
#
@@ -69,7 +69,7 @@ class PrimaryNameCitation:
69
69
def get_actions (dbstate , citation , form_event ):
70
70
db = dbstate .db
71
71
actions = []
72
- for (person , attr ) in ActionBase .get_form_person_attr (db , form_event .get_handle (), 'Name' ):
72
+ for (person , attr ) in actionutils .get_form_person_attr (db , form_event .get_handle (), 'Name' ):
73
73
actions .append ((name_displayer .display (person ), attr .get_value (),
74
74
lambda dbstate , uistate , track , citation_handle = citation .handle , person_handle = person .handle : PrimaryNameCitation .command (dbstate , uistate , track , citation_handle , person_handle )))
75
75
return (_ ("Add Primary Name citation" ), actions )
@@ -87,7 +87,7 @@ class AlternateName:
87
87
def get_actions (dbstate , citation , form_event ):
88
88
db = dbstate .db
89
89
actions = []
90
- for (person , attr ) in ActionBase .get_form_person_attr (db , form_event .get_handle (), 'Name' ):
90
+ for (person , attr ) in actionutils .get_form_person_attr (db , form_event .get_handle (), 'Name' ):
91
91
alternate = Name ()
92
92
alternate .set_first_name (attr .get_value ())
93
93
alternate .add_citation (citation .handle )
@@ -110,9 +110,9 @@ def get_actions(dbstate, citation, form_event):
110
110
actions = []
111
111
# if there is no date on the form, no actions can be performed
112
112
if form_event .get_date_object ():
113
- for (person , attr ) in ActionBase .get_form_person_attr (db , form_event .get_handle (), 'Age' ):
113
+ for (person , attr ) in actionutils .get_form_person_attr (db , form_event .get_handle (), 'Age' ):
114
114
age_string = attr .get_value ()
115
- if age_string and represents_int (age_string ):
115
+ if age_string and actionutils . represents_int (age_string ):
116
116
age = int (age_string )
117
117
if age :
118
118
birth_date = form_event .get_date_object () - age
@@ -130,19 +130,19 @@ def get_actions(dbstate, citation, form_event):
130
130
birth_date .set_quality (Date .QUAL_CALCULATED )
131
131
132
132
actions .append ((name_displayer .display (person ), date_displayer .display (birth_date ),
133
- 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 )))
133
+ lambda dbstate , uistate , track , citation_handle = citation .handle , person_handle = person .handle , birth_date_ = birth_date : actionutils .add_event_to_person (dbstate , uistate , track , person_handle , EventType .BIRTH , birth_date_ , None , citation_handle , EventRoleType .PRIMARY )))
134
134
return (_ ("Add Birth event" ), actions )
135
135
136
136
class OccupationEvent :
137
137
@staticmethod
138
138
def get_actions (dbstate , citation , form_event ):
139
139
db = dbstate .db
140
140
actions = []
141
- for (person , attr ) in ActionBase .get_form_person_attr (db , form_event .get_handle (), 'Occupation' ):
141
+ for (person , attr ) in actionutils .get_form_person_attr (db , form_event .get_handle (), 'Occupation' ):
142
142
occupation = attr .get_value ()
143
143
if (occupation ) :
144
144
actions .append ((name_displayer .display (person ), occupation ,
145
- 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 )))
145
+ lambda dbstate , uistate , track , citation_handle = citation .handle , person_handle = person .handle , occupation_ = occupation : actionutils .add_event_to_person (dbstate , uistate , track , person_handle , EventType .OCCUPATION , form_event .get_date_object (), occupation_ , citation_handle , EventRoleType .PRIMARY )))
146
146
return (_ ("Add Occupation event" ), actions )
147
147
148
148
class ResidenceEvent :
0 commit comments