* text += '\n' + text is wrong.
* Don't call it markup if it's plaintext.
This commit is contained in:
parent
8b1746140e
commit
b3767ac3da
|
@ -1205,7 +1205,7 @@ class ChatControl(ChatControlBase):
|
||||||
|
|
||||||
def update_mood(self):
|
def update_mood(self):
|
||||||
mood = None
|
mood = None
|
||||||
text = ''
|
text = None
|
||||||
|
|
||||||
if isinstance(self.contact, GC_Contact):
|
if isinstance(self.contact, GC_Contact):
|
||||||
return
|
return
|
||||||
|
@ -1217,37 +1217,35 @@ class ChatControl(ChatControlBase):
|
||||||
|
|
||||||
if mood is not None:
|
if mood is not None:
|
||||||
if mood in MOODS:
|
if mood in MOODS:
|
||||||
self._mood_image.set_from_pixbuf(
|
self._mood_image.set_from_pixbuf(gtkgui_helpers.load_mood_icon(
|
||||||
gtkgui_helpers.load_mood_icon(
|
|
||||||
mood).get_pixbuf())
|
mood).get_pixbuf())
|
||||||
# Translate standard moods
|
# Translate standard moods
|
||||||
mood = _(mood.replace('_', ' '))
|
mood = _(mood.replace('_', ' '))
|
||||||
else:
|
else:
|
||||||
self._mood_image.set_from_pixbuf(
|
self._mood_image.set_from_pixbuf(gtkgui_helpers.load_mood_icon(
|
||||||
gtkgui_helpers.load_mood_icon(
|
|
||||||
'unknown').get_pixbuf())
|
'unknown').get_pixbuf())
|
||||||
|
|
||||||
if HAVE_MARKUP_TOOLTIPS:
|
if HAVE_MARKUP_TOOLTIPS:
|
||||||
mood = gobject.markup_escape_text(mood)
|
mood = gobject.markup_escape_text(mood)
|
||||||
text = gobject.markup_escape_text(text)
|
text = gobject.markup_escape_text(text)
|
||||||
|
|
||||||
markup = '<b>%s</b>' % mood
|
tooltip = '<b>%s</b>' % mood
|
||||||
if text != '':
|
if text:
|
||||||
text += '\n' + text
|
tooltip += '\n' + text
|
||||||
self._mood_image.set_tooltip_markup(markup)
|
self._mood_image.set_tooltip_markup(tooltip)
|
||||||
else:
|
else:
|
||||||
markup = mood
|
tooltip = mood
|
||||||
if text != '':
|
if text:
|
||||||
text += '\n' + text
|
tooltip += '\n' + text
|
||||||
self._mood_tooltip.set_tip(self._mood_image, markup)
|
self._mood_tooltip.set_tip(self._mood_image, tooltip)
|
||||||
self._mood_image.show()
|
self._mood_image.show()
|
||||||
else:
|
else:
|
||||||
self._mood_image.hide()
|
self._mood_image.hide()
|
||||||
|
|
||||||
def update_activity(self):
|
def update_activity(self):
|
||||||
activity = None
|
activity = None
|
||||||
subactivity = ''
|
subactivity = None
|
||||||
text = ''
|
text = None
|
||||||
|
|
||||||
if isinstance(self.contact, GC_Contact):
|
if isinstance(self.contact, GC_Contact):
|
||||||
return
|
return
|
||||||
|
@ -1255,16 +1253,14 @@ class ChatControl(ChatControlBase):
|
||||||
if self.contact.activity.has_key('activity'):
|
if self.contact.activity.has_key('activity'):
|
||||||
activity = self.contact.activity['activity'].strip()
|
activity = self.contact.activity['activity'].strip()
|
||||||
if self.contact.activity.has_key('subactivity'):
|
if self.contact.activity.has_key('subactivity'):
|
||||||
subactivity = \
|
subactivity = self.contact.activity['subactivity'].strip()
|
||||||
self.contact.activity['subactivity'].strip()
|
|
||||||
if self.contact.activity.has_key('text'):
|
if self.contact.activity.has_key('text'):
|
||||||
text = self.contact.activity['text'].strip()
|
text = self.contact.activity['text'].strip()
|
||||||
|
|
||||||
if activity is not None:
|
if activity is not None:
|
||||||
if activity in ACTIVITIES:
|
if activity in ACTIVITIES:
|
||||||
self._activity_image.set_from_pixbuf(
|
self._activity_image.set_from_pixbuf(
|
||||||
gtkgui_helpers.load_activity_icon(
|
gtkgui_helpers.load_activity_icon(activity).get_pixbuf())
|
||||||
activity).get_pixbuf())
|
|
||||||
# Translate standard activities
|
# Translate standard activities
|
||||||
if subactivity in ACTIVITIES[activity]:
|
if subactivity in ACTIVITIES[activity]:
|
||||||
subactivity = ACTIVITIES[activity] \
|
subactivity = ACTIVITIES[activity] \
|
||||||
|
@ -1272,8 +1268,7 @@ class ChatControl(ChatControlBase):
|
||||||
activity = ACTIVITIES[activity]['category']
|
activity = ACTIVITIES[activity]['category']
|
||||||
else:
|
else:
|
||||||
self._activity_image.set_from_pixbuf(
|
self._activity_image.set_from_pixbuf(
|
||||||
gtkgui_helpers.load_activity_icon(
|
gtkgui_helpers.load_activity_icon('unknown').get_pixbuf())
|
||||||
'unknown').get_pixbuf())
|
|
||||||
|
|
||||||
# Translate standard subactivities
|
# Translate standard subactivities
|
||||||
|
|
||||||
|
@ -1283,21 +1278,20 @@ class ChatControl(ChatControlBase):
|
||||||
subactivity)
|
subactivity)
|
||||||
text = gobject.markup_escape_text(text)
|
text = gobject.markup_escape_text(text)
|
||||||
|
|
||||||
markup = '<b>' + activity
|
tooltip = '<b>' + activity
|
||||||
if subactivity != '':
|
if subactivity:
|
||||||
markup += ': ' + subactivity
|
tooltip += ': ' + subactivity
|
||||||
markup += '</b>'
|
tooltip += '</b>'
|
||||||
if text != '':
|
if text:
|
||||||
markup += '\n' + text
|
tooltip += '\n' + text
|
||||||
self._activity_image.set_tooltip_markup(markup)
|
self._activity_image.set_tooltip_markup(tooltip)
|
||||||
else:
|
else:
|
||||||
markup = activity
|
tooltip = activity
|
||||||
if subactivity != '':
|
if subactivity:
|
||||||
markup += ': ' + subactivity
|
tooltip += ': ' + subactivity
|
||||||
if text != '':
|
if text:
|
||||||
markup += '\n' + text
|
tooltip += '\n' + text
|
||||||
self._activity_tooltip.set_tip(
|
self._activity_tooltip.set_tip(self._activity_image, tooltip)
|
||||||
self._activity_image, markup)
|
|
||||||
|
|
||||||
self._activity_image.show()
|
self._activity_image.show()
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue