Show mood in chat window.
This commit is contained in:
parent
9ecf0e5fa9
commit
c5e679a078
9 changed files with 123 additions and 33 deletions
|
@ -63,6 +63,42 @@
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHBox" id="hbox2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="spacing">2</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkImage" id="mood_image">
|
||||||
|
<property name="no_show_all">True</property>
|
||||||
|
<property name="stock">gtk-missing-image</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkImage" id="activity_image">
|
||||||
|
<property name="no_show_all">True</property>
|
||||||
|
<property name="stock">gtk-missing-image</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkImage" id="tune_image">
|
||||||
|
<property name="no_show_all">True</property>
|
||||||
|
<property name="stock">gtk-missing-image</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="padding">15</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkEventBox" id="avatar_eventbox">
|
<widget class="GtkEventBox" id="avatar_eventbox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -77,7 +113,7 @@
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">False</property>
|
<property name="fill">False</property>
|
||||||
<property name="position">2</property>
|
<property name="position">3</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -112,8 +148,8 @@
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkButton" id="authentication_button">
|
<widget class="GtkButton" id="authentication_button">
|
||||||
<property name="no_show_all">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="no_show_all">True</property>
|
||||||
<property name="relief">GTK_RELIEF_NONE</property>
|
<property name="relief">GTK_RELIEF_NONE</property>
|
||||||
<property name="focus_on_click">False</property>
|
<property name="focus_on_click">False</property>
|
||||||
<property name="response_id">0</property>
|
<property name="response_id">0</property>
|
||||||
|
@ -127,7 +163,6 @@
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="padding">0</property>
|
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
|
|
@ -45,7 +45,9 @@ 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.xmpp.protocol import NS_XHTML, NS_FILE, NS_MUC, NS_RECEIPTS, NS_ESESSION
|
from common.pep import MOODS
|
||||||
|
from common.xmpp.protocol import NS_XHTML, NS_FILE, NS_MUC, NS_RECEIPTS
|
||||||
|
from common.xmpp.protocol import NS_ESESSION
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import gtkspell
|
import gtkspell
|
||||||
|
@ -1083,6 +1085,12 @@ class ChatControl(ChatControlBase):
|
||||||
|
|
||||||
self.update_toolbar()
|
self.update_toolbar()
|
||||||
|
|
||||||
|
self._mood_image = self.xml.get_widget('mood_image')
|
||||||
|
self._activity_image = self.xml.get_widget('activity_image')
|
||||||
|
self._tune_image = self.xml.get_widget('tune_image')
|
||||||
|
|
||||||
|
self.update_mood()
|
||||||
|
|
||||||
# keep timeout id and window obj for possible big avatar
|
# keep timeout id and window obj for possible big avatar
|
||||||
# it is on enter-notify and leave-notify so no need to be
|
# it is on enter-notify and leave-notify so no need to be
|
||||||
# per jid
|
# per jid
|
||||||
|
@ -1186,6 +1194,37 @@ class ChatControl(ChatControlBase):
|
||||||
else:
|
else:
|
||||||
self._convert_to_gc_button.set_sensitive(False)
|
self._convert_to_gc_button.set_sensitive(False)
|
||||||
|
|
||||||
|
def update_mood(self):
|
||||||
|
if self.contact.mood.has_key('mood'):
|
||||||
|
mood = gobject.markup_escape_text(
|
||||||
|
self.contact.mood['mood'])
|
||||||
|
else:
|
||||||
|
mood = None
|
||||||
|
|
||||||
|
if self.contact.mood.has_key('text'):
|
||||||
|
text = gobject.markup_escape_text(
|
||||||
|
self.contact.mood['text'])
|
||||||
|
else:
|
||||||
|
text = ''
|
||||||
|
|
||||||
|
if mood is not None:
|
||||||
|
if mood in MOODS:
|
||||||
|
self._mood_image.set_from_pixbuf(
|
||||||
|
gtkgui_helpers.load_mood_icon(
|
||||||
|
mood).get_pixbuf())
|
||||||
|
# Translate standard moods
|
||||||
|
mood = _(mood)
|
||||||
|
else:
|
||||||
|
self._mood_image.set_from_pixbuf(
|
||||||
|
gtkgui_helpers.load_mood_icon(
|
||||||
|
'unknown').get_pixbuf())
|
||||||
|
|
||||||
|
self._mood_image.set_tooltip_markup('<b>%s</b>%s%s' %
|
||||||
|
(mood, '\n' if text is not '' else '', text))
|
||||||
|
self._mood_image.show()
|
||||||
|
else:
|
||||||
|
self._mood_image.hide()
|
||||||
|
|
||||||
def on_avatar_eventbox_enter_notify_event(self, widget, event):
|
def on_avatar_eventbox_enter_notify_event(self, widget, event):
|
||||||
'''
|
'''
|
||||||
we enter the eventbox area so we under conditions add a timeout
|
we enter the eventbox area so we under conditions add a timeout
|
||||||
|
|
|
@ -51,6 +51,7 @@ opt_treat_incoming_messages = ['', 'chat', 'normal']
|
||||||
class Config:
|
class Config:
|
||||||
|
|
||||||
DEFAULT_ICONSET = 'dcraven'
|
DEFAULT_ICONSET = 'dcraven'
|
||||||
|
DEFAULT_MOOD_ICONSET = 'default'
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
DEFAULT_OPENWITH = 'open'
|
DEFAULT_OPENWITH = 'open'
|
||||||
DEFAULT_BROWSER = 'open -a Safari'
|
DEFAULT_BROWSER = 'open -a Safari'
|
||||||
|
@ -92,6 +93,7 @@ class Config:
|
||||||
'last_status_msg_offline': [ opt_str, '' ],
|
'last_status_msg_offline': [ opt_str, '' ],
|
||||||
'trayicon': [ opt_bool, True, '', True ],
|
'trayicon': [ opt_bool, True, '', True ],
|
||||||
'iconset': [ opt_str, DEFAULT_ICONSET, '', True ],
|
'iconset': [ opt_str, DEFAULT_ICONSET, '', True ],
|
||||||
|
'mood_iconset': [ opt_str, DEFAULT_MOOD_ICONSET, '', True ],
|
||||||
'use_transports_iconsets': [ opt_bool, True, '', True ],
|
'use_transports_iconsets': [ opt_bool, True, '', True ],
|
||||||
'inmsgcolor': [ opt_color, '#a34526', '', True ],
|
'inmsgcolor': [ opt_color, '#a34526', '', True ],
|
||||||
'outmsgcolor': [ opt_color, '#164e6f', '', True ],
|
'outmsgcolor': [ opt_color, '#164e6f', '', True ],
|
||||||
|
|
|
@ -79,9 +79,9 @@ class ConfigPaths:
|
||||||
|
|
||||||
# LOG is deprecated
|
# LOG is deprecated
|
||||||
k = ( 'LOG', 'LOG_DB', 'VCARD', 'AVATAR', 'MY_EMOTS',
|
k = ( 'LOG', 'LOG_DB', 'VCARD', 'AVATAR', 'MY_EMOTS',
|
||||||
'MY_ICONSETS', 'MY_CACERTS')
|
'MY_ICONSETS', 'MY_MOOD_ICONSETS', 'MY_CACERTS')
|
||||||
v = (u'logs', u'logs.db', u'vcards', u'avatars', u'emoticons',
|
v = (u'logs', u'logs.db', u'vcards', u'avatars', u'emoticons',
|
||||||
u'iconsets', u'cacerts.pem')
|
u'iconsets', u'moods', u'cacerts.pem')
|
||||||
|
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
v = map(lambda x: x.capitalize(), v)
|
v = map(lambda x: x.capitalize(), v)
|
||||||
|
|
|
@ -81,6 +81,7 @@ VCARD_PATH = gajimpaths['VCARD']
|
||||||
AVATAR_PATH = gajimpaths['AVATAR']
|
AVATAR_PATH = gajimpaths['AVATAR']
|
||||||
MY_EMOTS_PATH = gajimpaths['MY_EMOTS']
|
MY_EMOTS_PATH = gajimpaths['MY_EMOTS']
|
||||||
MY_ICONSETS_PATH = gajimpaths['MY_ICONSETS']
|
MY_ICONSETS_PATH = gajimpaths['MY_ICONSETS']
|
||||||
|
MY_MOOD_ICONSETS_PATH = gajimpaths['MY_MOOD_ICONSETS']
|
||||||
MY_CACERTS = gajimpaths['MY_CACERTS']
|
MY_CACERTS = gajimpaths['MY_CACERTS']
|
||||||
TMP = gajimpaths['TMP']
|
TMP = gajimpaths['TMP']
|
||||||
DATA_DIR = gajimpaths['DATA']
|
DATA_DIR = gajimpaths['DATA']
|
||||||
|
|
|
@ -1179,6 +1179,12 @@ def get_iconset_path(iconset):
|
||||||
elif os.path.isdir(os.path.join(gajim.MY_ICONSETS_PATH, iconset)):
|
elif os.path.isdir(os.path.join(gajim.MY_ICONSETS_PATH, iconset)):
|
||||||
return os.path.join(gajim.MY_ICONSETS_PATH, iconset)
|
return os.path.join(gajim.MY_ICONSETS_PATH, iconset)
|
||||||
|
|
||||||
|
def get_mood_iconset_path(iconset):
|
||||||
|
if os.path.isdir(os.path.join(gajim.DATA_DIR, 'moods', iconset)):
|
||||||
|
return os.path.join(gajim.DATA_DIR, 'moods', iconset)
|
||||||
|
elif os.path.isdir(os.path.join(gajim.MY_MOOD_ICONSETS_PATH, iconset)):
|
||||||
|
return os.path.join(gajim.MY_MOOD_ICONSETS_PATH, iconset)
|
||||||
|
|
||||||
def get_transport_path(transport):
|
def get_transport_path(transport):
|
||||||
if os.path.isdir(os.path.join(gajim.DATA_DIR, 'iconsets', 'transports',
|
if os.path.isdir(os.path.join(gajim.DATA_DIR, 'iconsets', 'transports',
|
||||||
transport)):
|
transport)):
|
||||||
|
|
|
@ -1,5 +1,16 @@
|
||||||
from common import gajim, xmpp
|
from common import gajim, xmpp
|
||||||
|
|
||||||
|
MOODS = ['None', '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', 'worried']
|
||||||
|
|
||||||
def user_mood(items, name, jid):
|
def user_mood(items, name, jid):
|
||||||
has_child = False
|
has_child = False
|
||||||
retract = False
|
retract = False
|
||||||
|
|
|
@ -37,6 +37,7 @@ import message_control
|
||||||
import dataforms_widget
|
import dataforms_widget
|
||||||
|
|
||||||
from random import randrange
|
from random import randrange
|
||||||
|
from common.pep import MOODS
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import gtkspell
|
import gtkspell
|
||||||
|
@ -442,19 +443,7 @@ class ChangeActivityDialog:
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
class ChangeMoodDialog:
|
class ChangeMoodDialog:
|
||||||
moods = ['None', 'afraid', 'amazed', 'angry', 'annoyed', 'anxious',
|
moods = MOODS
|
||||||
'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', 'worried']
|
|
||||||
def __init__(self, account):
|
def __init__(self, account):
|
||||||
self.account = account
|
self.account = account
|
||||||
self.xml = gtkgui_helpers.get_glade('change_mood_dialog.glade')
|
self.xml = gtkgui_helpers.get_glade('change_mood_dialog.glade')
|
||||||
|
|
|
@ -882,7 +882,14 @@ def load_iconset(path, pixbuf2 = None, transport = False):
|
||||||
def load_icon(icon_name):
|
def load_icon(icon_name):
|
||||||
'''load an icon from the iconset in 16x16'''
|
'''load an icon from the iconset in 16x16'''
|
||||||
iconset = gajim.config.get('iconset')
|
iconset = gajim.config.get('iconset')
|
||||||
path = os.path.join(helpers.get_iconset_path(iconset), '16x16' + '/')
|
path = os.path.join(helpers.get_iconset_path(iconset), '16x16', '')
|
||||||
|
icon_list = _load_icon_list([icon_name], path)
|
||||||
|
return icon_list[icon_name]
|
||||||
|
|
||||||
|
def load_mood_icon(icon_name):
|
||||||
|
'''load an icon from the mood iconset in 16x16'''
|
||||||
|
iconset = gajim.config.get('mood_iconset')
|
||||||
|
path = os.path.join(helpers.get_mood_iconset_path(iconset), '')
|
||||||
icon_list = _load_icon_list([icon_name], path)
|
icon_list = _load_icon_list([icon_name], path)
|
||||||
return icon_list[icon_name]
|
return icon_list[icon_name]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue