Move function closer to where it is used.
This makes it easier to reason about its usage.
This commit is contained in:
parent
07c008cbaa
commit
96b9326b0f
|
@ -204,12 +204,6 @@ from common import gajim
|
|||
|
||||
import gtkgui_helpers
|
||||
|
||||
def translate_mood(mood):
|
||||
if mood in MOODS:
|
||||
return MOODS[mood]
|
||||
else:
|
||||
return mood
|
||||
|
||||
|
||||
class AbstractPEP(object):
|
||||
|
||||
|
@ -293,13 +287,19 @@ class UserMoodPEP(AbstractPEP):
|
|||
def asMarkupText(self):
|
||||
assert not self._retracted
|
||||
untranslated_mood = self._pep_specific_data['mood']
|
||||
mood = translate_mood(untranslated_mood)
|
||||
mood = _translate_mood(untranslated_mood)
|
||||
markuptext = '<b>%s</b>' % gobject.markup_escape_text(mood)
|
||||
if 'text' in self._pep_specific_data:
|
||||
text = self._pep_specific_data['text']
|
||||
markuptext += ' (%s)' % gobject.markup_escape_text(text)
|
||||
return markuptext
|
||||
|
||||
def _translate_mood(mood):
|
||||
if mood in MOODS:
|
||||
return MOODS[mood]
|
||||
else:
|
||||
return mood
|
||||
|
||||
|
||||
class UserTunePEP(AbstractPEP):
|
||||
'''XEP-0118: User Tune'''
|
||||
|
|
Loading…
Reference in New Issue