Cleanup of class PlaceListPage()

svn: r18124
This commit is contained in:
Rob G. Healey 2011-09-08 09:47:53 +00:00
parent 1f290c934d
commit 87460f0788

View File

@ -3027,14 +3027,14 @@ class PlaceListPage(BasePage):
thead += trow thead += trow
trow.extend( trow.extend(
Html("th", label, class_ = "Column" + colclass, inline = True) Html("th", label, class_ =colclass, inline =True)
for (label, colclass) in [ for (label, colclass) in [
[" ", "Letter"], [_("Letter"), "ColumnLetter"],
[_("Place Name | Name"), "Name"], [_("Place Name | Name"), "ColumnName"],
[_("State"), "State"], [_("State"), "ColumnState"],
[_("Country"), "Country"], [_("Country"), "ColumnCountry"],
[_("Latitude"), "Latitude"], [_("Latitude"), "ColumnLatitude"],
[_("Longitude"), "Longitude"] ] [_("Longitude"), "ColumnLongitude"] ]
) )
sort = Sort.Sort(db) sort = Sort.Sort(db)
@ -3047,42 +3047,52 @@ class PlaceListPage(BasePage):
for handle in handle_list: for handle in handle_list:
place = db.get_place_from_handle(handle) place = db.get_place_from_handle(handle)
place_title = place.get_title() if place:
ml = place.get_main_location() place_title = place.get_title()
ml = place.get_main_location()
letter = first_letter(place_title) if place_title:
letter = first_letter(place_title)
else:
letter = ' '
trow = Html("tr") trow = Html("tr")
tbody += trow tbody += trow
tcell = Html("td", class_ = "ColumnLetter", inline = True) tcell = Html("td", class_ = "ColumnLetter", inline = True)
trow += tcell trow += tcell
if letter != last_letter: if letter != last_letter:
last_letter = letter last_letter = letter
trow.attr = 'class = "BeginLetter"' trow.attr = 'class = "BeginLetter"'
tcell += Html("a", last_letter, name = last_letter, tcell += Html("a", last_letter, name =last_letter,
title = _("Places with letter %s" % last_letter)) title = _("Places with letter %s" % last_letter))
else: else:
tcell += " " tcell += " "
trow += Html("td", self.place_link(place.handle, place_title, place.gramps_id), trow += Html("td", self.place_link(place.get_handle(), place_title, place.get_gramps_id() ),
class_ = "ColumnName") class_ = "ColumnName")
trow.extend( trow.extend(
Html("td", data or " ", class_ = "Column" + colclass, inline = True) Html("td", data or " ", class_ =colclass, inline =True)
for (colclass, data) in [ for (colclass, data) in [
["State", ml.state], ["ColumnState", ml.state],
["Country", ml.country] ] ["ColumnCountry", ml.country] ]
) )
latitude, longitude = False, False tcell1 = Html("td", class_ ="ColumnLatitude", inline =True)
if (place and (place.lat and place.long)): tcell2 = Html("td", class_ ="ColumnLongitude", inline =True)
latitude, longitude = conv_lat_lon( place.lat, trow += (tcell1, tcell2)
place.long,
"DEG") if (place.lat and place.long):
trow += Html("td", latitude or " ", class_ = "ColumnLatitude", inline = True) latitude, longitude = conv_lat_lon(place.lat,
trow += Html("td", longitude or " ", class_ = "ColumnLongitude", inline = True) place.long,
"DEG")
tcell1 += latitude
tcell2 += longitude
else:
tcell1 += ' '
tcell2 += ' '
# add clearline for proper styling # add clearline for proper styling
# add footer section # add footer section