regreat the regex when we add a new emoticon

This commit is contained in:
Yann Leboulanger 2005-03-14 21:46:55 +00:00
parent 0c9a88e989
commit 3bac6caec3
2 changed files with 17 additions and 14 deletions

View File

@ -288,7 +288,7 @@ class preferences_window:
emots.append(model.get_value(iter, 1))
iter = model.iter_next(iter)
self.plugin.config['emoticons'] = '\t'.join(emots)
self.plugin.roster.mkemoticons()
self.plugin.init_regex()
def on_emoticons_treemodel_row_changed(self, model, path, iter):
if model[path][1] != None and len(model[path][1]) != 0:
@ -299,7 +299,7 @@ class preferences_window:
emots.append(model.get_value(iter, 1))
iter = model.iter_next(iter)
self.plugin.config['emoticons'] = '\t'.join(emots)
self.plugin.roster.mkemoticons()
self.plugin.init_regex()
def on_auto_pop_up_checkbox_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'autopopup', None,\

View File

@ -736,6 +736,20 @@ class plugin:
def on_launch_browser_mailer(self, widget, url, kind):
self.launch_browser_mailer(kind, url)
def init_regex(self):
if self.config['useemoticons']:
"""initialize emoticons dictionary"""
self.emoticons = dict()
split_line = self.config['emoticons'].split('\t')
for i in range(0, len(split_line)/2):
emot_file = split_line[2*i+1]
if not self.image_is_ok(emot_file):
continue
pix = gtk.gdk.pixbuf_new_from_file(emot_file)
self.emoticons[split_line[2*i]] = pix
self.make_regexps()
def __init__(self, quIN, quOUT):
gtk.gdk.threads_init()
if not gtk.check_version(2, 6, 0):
@ -860,18 +874,7 @@ class plugin:
if self.config['trayicon']:
self.show_systray()
if self.config['useemoticons']:
"""initialize emoticons dictionary"""
self.emoticons = dict()
split_line = self.config['emoticons'].split('\t')
for i in range(0, len(split_line)/2):
emot_file = split_line[2*i+1]
if not self.image_is_ok(emot_file):
continue
pix = gtk.gdk.pixbuf_new_from_file(emot_file)
self.emoticons[split_line[2*i]] = pix
self.make_regexps()
self.init_regex()
gtk.gdk.threads_enter()
self.autoconnect()