51
51
52
52
_ = _trans .gettext
53
53
54
- class PrimaryNameCitation (ActionBase ):
55
- def __init__ (self ):
56
- ActionBase .__init__ (self )
57
-
58
- def get_actions (self , dbstate , citation , form_event ):
54
+ def get_actions (dbstate , citation , form_event ):
55
+ """
56
+ return a list of all actions that this module can provide for the given citation and form
57
+ each list entry is a string, describing the action category, and a list of actions that can be performed.
58
+ """
59
+ actions = []
60
+ actions .append (PrimaryNameCitation .get_actions (dbstate , citation , form_event ))
61
+ actions .append (AlternateName .get_actions (dbstate , citation , form_event ))
62
+ actions .append (BirthEvent .get_actions (dbstate , citation , form_event ))
63
+ actions .append (OccupationEvent .get_actions (dbstate , citation , form_event ))
64
+ actions .append (ResidenceEvent .get_actions (dbstate , citation , form_event ))
65
+ return actions
66
+
67
+ class PrimaryNameCitation :
68
+ def get_actions (dbstate , citation , form_event ):
59
69
db = dbstate .db
60
70
actions = []
61
71
for (person , attr ) in ActionBase .get_form_person_attr (db , form_event .get_handle (), 'Name' ):
@@ -70,11 +80,8 @@ def command(dbstate, uistate, track, citation_handle, person_handle):
70
80
with DbTxn (_ ("Add Person (%s)" ) % name_displayer .display (person ), db ) as trans :
71
81
db .commit_person (person , trans )
72
82
73
- class AlternateName (ActionBase ):
74
- def __init__ (self ):
75
- ActionBase .__init__ (self )
76
-
77
- def get_actions (self , dbstate , citation , form_event ):
83
+ class AlternateName :
84
+ def get_actions (dbstate , citation , form_event ):
78
85
db = dbstate .db
79
86
actions = []
80
87
for (person , attr ) in ActionBase .get_form_person_attr (db , form_event .get_handle (), 'Name' ):
@@ -92,11 +99,8 @@ def command(dbstate, uistate, track, person_handle, alternate):
92
99
with DbTxn (_ ("Add Person (%s)" ) % name_displayer .display (person ), db ) as trans :
93
100
db .commit_person (person , trans )
94
101
95
- class BirthEvent (ActionBase ):
96
- def __init__ (self ):
97
- ActionBase .__init__ (self )
98
-
99
- def get_actions (self , dbstate , citation , form_event ):
102
+ class BirthEvent :
103
+ def get_actions (dbstate , citation , form_event ):
100
104
db = dbstate .db
101
105
actions = []
102
106
# if there is no date on the form, no actions can be performed
@@ -124,11 +128,8 @@ def get_actions(self, dbstate, citation, form_event):
124
128
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 )))
125
129
return (_ ("Add Birth event" ), actions )
126
130
127
- class OccupationEvent (ActionBase ):
128
- def __init__ (self ):
129
- ActionBase .__init__ (self )
130
-
131
- def get_actions (self , dbstate , citation , form_event ):
131
+ class OccupationEvent :
132
+ def get_actions (dbstate , citation , form_event ):
132
133
db = dbstate .db
133
134
actions = []
134
135
for (person , attr ) in ActionBase .get_form_person_attr (db , form_event .get_handle (), 'Occupation' ):
@@ -138,11 +139,8 @@ def get_actions(self, dbstate, citation, form_event):
138
139
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 )))
139
140
return (_ ("Add Occupation event" ), actions )
140
141
141
- class ResidenceEvent (ActionBase ):
142
- def __init__ (self ):
143
- ActionBase .__init__ (self )
144
-
145
- def get_actions (self , dbstate , citation , form_event ):
142
+ class ResidenceEvent :
143
+ def get_actions (dbstate , citation , form_event ):
146
144
db = dbstate .db
147
145
# build a list of all the people referenced in the form. For 1841, all people have a PRIMARY event role
148
146
people = []
0 commit comments