Author: doomhammer Date: 2007-03-31 01:24:12 +0200 (Sat, 31 Mar 2007) New Revision: 8045
Modified: branches/pep/src/common/pep.py branches/pep/src/tooltips.py Log: Activity and Mood in tooltips now bug-free (:P)
Modified: branches/pep/src/common/pep.py =================================================================== --- branches/pep/src/common/pep.py 2007-03-30 22:52:11 UTC (rev 8044) +++ branches/pep/src/common/pep.py 2007-03-30 23:24:12 UTC (rev 8045) @@ -1,18 +1,20 @@ from common import gajim, xmpp
def user_mood(items, name, jid): - #FIXME: text deletion (user, resource) = gajim.get_room_and_nick_from_fjid(jid) contacts = gajim.contacts.get_contact(name, user, resource=resource) for item in items.getTags('item'): child = item.getTag('mood') if child is not None: - for ch in child.getChildren(): - if ch.getName() != 'text': - for contact in contacts: + for contact in contacts: + if contact.mood.has_key('mood'): + del contact.mood['mood'] + if contact.mood.has_key('text'): + del contact.mood['text'] + for ch in child.getChildren(): + if ch.getName() != 'text': contact.mood['mood'] = ch.getName() - else: - for contact in contacts: + else: contact.mood['text'] = ch.getData()
def user_tune(items, name, jid): @@ -22,21 +24,24 @@ pass
def user_activity(items, name, jid): - #FIXME: text deletion (user, resource) = gajim.get_room_and_nick_from_fjid(jid) contacts = gajim.contacts.get_contact(name, user, resource=resource) for item in items.getTags('item'): child = item.getTag('activity') if child is not None: - for ch in child.getChildren(): - if ch.getName() != 'text': - for contact in contacts: + for contact in contacts: + if contact.activity.has_key('activity'): + del contact.activity['activity'] + if contact.activity.has_key('subactivity'): + del contact.activity['subactivity'] + if contact.activity.has_key('text'): + del contact.activity['text'] + for ch in child.getChildren(): + if ch.getName() != 'text': contact.activity['activity'] = ch.getName() - for chi in ch.getChildren(): - for contact in contacts: + for chi in ch.getChildren(): contact.activity['subactivity'] = chi.getName() - else: - for contact in contacts: + else: contact.activity['text'] = ch.getData()
def user_send_mood(account, mood, message = ''):
Modified: branches/pep/src/tooltips.py =================================================================== --- branches/pep/src/tooltips.py 2007-03-30 22:52:11 UTC (rev 8044) +++ branches/pep/src/tooltips.py 2007-03-30 23:24:12 UTC (rev 8045) @@ -479,13 +479,10 @@ # we append show below if contact.mood.has_key('mood'): - mood = contact.mood['mood'].strip() - if contact.mood.has_key('text'): - mood_text = contact.mood['text'].strip() - else: - mood_text = '' - if mood: - properties.append(('Mood: <b>%s</b> (%s)' % (mood, mood_text), None)) + mood_string = 'Mood: <b>%s</b>' % contact.mood['mood'].strip() + if contact.mood.has_key('text') and contact.mood['text'] != '': + mood_string += ' (%s)' % contact.mood['text'].strip() + properties.append((mood_string, None))
if contact.activity.has_key('activity'): activity = contact.activity['activity'].strip()