emoticons support !

This commit is contained in:
Yann Leboulanger 2005-01-18 10:17:03 +00:00
parent a35c47bf22
commit 5d3504f996
41 changed files with 236 additions and 1 deletions

View file

@ -217,6 +217,13 @@ class preference_Window:
else:
self.plugin.config['mergeaccounts'] = 0
self.plugin.roster.regroup = self.plugin.config['mergeaccounts']
#use emoticons
chk = self.xml.get_widget('use_emoticons_checkbutton')
if chk.get_active():
self.plugin.config['useemoticons'] = 1
self.plugin.roster.mkemoticons()
else:
self.plugin.config['useemoticons'] = 0
#autopopup
if self.chk_autopp.get_active():
self.plugin.config['autopopup'] = 1
@ -356,6 +363,8 @@ class preference_Window:
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Preferences', APP)
self.window = self.xml.get_widget('Preferences')
self.plugin = plugin
self.xml.get_widget('image_emoticons').set_from_file(\
'plugins/gtkgui/pixmaps/smile.png')
self.combo_iconstyle = self.xml.get_widget('combo_iconstyle')
self.chk_autopp = self.xml.get_widget('chk_autopopup')
self.chk_autoppaway = self.xml.get_widget('chk_autopopupaway')
@ -400,6 +409,10 @@ class preference_Window:
#Merge accounts
st = self.plugin.config['mergeaccounts']
self.xml.get_widget('merge_checkbutton').set_active(st)
#Use emoticons
st = self.plugin.config['useemoticons']
self.xml.get_widget('use_emoticons_checkbutton').set_active(st)
#Autopopup
st = self.plugin.config['autopopup']

Binary file not shown.

After

Width:  |  Height:  |  Size: 679 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 678 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 657 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 678 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 720 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 872 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 624 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 779 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 714 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 944 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 689 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 749 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 712 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 899 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 689 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 780 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 757 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 753 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 832 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 770 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 609 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 825 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

View file

@ -4173,6 +4173,116 @@ on the server.</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox46">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkVBox" id="vbox47">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkCheckButton" id="use_emoticons_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Use Emoticons</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHSeparator" id="hseparator14">
<property name="visible">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>
<property name="tab_fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox2902">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkImage" id="image_emoticons">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label176">
<property name="visible">True</property>
<property name="label" translatable="yes">Emoticons</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="type">tab</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox42">
<property name="border_width">5</property>

View file

@ -223,7 +223,20 @@ class message_Window:
buffer.insert_with_tags_by_name(end_iter, ttxt, tag)
if len(otxt) > 0:
buffer.insert(end_iter, otxt)
beg = 0
if self.plugin.config['useemoticons']:
index = 0
while index < len(otxt):
if otxt[index] in self.plugin.roster.begin_emot:
for s in self.plugin.roster.emoticons:
l = len(s)
if s == otxt[index:index+l]:
buffer.insert(end_iter, otxt[beg:index])
buffer.insert_pixbuf(end_iter, self.plugin.roster.emoticons[s])
index+=l
beg = index
index+=1
buffer.insert(end_iter, otxt[beg:])
#scroll to the end of the textview
conversation.scroll_to_mark(buffer.get_mark('end'), 0.1, 0, 0, 0)
@ -1721,6 +1734,102 @@ class roster_Window:
self.plugin.windows[account]['browser'] = \
browseAgent_Window(self.plugin, account)
def mkemoticons(self):
"""initialize emoticons array"""
emots = {':-)' : 'smile.png',
':)' : 'smile.png',
';-)' : 'wink.png',
';)' : 'wink.png',
':-p' : 'tongue.png',
':-P' : 'tongue.png',
':p' : 'tongue.png',
':P' : 'tongue.png',
':d' : 'biggrin.png',
':D' : 'biggrin.png',
':-d' : 'biggrin.png',
':-D' : 'biggrin.png',
':>' : 'biggrin.png',
':->' : 'biggrin.png',
':(' : 'unhappy.png',
':-(' : 'unhappy.png',
';(' : 'cry.png',
';-(' : 'cry.png',
':\'(' : 'cry.png',
';\'-(' : 'cry.png',
':-O' : 'oh.png',
':-o' : 'oh.png',
':O' : 'oh.png',
':o' : 'oh.png',
':-@' : 'angry.png',
':@' : 'angry.png',
':-$' : 'blush.png',
':$' : 'blush.png',
':-|' : 'stare.png',
':|' : 'stare.png',
':-S' : 'frowing.png',
':-s' : 'frowing.png',
':S' : 'frowing.png',
':s' : 'frowing.png',
'B-)' : 'coolglasses.png',
'B)' : 'coolglasses.png',
'8-)' : 'coolglasses.png',
'8)' : 'coolglasses.png',
'(H)' : 'coolglasses.png',
'(h)' : 'coolglasses.png',
':-[' : 'bat.png',
':[' : 'bat.png',
'(l)' : 'heart.png',
'(L)' : 'heart.png',
'(u)' : 'brheart.png',
'(U)' : 'brheart.png',
'(y)' : 'yes.png',
'(Y)' : 'yes.png',
'(n)' : 'no.png',
'(N)' : 'no.png',
'(z)' : 'boy.png',
'(Z)' : 'boy.png',
'(@)' : 'pussy.png',
'(})' : 'hugleft.png',
'({)' : 'hugright.png',
'(6)' : 'devil.png',
'(r)' : 'rainbow.png',
'(R)' : 'rainbow.png',
'(w)' : 'brflower.png',
'(W)' : 'brflower.png',
'(f)' : 'flower.png',
'(F)' : 'flower.png',
'(p)' : 'photo.png',
'(P)' : 'photo.png',
'(t)' : 'phone.png',
'(T)' : 'phone.png',
'(*)' : 'star.png',
'(8)' : 'music.png',
'(i)' : 'lamp.png',
'(I)' : 'lamp.png',
'(b)' : 'beer.png',
'(B)' : 'beer.png',
'(d)' : 'drink.png',
'(D)' : 'drink.png',
'(c)' : 'coffee.png',
'(C)' : 'coffee.png',
'(%)' : 'cuffs.png',
'(e)' : 'mail.png',
'(E)' : 'mail.png',
'(k)' : 'kiss.png',
'(K)' : 'kiss.png'
}
path = 'plugins/gtkgui/emoticons/'
self.emoticons = {}
self.begin_emot = ""
for e in emots:
file = path + emots[e]
if not os.path.exists(file):
continue
pix = gtk.gdk.pixbuf_new_from_file(file)
self.emoticons[e] = pix
if not e[0] in self.begin_emot:
self.begin_emot += e[0]
def mkpixbufs(self):
"""initialise pixbufs array"""
iconstyle = self.plugin.config['iconstyle']
@ -1915,6 +2024,8 @@ class roster_Window:
model.set_sort_column_id(1, gtk.SORT_ASCENDING)
self.tree.set_model(model)
self.mkpixbufs()
if self.plugin.config['useemoticons']:
self.mkemoticons()
liststore = gtk.ListStore(gobject.TYPE_STRING, gtk.Image)
self.cb = gtk.ComboBox()
@ -2580,6 +2691,7 @@ class plugin:
'userfont': 'Sans 10',\
'saveposition': 1,\
'mergeaccounts': 0,\
'useemoticons': 1,\
'x-position': 0,\
'y-position': 0,\
'width': 150,\

Binary file not shown.

After

Width:  |  Height:  |  Size: 770 B