Example #1
0
    def display_georow_list(self, place: Loc.Loc):
        """ Display list of matches in listbox (tree) """

        # Clear listbox
        self.w.tree.clear_display_list()

        temp_place = copy.copy(place)

        # Get geodata for each item and add to listbox output
        for geo_row in place.georow_list:
            self.geodata.geo_files.geodb.copy_georow_to_place(
                geo_row, temp_place)
            temp_place.set_place_type()

            self.geodata.geo_files.geodb.set_display_names(temp_place)
            nm = temp_place.get_long_name(
                self.geodata.geo_files.output_replace_dct)
            # See if name existed at time of event
            valid_year = self.geodata._valid_year_for_location(
                event_year=place.event_year,
                country_iso=temp_place.country_iso,
                admin1=temp_place.admin1_id,
                pad_years=0)
            if valid_year:
                # Get prefix
                self.w.tree.list_insert(
                    nm, GeoUtil.capwords(geo_row[GeoUtil.Entry.PREFIX]),
                    geo_row[GeoUtil.Entry.ID],
                    f'{int(geo_row[GeoUtil.Entry.SCORE]):d}',
                    geo_row[GeoUtil.Entry.FEAT])
            else:
                self.w.tree.list_insert(
                    nm, "VERIFY DATE", geo_row[GeoUtil.Entry.ID],
                    f'{int(geo_row[GeoUtil.Entry.SCORE]):d}',
                    geo_row[GeoUtil.Entry.FEAT])

        self.w.root.update_idletasks()