Show activity in conversation window.
This commit is contained in:
parent
ebea2ef2b0
commit
c06c258b2f
Binary file not shown.
After Width: | Height: | Size: 345 B |
|
@ -45,7 +45,7 @@ from common.contacts import GC_Contact
|
||||||
from common.logger import Constants
|
from common.logger import Constants
|
||||||
constants = Constants()
|
constants = Constants()
|
||||||
from common.rst_xhtml_generator import create_xhtml
|
from common.rst_xhtml_generator import create_xhtml
|
||||||
from common.pep import MOODS
|
from common.pep import MOODS, ACTIVITIES
|
||||||
from common.xmpp.protocol import NS_XHTML, NS_FILE, NS_MUC, NS_RECEIPTS
|
from common.xmpp.protocol import NS_XHTML, NS_FILE, NS_MUC, NS_RECEIPTS
|
||||||
from common.xmpp.protocol import NS_ESESSION
|
from common.xmpp.protocol import NS_ESESSION
|
||||||
|
|
||||||
|
@ -1105,6 +1105,7 @@ class ChatControl(ChatControlBase):
|
||||||
self._tune_tooltip = gtk.Tooltips()
|
self._tune_tooltip = gtk.Tooltips()
|
||||||
|
|
||||||
self.update_mood()
|
self.update_mood()
|
||||||
|
self.update_activity()
|
||||||
self.update_tune()
|
self.update_tune()
|
||||||
|
|
||||||
# keep timeout id and window obj for possible big avatar
|
# keep timeout id and window obj for possible big avatar
|
||||||
|
@ -1203,22 +1204,17 @@ class ChatControl(ChatControlBase):
|
||||||
self._convert_to_gc_button.set_sensitive(False)
|
self._convert_to_gc_button.set_sensitive(False)
|
||||||
|
|
||||||
def update_mood(self):
|
def update_mood(self):
|
||||||
if not isinstance(self.contact, GC_Contact) \
|
|
||||||
and self.contact.mood.has_key('mood'):
|
|
||||||
mood = self.contact.mood['mood']
|
|
||||||
if HAVE_MARKUP_TOOLTIPS:
|
|
||||||
mood = gobject.markup_escape_text(mood)
|
|
||||||
else:
|
|
||||||
mood = None
|
mood = None
|
||||||
|
|
||||||
if not isinstance(self.contact, GC_Contact) \
|
|
||||||
and self.contact.mood.has_key('text'):
|
|
||||||
text = self.contact.mood['text']
|
|
||||||
if HAVE_MARKUP_TOOLTIPS:
|
|
||||||
text = gobject.markup_escape_text(text)
|
|
||||||
else:
|
|
||||||
text = ''
|
text = ''
|
||||||
|
|
||||||
|
if isinstance(self.contact, GC_Contact):
|
||||||
|
return
|
||||||
|
|
||||||
|
if self.contact.mood.has_key('mood'):
|
||||||
|
mood = self.contact.mood['mood']
|
||||||
|
if self.contact.mood.has_key('text'):
|
||||||
|
text = self.contact.mood['text']
|
||||||
|
|
||||||
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(
|
||||||
|
@ -1232,6 +1228,9 @@ class ChatControl(ChatControlBase):
|
||||||
'unknown').get_pixbuf())
|
'unknown').get_pixbuf())
|
||||||
|
|
||||||
if HAVE_MARKUP_TOOLTIPS:
|
if HAVE_MARKUP_TOOLTIPS:
|
||||||
|
mood = gobject.markup_escape_text(mood)
|
||||||
|
text = gobject.markup_escape_text(text)
|
||||||
|
|
||||||
self._mood_image.set_tooltip_markup(
|
self._mood_image.set_tooltip_markup(
|
||||||
'<b>%s</b>%s%s' % (mood,
|
'<b>%s</b>%s%s' % (mood,
|
||||||
'\n' if text is not '' else '', text))
|
'\n' if text is not '' else '', text))
|
||||||
|
@ -1243,23 +1242,79 @@ class ChatControl(ChatControlBase):
|
||||||
else:
|
else:
|
||||||
self._mood_image.hide()
|
self._mood_image.hide()
|
||||||
|
|
||||||
|
def update_activity(self):
|
||||||
|
activity = None
|
||||||
|
subactivity = ''
|
||||||
|
text = ''
|
||||||
|
|
||||||
|
if isinstance(self.contact, GC_Contact):
|
||||||
|
return
|
||||||
|
|
||||||
|
if self.contact.activity.has_key('activity'):
|
||||||
|
activity = self.contact.activity['activity']
|
||||||
|
if self.contact.activity.has_key('subactivity'):
|
||||||
|
subactivity = self.contact.activity['subactivity']
|
||||||
|
if self.contact.activity.has_key('text'):
|
||||||
|
text = self.contact.activity['text']
|
||||||
|
|
||||||
|
if activity is not None:
|
||||||
|
if activity in ACTIVITIES:
|
||||||
|
self._activity_image.set_from_pixbuf(
|
||||||
|
gtkgui_helpers.load_activity_icon(
|
||||||
|
activity).get_pixbuf())
|
||||||
|
# Translate standard activities
|
||||||
|
if subactivity in ACTIVITIES[activity]:
|
||||||
|
subactivity = ACTIVITIES[activity] \
|
||||||
|
[subactivity]
|
||||||
|
activity = ACTIVITIES[activity]['category']
|
||||||
|
else:
|
||||||
|
self._activity_image.set_from_pixbuf(
|
||||||
|
gtkgui_helpers.load_activity_icon(
|
||||||
|
'unknown').get_pixbuf())
|
||||||
|
|
||||||
|
# Translate standard subactivities
|
||||||
|
|
||||||
|
if HAVE_MARKUP_TOOLTIPS:
|
||||||
|
activity = gobject.markup_escape_text(activity)
|
||||||
|
subactivity = gobject.markup_escape_text(
|
||||||
|
subactivity)
|
||||||
|
text = gobject.markup_escape_text(text)
|
||||||
|
|
||||||
|
self._activity_image.set_tooltip_markup(
|
||||||
|
'<b>%s%s%s</b>%s%s' % (activity,
|
||||||
|
': ' if subactivity is not '' else '',
|
||||||
|
subactivity,
|
||||||
|
'\n' if text is not '' else '', text))
|
||||||
|
else:
|
||||||
|
self._activity_tooltip.set_tip(
|
||||||
|
self._activity_image, '%s%s%s%s%s' % (
|
||||||
|
activity,
|
||||||
|
': ' if subactivity is not '' else '',
|
||||||
|
subactivity,
|
||||||
|
'\n' if text is not '' else '', text))
|
||||||
|
|
||||||
|
self._activity_image.show()
|
||||||
|
else:
|
||||||
|
self._activity_image.hide()
|
||||||
|
|
||||||
|
|
||||||
def update_tune(self):
|
def update_tune(self):
|
||||||
artist = None
|
artist = None
|
||||||
title = None
|
title = None
|
||||||
source = None
|
source = None
|
||||||
|
|
||||||
if not isinstance(self.contact, GC_Contact) \
|
if isinstance(self.contact, GC_Contact):
|
||||||
and self.contact.tune.has_key('artist'):
|
return
|
||||||
|
|
||||||
|
if self.contact.tune.has_key('artist'):
|
||||||
artist = self.contact.tune['artist'].strip()
|
artist = self.contact.tune['artist'].strip()
|
||||||
if HAVE_MARKUP_TOOLTIPS:
|
if HAVE_MARKUP_TOOLTIPS:
|
||||||
artist = gobject.markup_escape_text(artist)
|
artist = gobject.markup_escape_text(artist)
|
||||||
if not isinstance(self.contact, GC_Contact) \
|
if self.contact.tune.has_key('title'):
|
||||||
and self.contact.tune.has_key('title'):
|
|
||||||
title = self.contact.tune['title'].strip()
|
title = self.contact.tune['title'].strip()
|
||||||
if HAVE_MARKUP_TOOLTIPS:
|
if HAVE_MARKUP_TOOLTIPS:
|
||||||
title = gobject.markup_escape_text(title)
|
title = gobject.markup_escape_text(title)
|
||||||
if not isinstance(self.contact, GC_Contact) \
|
if self.contact.tune.has_key('source'):
|
||||||
and self.contact.tune.has_key('source'):
|
|
||||||
source = self.contact.tune['source'].strip()
|
source = self.contact.tune['source'].strip()
|
||||||
if HAVE_MARKUP_TOOLTIPS:
|
if HAVE_MARKUP_TOOLTIPS:
|
||||||
source = gobject.markup_escape_text(source)
|
source = gobject.markup_escape_text(source)
|
||||||
|
|
|
@ -12,7 +12,7 @@ MOODS = ['afraid', 'amazed', 'angry', 'annoyed', 'anxious', 'aroused',
|
||||||
'shy', 'sick', 'sleepy', 'stressed', 'surprised', 'thirsty', 'worried']
|
'shy', 'sick', 'sleepy', 'stressed', 'surprised', 'thirsty', 'worried']
|
||||||
|
|
||||||
ACTIVITIES = {
|
ACTIVITIES = {
|
||||||
'doing_chores': {
|
'doing_chores': {'category': _('Doing Chores'),
|
||||||
'buying_groceries': _('Buying Groceries'),
|
'buying_groceries': _('Buying Groceries'),
|
||||||
'cleaning': _('Cleaning'),
|
'cleaning': _('Cleaning'),
|
||||||
'cooking': _('Cooking'),
|
'cooking': _('Cooking'),
|
||||||
|
@ -22,16 +22,16 @@ ACTIVITIES = {
|
||||||
'gardening': _('Gardening'),
|
'gardening': _('Gardening'),
|
||||||
'running_an_errand': _('Running an Errand'),
|
'running_an_errand': _('Running an Errand'),
|
||||||
'walking_the_dog': _('Walking the Dog')},
|
'walking_the_dog': _('Walking the Dog')},
|
||||||
'drinking': {
|
'drinking': {'category': _('Drinking'),
|
||||||
'having_a_beer': _('Having a Beer'),
|
'having_a_beer': _('Having a Beer'),
|
||||||
'having_coffee': _('Having Coffee'),
|
'having_coffee': _('Having Coffee'),
|
||||||
'having_tea': _('Having Tea')},
|
'having_tea': _('Having Tea')},
|
||||||
'eating': {
|
'eating': {'category': _('Eating'),
|
||||||
'having_a_snack': _('Having a Snack'),
|
'having_a_snack': _('Having a Snack'),
|
||||||
'having_breakfast': _('Having Breakfast'),
|
'having_breakfast': _('Having Breakfast'),
|
||||||
'having_dinner': _('Having Dinner'),
|
'having_dinner': _('Having Dinner'),
|
||||||
'having_lunch': _('Having Lunch')},
|
'having_lunch': _('Having Lunch')},
|
||||||
'exercising': {
|
'exercising': {'category': _('Exercising'),
|
||||||
'cycling': _('Cycling'),
|
'cycling': _('Cycling'),
|
||||||
'hiking': _('Hiking'),
|
'hiking': _('Hiking'),
|
||||||
'jogging': _('Jogging'),
|
'jogging': _('Jogging'),
|
||||||
|
@ -40,21 +40,21 @@ ACTIVITIES = {
|
||||||
'skiing': _('Skiing'),
|
'skiing': _('Skiing'),
|
||||||
'swimming': _('Swimming'),
|
'swimming': _('Swimming'),
|
||||||
'working_out': _('Working out')},
|
'working_out': _('Working out')},
|
||||||
'grooming': {
|
'grooming': {'category': _('Grooming'),
|
||||||
'at_the_spa': _('At the Spa'),
|
'at_the_spa': _('At the Spa'),
|
||||||
'brushing_teeth': _('Brushing Teeth'),
|
'brushing_teeth': _('Brushing Teeth'),
|
||||||
'getting_a_haircut': _('Getting a Haircut'),
|
'getting_a_haircut': _('Getting a Haircut'),
|
||||||
'shaving': _('Shaving'),
|
'shaving': _('Shaving'),
|
||||||
'taking_a_bath': _('Taking a Bath'),
|
'taking_a_bath': _('Taking a Bath'),
|
||||||
'taking_a_shower': _('Taking a Shower')},
|
'taking_a_shower': _('Taking a Shower')},
|
||||||
'having_appointment': {},
|
'having_appointment': {'category:': _('Having an Appointment')},
|
||||||
'inactive': {
|
'inactive': {'category': _('Inactive'),
|
||||||
'day_off': _('Day Off'),
|
'day_off': _('Day Off'),
|
||||||
'hanging_out': _('Haning out'),
|
'hanging_out': _('Haning out'),
|
||||||
'on_vacation': _('On Vacation'),
|
'on_vacation': _('On Vacation'),
|
||||||
'scheduled_holiday': _('Scheduled Holiday'),
|
'scheduled_holiday': _('Scheduled Holiday'),
|
||||||
'sleeping': _('Sleeping')},
|
'sleeping': _('Sleeping')},
|
||||||
'relaxing': {
|
'relaxing': {'category': _('Relaxing'),
|
||||||
'gaming': _('Gaming'),
|
'gaming': _('Gaming'),
|
||||||
'going_out': _('Going out'),
|
'going_out': _('Going out'),
|
||||||
'partying': _('Partying'),
|
'partying': _('Partying'),
|
||||||
|
@ -65,11 +65,11 @@ ACTIVITIES = {
|
||||||
'sunbathing': _('Sunbathing'),
|
'sunbathing': _('Sunbathing'),
|
||||||
'watching_tv': _('Watching TV'),
|
'watching_tv': _('Watching TV'),
|
||||||
'watching_a_movie': _('Watching a Movie')},
|
'watching_a_movie': _('Watching a Movie')},
|
||||||
'talking': {
|
'talking': {'category': _('Talking'),
|
||||||
'in_real_life': _('In Real Life'),
|
'in_real_life': _('In Real Life'),
|
||||||
'on_the_phone': _('On the Phone'),
|
'on_the_phone': _('On the Phone'),
|
||||||
'on_video_phone': _('On Video Phone')},
|
'on_video_phone': _('On Video Phone')},
|
||||||
'traveling': {
|
'traveling': {'category': _('Traveling'),
|
||||||
'commuting': _('Commuting'),
|
'commuting': _('Commuting'),
|
||||||
'cycling': _('Cycling'),
|
'cycling': _('Cycling'),
|
||||||
'driving': _('Driving'),
|
'driving': _('Driving'),
|
||||||
|
@ -79,7 +79,7 @@ ACTIVITIES = {
|
||||||
'on_a_train': _('On a Train'),
|
'on_a_train': _('On a Train'),
|
||||||
'on_a_trip': _('On a Trip'),
|
'on_a_trip': _('On a Trip'),
|
||||||
'walking': _('Walking')},
|
'walking': _('Walking')},
|
||||||
'working': {
|
'working': {'category': _('Working'),
|
||||||
'coding': _('Coding'),
|
'coding': _('Coding'),
|
||||||
'in_a_meeting': _('In a Meeting'),
|
'in_a_meeting': _('In a Meeting'),
|
||||||
'studying': _('Studying'),
|
'studying': _('Studying'),
|
||||||
|
@ -319,6 +319,14 @@ def user_activity(items, name, jid):
|
||||||
if contact.activity.has_key('text'):
|
if contact.activity.has_key('text'):
|
||||||
del contact.activity['text']
|
del contact.activity['text']
|
||||||
|
|
||||||
|
#if jid == gajim.get_jid_from_account(name):
|
||||||
|
# gajim.interface.roster.draw_account(name)
|
||||||
|
#else:
|
||||||
|
# gajim.interface.roster.draw_activity(user, name)
|
||||||
|
ctrl = gajim.interface.msg_win_mgr.get_control(user, name)
|
||||||
|
if ctrl:
|
||||||
|
ctrl.update_activity()
|
||||||
|
|
||||||
def user_nickname(items, name, jid):
|
def user_nickname(items, name, jid):
|
||||||
has_child = False
|
has_child = False
|
||||||
retract = False
|
retract = False
|
||||||
|
|
|
@ -360,6 +360,9 @@ class ChangeActivityDialog:
|
||||||
|
|
||||||
vbox = self.xml.get_widget(category + '_vbox')
|
vbox = self.xml.get_widget(category + '_vbox')
|
||||||
for activity in pep.ACTIVITIES[category]:
|
for activity in pep.ACTIVITIES[category]:
|
||||||
|
if activity == 'category':
|
||||||
|
continue
|
||||||
|
|
||||||
act = category + '_' + activity
|
act = category + '_' + activity
|
||||||
|
|
||||||
if group:
|
if group:
|
||||||
|
|
Loading…
Reference in New Issue