def write_family(self): """ Find and write Families """ handles = sorted(self.database.get_family_handles(), key=self._get_family_timestamp) if handles: self._table_begin(_('Families Changed'), 'FamilyTable') self._table_header(_('ID'), _('Family Surname'), _('Changed On')) for handle in reversed(handles[-10:]): family = self.database.get_family_from_handle(handle) if family is not None: f_handle = family.get_father_handle() if f_handle is not None: father = self.database.get_person_from_handle(f_handle) f_surname = father.get_primary_name().get_surname() else: f_surname = _UNKNOWN_FAMILY m_handle = family.get_mother_handle() if m_handle is not None: mother = self.database.get_person_from_handle(m_handle) m_surname = mother.get_primary_name().get_surname() else: m_surname = _UNKNOWN_FAMILY family_name = _("%s and %s") % (f_surname, m_surname) self._table_row(family.gramps_id, family_name, format_time(family.change)) self._table_end()
def citation_src_chan(self, data): source_handle = data[COLUMN_SOURCE] try: source = self.db.get_source_from_handle(source_handle) return format_time(source.change) except: return ''
def main(self): """Search the database for the last person records changed.""" self.set_text(_("Processing...") + "\n") counter = 0 the_list = [] # sorted list of people with change times, newest first for handle in self.dbstate.db.iter_person_handles(): change = -self.dbstate.db.get_raw_person_data(handle)[17] bsindex = bisect(KeyWrapper(the_list, key=lambda c: c[1]), change) the_list.insert(bsindex, (handle, change)) if len(the_list) > 10: # only need 10 entries, so remove oldest the_list.pop(10) if counter % _YIELD_INTERVAL: # let rest of GUI run yield True counter += 1 yield True self.clear_text() counter = 1 for handle, change in the_list: person = self.dbstate.db.get_person_from_handle(handle) self.append_text(" %d. " % (counter, )) self.link(person.get_primary_name().get_name(), 'Person', person.handle) self.append_text(" (%s %s)" % (_('changed on'), format_time(person.change))) if counter < 10: self.append_text("\n") counter += 1
def citation_src_chan(self, data): source_handle = data[COLUMN_SOURCE] cached, value = self.get_cached_value(source_handle, "SRC_CHAN") if not cached: try: source = self.db.get_source_from_handle(source_handle) value = format_time(source.change) except: value = '' self.set_cached_value(source_handle, "SRC_CHAN", value) return value
def write_notes(self): """ Find and write Notes """ handles = sorted(self.database.get_note_handles(), key=self._get_note_timestamp) if handles: self._table_begin(_("Notes Changed"), "NotesTable") self._table_header(_('ID'), _('Title'), _('Changed On')) for handle in reversed(handles[-10:]): note_obj = self.database.get_note_from_handle(handle) if note_obj is not None: self._table_row(note_obj.gramps_id, trunc(note_obj.get()), format_time(note_obj.change)) self._table_end()
def write_person(self): """ Find and write Persons """ handles = sorted(self.database.get_person_handles(), key=self._get_timestamp) if handles: self._table_begin(_('People Changed'), 'PersonTable') self._table_header(_('ID'), _('Person'), _('Changed On')) for handle in reversed(handles[-10:]): person = self.database.get_person_from_handle(handle) if person is not None: self._table_row("%s" % person.gramps_id, person.get_primary_name().get_name(), format_time(person.change)) self._table_end()
def write_citations(self): """ Find and write Citations """ handles = sorted(self.database.get_citation_handles(), key=self._get_citation_timestamp) if handles: self._table_begin(_("Citations Changed"), "CitationsTable") self._table_header(_('ID'), _('Title'), _('Changed On')) for handle in reversed(handles[-10:]): citation_obj = self.database.get_citation_from_handle(handle) if citation_obj is not None: self._table_row(citation_obj.gramps_id, trunc(citation_obj.page), format_time(citation_obj.change)) self._table_end()
def write_place(self): """ Find and write Places """ handles = sorted(self.database.get_place_handles(), key=self._get_place_timestamp) if handles: self._table_begin(_("Places Changed"), "PlaceTable") self._table_header(_('ID'), _('Place'), _('Changed On')) for handle in reversed(handles[-10:]): place = self.database.get_place_from_handle(handle) if place is not None: self._table_row(place.gramps_id, place_displayer.display(self.database, place), format_time(place.change)) self._table_end()
def write_media(self): """ Find and write media """ handles = sorted(self.database.get_media_handles(), key=self._get_media_timestamp) if handles: self._table_begin(_("Media Changed"), "MediaTable") self._table_header(_('ID'), _('Path'), _('Changed On')) for handle in reversed(handles[-10:]): media = self.database.get_media_from_handle(handle) if media is not None: self._table_row(media.gramps_id, media.get_description(), #media.get_path(), format_time(media.change)) self._table_end()
def write_event(self): """ Find and write Events """ handles = sorted(self.database.get_event_handles(), key=self._get_event_timestamp) if handles: self._table_begin(_('Events Changed'), 'EventTable') self._table_header(_('ID'), _('Event'), _('Changed On')) for handle in reversed(handles[-10:]): event = self.database.get_event_from_handle(handle) if event is not None: desc_out = str(event.get_type()) if event.description != "": desc_out += ", %s" % event.description date = get_date(event) if date: desc_out += ", %s" % date self._table_row(event.gramps_id, desc_out, format_time(event.change)) self._table_end()
def column_change(self,data): return format_time(data[7])
def column_change(self, data): return format_time(data[15])
def column_change(self,data): return format_time(data[COLUMN_CHANGE])
def column_change(self, data): return format_time(data[Note.POS_CHANGE])
def source_src_chan(self, data): return format_time(data[COLUMN2_CHANGE])
def citation_change(self, data): return format_time(data[COLUMN_CHANGE])
def column_change(self,data): return format_time(data[Note.POS_CHANGE])