def pre_update(self, context): if not self.subject: return cr = context.cairo w, h = text_extents(cr, self.subject.body, multiline=True, padding=2) e2 = self.EAR * 2 self.min_width = w + e2 + self.OFFSET self.min_height = h + e2 ElementItem.pre_update(self, context)
def pre_update(self, context): if not self.subject: return cr = context.cairo e = self.EAR o = self.OFFSET w, h = text_extents(cr, self.subject.body, self.style.font, width=self.width - e) self.min_width = w + e + o * 2 self.min_height = h + o * 2 ElementItem.pre_update(self, context)
def __init__(self, id=None): ElementItem.__init__(self, id) self.min_width = CommentItem.EAR + 2 * CommentItem.OFFSET self.height = 50 self.width = 100 self.watch('subject<Comment>.body')