Show
Ignore:
Timestamp:
07/22/08 23:08:52 (4 months ago)
Author:
js
Message:

Show mood in chat window.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/chat_control.py

    r9982 r9986  
    4646constants = Constants() 
    4747from common.rst_xhtml_generator import create_xhtml 
    48 from common.xmpp.protocol import NS_XHTML, NS_FILE, NS_MUC, NS_RECEIPTS, NS_ESESSION 
     48from common.pep import MOODS 
     49from common.xmpp.protocol import NS_XHTML, NS_FILE, NS_MUC, NS_RECEIPTS 
     50from common.xmpp.protocol import NS_ESESSION 
    4951 
    5052try: 
     
    10841086                self.update_toolbar() 
    10851087 
     1088                self._mood_image = self.xml.get_widget('mood_image') 
     1089                self._activity_image = self.xml.get_widget('activity_image') 
     1090                self._tune_image = self.xml.get_widget('tune_image') 
     1091 
     1092                self.update_mood() 
     1093 
    10861094                # keep timeout id and window obj for possible big avatar 
    10871095                # it is on enter-notify and leave-notify so no need to be 
     
    11861194                else: 
    11871195                        self._convert_to_gc_button.set_sensitive(False) 
     1196 
     1197        def update_mood(self): 
     1198                if self.contact.mood.has_key('mood'): 
     1199                        mood = gobject.markup_escape_text( 
     1200                                self.contact.mood['mood']) 
     1201                else: 
     1202                        mood = None 
     1203 
     1204                if self.contact.mood.has_key('text'): 
     1205                        text = gobject.markup_escape_text( 
     1206                                self.contact.mood['text']) 
     1207                else: 
     1208                        text = '' 
     1209 
     1210                if mood is not None: 
     1211                        if mood in MOODS: 
     1212                                self._mood_image.set_from_pixbuf( 
     1213                                        gtkgui_helpers.load_mood_icon( 
     1214                                                mood).get_pixbuf()) 
     1215                                # Translate standard moods 
     1216                                mood = _(mood) 
     1217                        else: 
     1218                                self._mood_image.set_from_pixbuf( 
     1219                                        gtkgui_helpers.load_mood_icon( 
     1220                                        'unknown').get_pixbuf()) 
     1221 
     1222                        self._mood_image.set_tooltip_markup('<b>%s</b>%s%s' % 
     1223                                (mood, '\n' if text is not '' else '', text)) 
     1224                        self._mood_image.show() 
     1225                else: 
     1226                        self._mood_image.hide() 
    11881227 
    11891228        def on_avatar_eventbox_enter_notify_event(self, widget, event):