Ellipsize to 100 instead of 200 in tooltips, that's ugly enough with 100...

Set show+last_status_time after status message instead of at the end in roster tooltip
This commit is contained in:
Jean-Marie Traissard 2006-09-26 14:40:13 +00:00
parent 1f489b0b97
commit 1d660a88a7
1 changed files with 14 additions and 15 deletions

View File

@ -177,8 +177,8 @@ class StatusTable:
# make sure 'status' is unicode before we send to to reduce_chars # make sure 'status' is unicode before we send to to reduce_chars
if isinstance(status, str): if isinstance(status, str):
status = unicode(status, encoding='utf-8') status = unicode(status, encoding='utf-8')
# reduce to 200 chars, 1 line # reduce to 100 chars, 1 line
status = gtkgui_helpers.reduce_chars_newlines(status, 200, 1) status = gtkgui_helpers.reduce_chars_newlines(status, 100, 1)
str_status = gtkgui_helpers.escape_for_pango_markup(str_status) str_status = gtkgui_helpers.escape_for_pango_markup(str_status)
status = gtkgui_helpers.escape_for_pango_markup(status) status = gtkgui_helpers.escape_for_pango_markup(status)
str_status += ' - <span style="italic">' + status + '</span>' str_status += ' - <span style="italic">' + status + '</span>'
@ -369,7 +369,7 @@ class GCTooltip(BaseTooltip):
status = contact.status.strip() status = contact.status.strip()
if status != '': if status != '':
# escape markup entities # escape markup entities
status = gtkgui_helpers.reduce_chars_newlines(status, 200, 5) status = gtkgui_helpers.reduce_chars_newlines(status, 100, 5)
status = '<span style="italic">' +\ status = '<span style="italic">' +\
gtkgui_helpers.escape_for_pango_markup(status) + '</span>' gtkgui_helpers.escape_for_pango_markup(status) + '</span>'
properties.append((status, None)) properties.append((status, None))
@ -537,18 +537,18 @@ class RosterTooltip(NotificationAreaTooltip):
text = text % local_time text = text % local_time
show += text show += text
show = u'<span style="italic">' + show + '</span>' show = u'<span style="italic">' + show + '</span>'
# we append show at end of properties below # we append show below
if contact.status: if contact.status:
status = contact.status.strip() status = contact.status.strip()
if status: if status:
# reduce long status # reduce long status
# (no more than 200 chars on line and no more than 5 lines) # (no more than 100 chars on line and no more than 5 lines)
status = gtkgui_helpers.reduce_chars_newlines(status, 200, 5) status = gtkgui_helpers.reduce_chars_newlines(status, 100, 5)
# escape markup entities. # escape markup entities.
status = gtkgui_helpers.escape_for_pango_markup(status) status = gtkgui_helpers.escape_for_pango_markup(status)
properties.append((u'<span style="italic">%s</span>' % status, None)) properties.append((u'<span style="italic">%s</span>' % status, None))
properties.append((show, None))
properties.append((_('Jabber ID: '), prim_contact.jid )) properties.append((_('Jabber ID: '), prim_contact.jid ))
if prim_contact.sub and prim_contact.sub != 'both': if prim_contact.sub and prim_contact.sub != 'both':
@ -565,13 +565,12 @@ class RosterTooltip(NotificationAreaTooltip):
properties.append((_('OpenPGP: '), properties.append((_('OpenPGP: '),
gtkgui_helpers.escape_for_pango_markup(keyID))) gtkgui_helpers.escape_for_pango_markup(keyID)))
if num_resources <= 1: # contact has only one ressource
# contact is offline(show only show) or has only one ressource
if num_resources == 1 and contact.resource: if num_resources == 1 and contact.resource:
properties.append((_('Resource: '), properties.append((_('Resource: '),
gtkgui_helpers.escape_for_pango_markup(contact.resource) + ' (' + \ gtkgui_helpers.escape_for_pango_markup(contact.resource) + ' (' + \
unicode(contact.priority) + ')')) unicode(contact.priority) + ')'))
properties.append((show, None))
while properties: while properties:
property = properties.pop(0) property = properties.pop(0)