def check_event(self, handle): """ Checks each event against the selection criteria. """ event = self.database.get_event_from_handle(handle) if event.get_type() == EventType.CENSUS: citation = get_census_citation(self.database, event) if citation: # We may have census events with untagged sources. if self.report_type in (TYPE_SOURCE, TYPE_BOTH): if citation.get_reference_handle() == self.src_handle: self.write_census(event, citation) else: if citation: self.write_census(event, citation)
def __init__(self, dbstate, uistate, track, event): self.dbstate = dbstate self.uistate = uistate self.track = track self.db = dbstate.db self.event = event self.citation = get_census_citation(self.db, self.event) if self.citation is None: self.citation = Citation() ManagedWindow.__init__(self, uistate, track, event) self.widgets = {} top = self.__create_gui() self.set_window(top, None, self.get_menu_title()) self._config = config.get_manager('census') width = self._config.get('interface.census-width') height = self._config.get('interface.census-height') self.window.resize(width, height) self.place_field = PlaceEntry(self.dbstate, self.uistate, self.track, self.widgets['place_text'], self.event.set_place_handle, self.event.get_place_handle, self.widgets['place_add'], self.widgets['place_share']) self.ref_field = MonitoredEntry( self.widgets['ref_entry'], self.citation.set_page, self.citation.get_page, self.db.readonly) if self.event.get_handle(): self.widgets['census_combo'].set_sensitive(False) self.__populate_gui(event) self.details.populate_gui(event)
def main(self): """ Called to update the display. """ self.model.clear() active_person = self.get_active_object("Person") if not active_person: return self.callman.unregister_all() self.callman.register_obj(active_person) self.callman.register_handles({'person': [active_person.get_handle()]}) db = self.dbstate.db for event_ref in active_person.get_event_ref_list(): if event_ref: event = db.get_event_from_handle(event_ref.ref) if event: if event.get_type() == EventType.CENSUS: p_handle = event.get_place_handle() if p_handle: place = db.get_place_from_handle(p_handle) place_text = place.get_title() else: place_text = '' citation = get_census_citation(db, event) if citation: source_handle = citation.get_reference_handle() source = db.get_source_from_handle(source_handle) source_text = source.get_title() self.model.append((event, source_text, get_date(event), place_text))