diff --git a/src/chat_control.py b/src/chat_control.py
index b69c686fe..902cf8bc0 100644
--- a/src/chat_control.py
+++ b/src/chat_control.py
@@ -1220,7 +1220,7 @@ class ChatControl(ChatControlBase):
self._mood_image.set_from_pixbuf(gtkgui_helpers.load_mood_icon(
mood).get_pixbuf())
# Translate standard moods
- mood = _(mood.replace('_', ' '))
+ mood = MOODS[mood]
else:
self._mood_image.set_from_pixbuf(gtkgui_helpers.load_mood_icon(
'unknown').get_pixbuf())
diff --git a/src/common/pep.py b/src/common/pep.py
index 3511f1566..8ebe57a33 100644
--- a/src/common/pep.py
+++ b/src/common/pep.py
@@ -1,16 +1,37 @@
from common import gajim, xmpp
-MOODS = ['afraid', 'amazed', 'angry', 'annoyed', 'anxious', 'aroused',
- 'ashamed', 'bored', 'brave', 'calm', 'cold', 'confused', 'contented',
- 'cranky', 'curious', 'depressed', 'disappointed', 'disgusted',
- 'distracted', 'embarrassed', 'excited', 'flirtatious', 'frustrated',
- 'grumpy', 'guilty', 'happy', 'hot', 'humbled', 'humiliated', 'hungry',
- 'hurt', 'impressed', 'in_awe', 'in_love', 'indignant', 'interested',
- 'intoxicated', 'invincible', 'jealous', 'lonely', 'mean', 'moody',
- 'nervous', 'neutral', 'offended', 'playful', 'proud', 'relieved',
- 'remorseful', 'restless', 'sad', 'sarcastic', 'serious', 'shocked',
- 'shy', 'sick', 'sleepy', 'stressed', 'surprised', 'thirsty',
- 'thoughtful', 'worried']
+MOODS = {
+ 'afraid': _('Afraid'), 'amazed': _('Amazed'),
+ 'angry': _('Angry'), 'annoyed': _('Annoyed'),
+ 'anxious': _('Anxious'), 'aroused': _('Aroused'),
+ 'ashamed': _('Ashamed'), 'bored': _('Bored'),
+ 'brave': _('Brave'), 'calm': _('Calm'),
+ 'cold': _('Cold'), 'confused': _('Confused'),
+ 'contented': _('Contented'), 'cranky': _('Cranky'),
+ 'curious': _('Curious'), 'depressed': _('Depressed'),
+ 'disappointed': _('Disappointed'), 'disgusted': _('Disgusted'),
+ 'distracted': _('Distracted'), 'embarrassed': _('Embarassed'),
+ 'excited': _('Excited'), 'flirtatious': _('Flirtatious'),
+ 'frustrated': _('Frustrated'), 'grumpy': _('Grumpy'),
+ 'guilty': _('Guilty'), 'happy': _('Happy'),
+ 'hot': _('Hot'), 'humbled': _('Humbled'),
+ 'humiliated': _('Humiliated'), 'hungry': _('Hungry'),
+ 'hurt': _('Hurt'), 'impressed': _('Impressed'),
+ 'in_awe': _('In Awe'), 'in_love': _('In Love'),
+ 'indignant': _('Indignant'), 'interested': _('Interested'),
+ 'intoxicated': _('Intoxicated'), 'invincible': _('Invincible'),
+ 'jealous': _('Jealous'), 'lonely': _('Lonely'),
+ 'mean': _('Mean'), 'moody': _('Moody'),
+ 'nervous': _('Nervous'), 'neutral': _('Neutral'),
+ 'offended': _('Offended'), 'playful': _('Playful'),
+ 'proud': _('Proud'), 'relieved': _('Relieved'),
+ 'remorseful': _('Remorseful'), 'restless': _('Restless'),
+ 'sad': _('Sad'), 'sarcastic': _('Sarcastic'),
+ 'serious': _('Serious'), 'shocked': _('Shocked'),
+ 'shy': _('Shy'), 'sick': _('Sick'),
+ 'sleepy': _('Sleepy'), 'stressed': _('Stressed'),
+ 'surprised': _('Surprised'), 'thirsty': _('Thirsty'),
+ 'thoughtful': _('Thoughtful'), 'worried': _('Worried')}
# These moods are only available in the Gajim namespace
GAJIM_MOODS = ['thoughtful']
diff --git a/src/dialogs.py b/src/dialogs.py
index 745cc1ca3..53824c3f7 100644
--- a/src/dialogs.py
+++ b/src/dialogs.py
@@ -471,19 +471,22 @@ class ChangeMoodDialog:
x = 1
y = 0
self.mood_buttons = {}
+
+ # Order them first
+ self.MOODS = []
for mood in pep.MOODS:
- self.mood_buttons[mood] = gtk.RadioButton(
- no_mood_button)
+ self.MOODS.append(mood)
+ self.MOODS.sort()
+
+ for mood in self.MOODS:
+ self.mood_buttons[mood] = gtk.RadioButton(no_mood_button)
self.mood_buttons[mood].set_mode(False)
- self.mood_buttons[mood].add(
- gtkgui_helpers.load_mood_icon(mood))
+ self.mood_buttons[mood].add(gtkgui_helpers.load_mood_icon(mood))
self.mood_buttons[mood].set_relief(gtk.RELIEF_NONE)
- gtk.Tooltips().set_tip(self.mood_buttons[mood],
- _(mood.replace('_', ' ')))
+ gtk.Tooltips().set_tip(self.mood_buttons[mood], pep.MOODS[mood])
self.mood_buttons[mood].connect('clicked',
self.on_mood_button_clicked, mood)
- table.attach(self.mood_buttons[mood],
- x, x + 1, y, y + 1)
+ table.attach(self.mood_buttons[mood], x, x + 1, y, y + 1)
# Calculate the next position
x += 1
@@ -494,11 +497,11 @@ class ChangeMoodDialog:
con = gajim.connections[account]
if 'mood' in con.mood:
self.mood = con.mood['mood']
- self.label.set_text(_(
- con.mood['mood'].replace('_', ' ')))
- if con.mood['mood'] in pep.MOODS:
- self.mood_buttons[con.mood['mood']]. \
- set_active(True)
+ if self.mood in pep.MOODS:
+ self.mood_buttons[self.mood].set_active(True)
+ self.label.set_text(pep.MOODS[self.mood])
+ else:
+ self.label.set_text(self.mood)
if self.mood:
self.entry.set_sensitive(True)
@@ -513,7 +516,7 @@ class ChangeMoodDialog:
def on_mood_button_clicked(self, widget, data):
if data:
- self.label.set_text(_(data.replace('_', ' ')))
+ self.label.set_text(pep.MOODS[data])
self.entry.set_sensitive(True)
else:
self.label.set_text(_('None'))
diff --git a/src/tooltips.py b/src/tooltips.py
index ac6dcd814..f6a8fbf88 100644
--- a/src/tooltips.py
+++ b/src/tooltips.py
@@ -31,7 +31,7 @@ import gtkgui_helpers
from common import gajim
from common import helpers
-from common.pep import ACTIVITIES
+from common.pep import MOODS, ACTIVITIES
class BaseTooltip:
''' Base Tooltip class;
@@ -574,9 +574,10 @@ class RosterTooltip(NotificationAreaTooltip):
'''
if contact.mood.has_key('mood'):
mood = contact.mood['mood'].strip()
+ if mood in MOODS:
+ mood = MOODS[mood]
mood = gobject.markup_escape_text(mood)
- mood_string = _('Mood:') + ' %s' % \
- _(mood.replace('_', ' '))
+ mood_string = _('Mood:') + ' %s' % mood
if contact.mood.has_key('text') \
and contact.mood['text'] != '':
mood_text = contact.mood['text'].strip()