diff options
author | Tomeu Vizoso <tomeu@sugarlabs.org> | 2009-01-25 18:46:37 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@sugarlabs.org> | 2009-01-25 18:46:37 (GMT) |
commit | 356c8881ada5df88c25db8998cb20a5fc40f4fd1 (patch) | |
tree | a8602dde237d2c23ecbf4e4c35a0c048373d4e7f | |
parent | 817df3a10741ac4f984762a353f18b9eaeea2370 (diff) |
Set a default title if needed
-rw-r--r-- | thoughtview.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/thoughtview.py b/thoughtview.py index 1651e09..d3ecc1c 100644 --- a/thoughtview.py +++ b/thoughtview.py @@ -77,11 +77,15 @@ class ThoughtView(Box): def _draw_label(self, context): context.cairo.save() layout = context.cairo.create_layout() - layout.set_text(self._name) + + if self._name is not None and self._name: + layout.set_text(self._name) + else: + layout.set_text(_('Untitled')) width, height = layout.get_pixel_size() - self.width = width + self._PADDING * 2 - self.height = height + self._PADDING * 2 + self.min_width = width + self._PADDING * 2 + self.min_height = height + self._PADDING * 2 x = self._PADDING y = self._PADDING |