diff options
author | Sascha Silbe <silbe@activitycentral.com> | 2011-02-25 15:12:45 (GMT) |
---|---|---|
committer | Sascha Silbe <sascha-pgp@silbe.org> | 2011-02-25 15:42:05 (GMT) |
commit | fd09d1827b2a3759b7c5f4bee54fe7a696601bec (patch) | |
tree | 7857e4d4a8af537ce8644efcb991863eae763f88 | |
parent | 70af21585915cf2f232804bf8eaa9f295ed08953 (diff) |
wrap labels if necessary
-rw-r--r-- | restore.py | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -81,6 +81,11 @@ def format_size(size): return _('%4d GiB') % (size // 1024**3) +def label_size_allocate(widget, rect): + """Resize label for proper text wrapping.""" + widget.set_size_request(rect.width, -1) + + class MalformedBundleException(Exception): """Trying to read an invalid bundle.""" pass @@ -562,6 +567,8 @@ class RestoreActivity(activity.Activity): warning = _('No bundle selected. Please close this activity and' ' choose a bundle to restore from the Journal.') self._no_bundle_warning = gtk.Label(warning.encode('utf-8')) + self._no_bundle_warning.set_line_wrap(True) + self._no_bundle_warning.connect('size-allocate', label_size_allocate) vbox.pack_start(self._no_bundle_warning, True) self.set_canvas(vbox) vbox.show_all() @@ -620,6 +627,8 @@ class RestoreActivity(activity.Activity): label_text = _('Restoring Journal from %s') % (self._path, ) label = gtk.Label(label_text.encode('utf-8')) + label.set_line_wrap(True) + label.connect('size-allocate', label_size_allocate) label.show() vbox.pack_start(label) @@ -633,6 +642,8 @@ class RestoreActivity(activity.Activity): vbox.add(alignment) self._message_box = gtk.Label() + self._message_box.set_line_wrap(True) + self._message_box.connect('size-allocate', label_size_allocate) vbox.pack_start(self._message_box) # FIXME @@ -663,6 +674,8 @@ class RestoreActivity(activity.Activity): label_text = _('Successfully restored %d Journal entries from %s') \ % (self._num_entries, self._path) label = gtk.Label(label_text.encode('utf-8')) + label.set_line_wrap(True) + label.connect('size-allocate', label_size_allocate) vbox.pack_start(label) self.set_canvas(vbox) self.show_all() |