~jconti/recent-notifications/trunk

« back to all changes in this revision

Viewing changes to unity/MessageItem.py

  • Committer: Jason Conti
  • Date: 2011-04-16 23:29:36 UTC
  • Revision ID: jason.conti@gmail.com-20110416232936-wqgej387mzueozir
Updated the number of translatable strings and fixed the labels so they properly rewrap when the window is resized in the experimental unity version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
def create_label():
20
20
  label = Gtk.Label()
21
21
  label.set_use_markup(True)
 
22
  label.set_selectable(True)
22
23
  label.set_line_wrap(True)
23
24
  label.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
24
25
  label.set_alignment(0, 0)
110
111
      self._image_unread.hide()
111
112
      self._summary_hbox.remove(self._image_unread)
112
113
 
 
114
  def set_width(self, width):
 
115
    """Updates the wrap width of the labels in this message item, minus the icon
 
116
    size and various padding."""
 
117
    new_width = width - self._message_icon_size - 50
 
118
    self._label_summary.set_size_request(new_width, -1)
 
119
    self._label_body.set_size_request(new_width, -1)
 
120
    self._label_info.set_size_request(new_width, -1)
 
121
 
113
122
  def markup_links(self, text):
114
123
    """Filters escaped text for web links and makes them clickable"""
115
124
    result = []
142
151
    body = self.escape_body(self._message.body.encode("utf8"))
143
152
    timestamp = escape_text(Timestamp.locale_datetime(self._message.timestamp))
144
153
    app_name = escape_text(self._message.app_name)
145
 
    mapping = {
146
 
      "summary": escape_text(self._message.summary.encode("utf8")),
147
 
      "body": self.escape_body(self._message.body.encode("utf8")),
148
 
      "timestamp": escape_text(Timestamp.locale_datetime(self._message.timestamp)),
149
 
      "from": _("from"),
150
 
      "app_name": escape_text(self._message.app_name)
151
 
    }
 
154
 
152
155
    self._label_summary.set_markup("<b>{0}</b>".format(summary))
153
156
    self._label_body.set_markup(body)
154
157
    self._label_info.set_markup("<small><i>{0} {1} <b>{2}</b></i></small>".format(timestamp,