Hey, we can get even better!! class FactTree(gtk.TreeView): [...] def __init__(self): [...] try : _test_context = pixmap.cairo_create() self._test_layout = _test_context.create_layout() font = pango.FontDescription(gtk.Style().font_desc.to_string()) self._test_layout.set_font_description(font) except : return
[...] def update_longest_dimensions(self, fact): interval = "%s -" % fact["start_time"].strftime("%H:%M") if fact["end_time"]: interval = "%s %s" % (interval, fact["end_time"].strftime("%H:%M")) try : self._test_layout.set_markup(interval) w, h = self._test_layout.get_pixel_size() self.longest_interval = max(self.longest_interval, w + 20) self._test_layout.set_markup("%s - <small>%s</small> " % (stuff.escape_pango(fact["name"]), stuff.escape_pango(fact["category"]))) w, h = self._test_layout.get_pixel_size() self.longest_activity_category = max(self.longest_activity_category, w + 10) self._test_layout.set_markup("%s" % stuff.format_duration(fact["delta"])) w, h = self._test_layout.get_pixel_size() self.longest_duration = max(self.longest_duration, w) except : w = 0 h = 0 self.longest_interval = max(self.longest_interval, w + 120) self.longest_activity_category = max(self.longest_activity_category, w + 70) self.longest_duration = max(self.longest_duration, w) -- hamster-standalone crashed with Error in __init__() https://bugs.launchpad.net/bugs/536953 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs