def __write_place(self, handle, place_nbr): """ This procedure writes out the details of a single place """ place = self._db.get_place_from_handle(handle) place_details = [self._("Gramps ID: %s ") % place.get_gramps_id()] for level in get_location_list(self._db, place): # translators: needed for French, ignore otherwise place_details.append(self._("%(str1)s: %(str2)s" ) % {'str1': self._(level[1].xml_str()), 'str2': level[0]}) place_names = '' all_names = place.get_all_names() if len(all_names) > 1 or __debug__: for place_name in all_names: if place_names != '': # translators: needed for Arabic, ignore otherwise place_names += self._(", ") place_names += '%s' % place_name.get_value() if place_name.get_language() != '' or __debug__: place_names += ' (%s)' % place_name.get_language() place_details += [self._("places|All Names: %s") % place_names,] self.doc.start_paragraph("PLC-PlaceTitle") place_title = _pd.display(self._db, place, None, self.place_format) self.doc.write_text(("%(nbr)s. %(place)s") % {'nbr' : place_nbr, 'place' : place_title}) self.doc.end_paragraph() for item in place_details: self.doc.start_paragraph("PLC-PlaceDetails") self.doc.write_text(item) self.doc.end_paragraph()
def __write_place(self, handle, place_nbr): """ This procedure writes out the details of a single place """ place = self.database.get_place_from_handle(handle) place_details = [self._("Gramps ID: %s ") % place.get_gramps_id()] for level in get_location_list(self.database, place): place_details.append("%(type)s: %(name)s " % { 'type': self._(level[1].xml_str()), 'name': level[0] }) self.doc.start_paragraph("PLC-PlaceTitle") place_title = place_displayer.display(self.database, place) self.doc.write_text(("%(nbr)s. %(place)s") % { 'nbr': place_nbr, 'place': place_title }) self.doc.end_paragraph() for item in place_details: self.doc.start_paragraph("PLC-PlaceDetails") self.doc.write_text(item) self.doc.end_paragraph()
def display(self, db, place, date=None, fmt=-1): if not place: return "" if not config.get('preferences.place-auto'): return place.title else: if fmt == -1: fmt = config.get('preferences.place-format') pf = self.place_formats[fmt] lang = pf.language places = get_location_list(db, place, date, lang) visited = [place.handle] postal_code = place.get_code() if not postal_code: place2 = "" for placeref in place.placeref_list: place2 = db.get_place_from_handle(placeref.ref) if place2: postal_code = self._find_postal_code( db, place2, visited) if postal_code: break return self._find_populated_place(places, place, postal_code)
def update_title(self): new_name = ', '.join(get_location_list(self.db, self.obj)) self.top.get_object("place_title").set_text(new_name) self.obj.set_title(new_name)
def display_location(self, place): """ Display a location. """ lines = get_location_list(self.dbstate.db, place) self.add_row(_('Location'), '\n'.join(lines))