diff --git a/gramps/gui/views/treemodels/peoplemodel.py b/gramps/gui/views/treemodels/peoplemodel.py index d0c08e478..1abbb5c4a 100644 --- a/gramps/gui/views/treemodels/peoplemodel.py +++ b/gramps/gui/views/treemodels/peoplemodel.py @@ -449,10 +449,11 @@ class PeopleBaseModel(object): tag_priority = None for handle in data[COLUMN_TAGS]: tag = self.db.get_tag_from_handle(handle) - this_priority = tag.get_priority() - if tag_priority is None or this_priority < tag_priority: - tag_color = tag.get_color() - tag_priority = this_priority + if tag: + this_priority = tag.get_priority() + if tag_priority is None or this_priority < tag_priority: + tag_color = tag.get_color() + tag_priority = this_priority return tag_color def column_tags(self, data): diff --git a/gramps/plugins/drawreport/calendarreport.py b/gramps/plugins/drawreport/calendarreport.py index 0f7ac70fe..ab84f8056 100644 --- a/gramps/plugins/drawreport/calendarreport.py +++ b/gramps/plugins/drawreport/calendarreport.py @@ -208,6 +208,7 @@ class Calendar(Report): ptext = style_sheet.get_paragraph_style("CAL-Text") pdaynames = style_sheet.get_paragraph_style("CAL-Daynames") pnumbers = style_sheet.get_paragraph_style("CAL-Numbers") + numpos = pt2cm(pnumbers.get_font().get_size()) ptext1style = style_sheet.get_paragraph_style("CAL-Text1style") long_days = self._dd.long_days @@ -267,24 +268,21 @@ class Calendar(Report): header + week_row * cell_height) list_ = self.calendar.get(month, {}).get(thisday.day, []) list_.sort() # to get CAL-Holiday on bottom - position = 0.0 + position = spacing for (format, p, m_list) in list_: - lines = p.count("\n") + 1 # lines in the text - position += (lines * spacing) - current = 0 - for line in p.split("\n"): + for line in reversed(p.split("\n")): # make sure text will fit: numpos = pt2cm(pnumbers.get_font().get_size()) - if position + (current * spacing) - 0.1 >= cell_height - numpos: # font daynums - continue + if position - 0.1 >= cell_height - numpos: # font daynums + break font = ptext.get_font() line = string_trim(font, line, cm2pt(cell_width + 0.2)) self.doc.draw_text(format, line, day_col * cell_width + 0.1, - header + (week_row + 1) * cell_height - position + (current * spacing) - 0.1, m_list[0]) + header + (week_row + 1) * cell_height - position - 0.1, m_list[0]) if len(m_list) > 1: # index the spouse too self.doc.draw_text(format, "",0,0, m_list[1]) - current += 1 + position += spacing current_ord += 1 if not something_this_week: last_edge = 0