emoticons and status messages are now a group of ption in the common config file (thx tab for your code)
This commit is contained in:
parent
c981ac6b00
commit
04db394f87
3 changed files with 169 additions and 137 deletions
|
@ -33,32 +33,22 @@ class Config:
|
||||||
|
|
||||||
__options = {
|
__options = {
|
||||||
# name: [ type, value ]
|
# name: [ type, value ]
|
||||||
'log': [ opt_bool, 'True' ],
|
'log': [ opt_bool, True ],
|
||||||
'delauth': [ opt_bool, 'True' ],
|
'delauth': [ opt_bool, True ],
|
||||||
'delroster': [ opt_bool, 'True' ],
|
'delroster': [ opt_bool, True ],
|
||||||
'alwaysauth': [ opt_bool, 'False' ],
|
'alwaysauth': [ opt_bool, False ],
|
||||||
'autopopup': [ opt_bool, 'False' ],
|
'autopopup': [ opt_bool, False ],
|
||||||
'autopopupaway': [ opt_bool, 'False' ],
|
'autopopupaway': [ opt_bool, False ],
|
||||||
'ignore_unknown_contacts': [ opt_bool, 'False' ],
|
'ignore_unknown_contacts': [ opt_bool, False ],
|
||||||
'showoffline': [ opt_bool, 'False' ],
|
'showoffline': [ opt_bool, False ],
|
||||||
'autoaway': [ opt_bool, 'True' ],
|
'autoaway': [ opt_bool, True ],
|
||||||
'autoawaytime': [ opt_int, 10 ],
|
'autoawaytime': [ opt_int, 10 ],
|
||||||
'autoxa': [ opt_bool, 'True' ],
|
'autoxa': [ opt_bool, True ],
|
||||||
'autoxatime': [ opt_int, 20 ],
|
'autoxatime': [ opt_int, 20 ],
|
||||||
'ask_online_status': [ opt_bool, 'False' ],
|
'ask_online_status': [ opt_bool, False ],
|
||||||
'ask_offline_status': [ opt_bool, 'False' ],
|
'ask_offline_status': [ opt_bool, False ],
|
||||||
'last_msg': [ opt_str, '' ],
|
'last_msg': [ opt_str, '' ],
|
||||||
'msg0_name': [ opt_str, 'Nap' ],
|
'trayicon': [ opt_bool, True ],
|
||||||
'msg0': [ opt_str, 'I\'m taking a nap.' ],
|
|
||||||
'msg1_name': [ opt_str, 'Brb' ],
|
|
||||||
'msg1': [ opt_str, 'Back in some minutes.' ],
|
|
||||||
'msg2_name': [ opt_str, 'Eating' ],
|
|
||||||
'msg2': [ opt_str, 'I\'m eating, so leave me a message.' ],
|
|
||||||
'msg3_name': [ opt_str, 'Movie' ],
|
|
||||||
'msg3': [ opt_str, 'I\'m watching a movie.' ],
|
|
||||||
'msg4_name': [ opt_str, 'Working' ],
|
|
||||||
'msg4': [ opt_str, 'I\'m working.' ],
|
|
||||||
'trayicon': [ opt_bool, 'True' ],
|
|
||||||
'iconset': [ opt_str, 'sun' ],
|
'iconset': [ opt_str, 'sun' ],
|
||||||
'inmsgcolor': [ opt_color, '#ff0000' ],
|
'inmsgcolor': [ opt_color, '#ff0000' ],
|
||||||
'outmsgcolor': [ opt_color, '#0000ff' ],
|
'outmsgcolor': [ opt_color, '#0000ff' ],
|
||||||
|
@ -73,24 +63,13 @@ class Config:
|
||||||
'usertextcolor': [ opt_color, '#000000' ],
|
'usertextcolor': [ opt_color, '#000000' ],
|
||||||
'userbgcolor': [ opt_color, '#ffffff' ],
|
'userbgcolor': [ opt_color, '#ffffff' ],
|
||||||
'userfont': [ opt_str, 'Sans 10' ],
|
'userfont': [ opt_str, 'Sans 10' ],
|
||||||
'saveposition': [ opt_bool, 'True' ],
|
'saveposition': [ opt_bool, True ],
|
||||||
'mergeaccounts': [ opt_bool, 'False' ],
|
'mergeaccounts': [ opt_bool, False ],
|
||||||
'usetabbedchat': [ opt_bool, 'True' ],
|
'usetabbedchat': [ opt_bool, True ],
|
||||||
'print_time': [ opt_str, 'always' ],
|
'print_time': [ opt_str, 'always' ],
|
||||||
'useemoticons': [ opt_bool, 'True' ],
|
'useemoticons': [ opt_bool, True ],
|
||||||
'emoticons': [ opt_str, ':-)\tplugins/gtkgui/emoticons/smile.png\t(@)\tplugins/gtkgui/emoticons/pussy.png\t8)\tplugins/gtkgui/emoticons/coolglasses.png\t:(\tplugins/gtkgui/emoticons/unhappy.png\t:)\tplugins/gtkgui/emoticons/smile.png\t(})\tplugins/gtkgui/emoticons/hugleft.png\t:$\tplugins/gtkgui/emoticons/blush.png\t(Y)\tplugins/gtkgui/emoticons/yes.png\t:-@\tplugins/gtkgui/emoticons/angry.png\t:-D\tplugins/gtkgui/emoticons/biggrin.png\t(U)\tplugins/gtkgui/emoticons/brheart.png\t(F)\tplugins/gtkgui/emoticons/flower.png\t:-[\tplugins/gtkgui/emoticons/bat.png\t:>\tplugins/gtkgui/emoticons/biggrin.png\t(T)\tplugins/gtkgui/emoticons/phone.png\t:-S\tplugins/gtkgui/emoticons/frowing.png\t:-P\tplugins/gtkgui/emoticons/tongue.png\t(H)\tplugins/gtkgui/emoticons/coolglasses.png\t(D)\tplugins/gtkgui/emoticons/drink.png\t:-O\tplugins/gtkgui/emoticons/oh.png\t(C)\tplugins/gtkgui/emoticons/coffee.png\t({)\tplugins/gtkgui/emoticons/hugright.png\t(*)\tplugins/gtkgui/emoticons/star.png\tB-)\tplugins/gtkgui/emoticons/coolglasses.png\t(Z)\tplugins/gtkgui/emoticons/boy.png\t(E)\tplugins/gtkgui/emoticons/mail.png\t(N)\tplugins/gtkgui/emoticons/no.png\t(P)\tplugins/gtkgui/emoticons/photo.png\t(K)\tplugins/gtkgui/emoticons/kiss.png\t(R)\tplugins/gtkgui/emoticons/rainbow.png\t:-|\tplugins/gtkgui/emoticons/stare.png\t;-)\tplugins/gtkgui/emoticons/wink.png\t;-(\tplugins/gtkgui/emoticons/cry.png\t(6)\tplugins/gtkgui/emoticons/devil.png\t(L)\tplugins/gtkgui/emoticons/heart.png\t(W)\tplugins/gtkgui/emoticons/brflower.png\t:|\tplugins/gtkgui/emoticons/stare.png\t:O\tplugins/gtkgui/emoticons/oh.png\t;)\tplugins/gtkgui/emoticons/wink.png\t;(\tplugins/gtkgui/emoticons/cry.png\t:S\tplugins/gtkgui/emoticons/frowing.png\t;\'-(\tplugins/gtkgui/emoticons/cry.png\t:-(\tplugins/gtkgui/emoticons/unhappy.png\t8-)\tplugins/gtkgui/emoticons/coolglasses.png\t(B)\tplugins/gtkgui/emoticons/beer.png\t:D\tplugins/gtkgui/emoticons/biggrin.png\t(8)\tplugins/gtkgui/emoticons/music.png\t:@\tplugins/gtkgui/emoticons/angry.png\tB)\tplugins/gtkgui/emoticons/coolglasses.png\t:-$\tplugins/gtkgui/emoticons/blush.png\t:\'(\tplugins/gtkgui/emoticons/cry.png\t:->\tplugins/gtkgui/emoticons/biggrin.png\t:[\tplugins/gtkgui/emoticons/bat.png\t(I)\tplugins/gtkgui/emoticons/lamp.png\t:P\tplugins/gtkgui/emoticons/tongue.png\t(%)\tplugins/gtkgui/emoticons/cuffs.png\t(S)\tplugins/gtkgui/emoticons/moon.png' ],
|
'sounds_on': [ opt_bool, True ],
|
||||||
'sounds_on': [ opt_bool, 'True' ],
|
|
||||||
'soundplayer': [ opt_str, 'play' ],
|
'soundplayer': [ opt_str, 'play' ],
|
||||||
'sound_first_message_received': [ opt_bool, 'True' ],
|
|
||||||
'sound_first_message_received_file': [ opt_str, 'sounds/message1.wav' ],
|
|
||||||
'sound_next_message_received': [ opt_bool, 'True' ],
|
|
||||||
'sound_next_message_received_file': [ opt_str, 'sounds/message2.wav' ],
|
|
||||||
'sound_contact_connected': [ opt_bool, 'True' ],
|
|
||||||
'sound_contact_connected_file': [ opt_str, 'sounds/connected.wav' ],
|
|
||||||
'sound_contact_disconnected': [ opt_bool, 'True' ],
|
|
||||||
'sound_contact_disconnected_file': [ opt_str, 'sounds/disconnected.wav' ],
|
|
||||||
'sound_message_sent': [ opt_bool, 'True' ],
|
|
||||||
'sound_message_sent_file': [ opt_str, 'sounds/sent.wav' ],
|
|
||||||
'openwith': [ opt_str, 'gnome-open' ],
|
'openwith': [ opt_str, 'gnome-open' ],
|
||||||
'custombrowser': [ opt_str, 'firefox' ],
|
'custombrowser': [ opt_str, 'firefox' ],
|
||||||
'custommailapp': [ opt_str, 'mozilla-thunderbird -compose' ],
|
'custommailapp': [ opt_str, 'mozilla-thunderbird -compose' ],
|
||||||
|
@ -104,36 +83,119 @@ class Config:
|
||||||
'after_time': [ opt_str, ']' ],
|
'after_time': [ opt_str, ']' ],
|
||||||
'before_nickname': [ opt_str, '<' ],
|
'before_nickname': [ opt_str, '<' ],
|
||||||
'after_nickname': [ opt_str, '>' ],
|
'after_nickname': [ opt_str, '>' ],
|
||||||
'do_not_send_os_info': [ opt_bool, 'False' ],
|
'do_not_send_os_info': [ opt_bool, False ],
|
||||||
'usegpg': [ opt_bool, 'False' ],
|
'usegpg': [ opt_bool, False ],
|
||||||
'lognotusr': [ opt_bool, 'True' ],
|
'lognotusr': [ opt_bool, True ],
|
||||||
'lognotsep': [ opt_bool, 'True' ],
|
'lognotsep': [ opt_bool, True ],
|
||||||
}
|
}
|
||||||
|
|
||||||
__options_per_key = {
|
__options_per_key = {
|
||||||
'accounts': ({
|
'accounts': ({
|
||||||
'name': [ opt_str, '' ],
|
'name': [ opt_str, '' ],
|
||||||
'hostname': [ opt_str, '' ],
|
'hostname': [ opt_str, '' ],
|
||||||
'savepass': [ opt_bool, 'False' ],
|
'savepass': [ opt_bool, False ],
|
||||||
'password': [ opt_str, '' ],
|
'password': [ opt_str, '' ],
|
||||||
'resource': [ opt_str, 'gajim' ],
|
'resource': [ opt_str, 'gajim' ],
|
||||||
'priority': [ opt_int, 5 ],
|
'priority': [ opt_int, 5 ],
|
||||||
'autoconnect': [ opt_bool, 'False' ],
|
'autoconnect': [ opt_bool, False ],
|
||||||
'use_proxy': [ opt_bool, 'False' ],
|
'use_proxy': [ opt_bool, False ],
|
||||||
'proxyhost': [ opt_str, '' ],
|
'proxyhost': [ opt_str, '' ],
|
||||||
'proxyport': [ opt_int, 3128 ],
|
'proxyport': [ opt_int, 3128 ],
|
||||||
'keyid': [ opt_str, '' ],
|
'keyid': [ opt_str, '' ],
|
||||||
'keyname': [ opt_str, '' ],
|
'keyname': [ opt_str, '' ],
|
||||||
'savegpgpass': [ opt_bool, 'False' ],
|
'savegpgpass': [ opt_bool, False ],
|
||||||
'gpgpassword': [ opt_str, '' ],
|
'gpgpassword': [ opt_str, '' ],
|
||||||
'sync_with_global_status': [ opt_bool, 'True' ],
|
'sync_with_global_status': [ opt_bool, True ],
|
||||||
'no_log_for': [ opt_str, '' ],
|
'no_log_for': [ opt_str, '' ],
|
||||||
}, {}),
|
}, {}),
|
||||||
'statusmsg': ({
|
'statusmsg': ({
|
||||||
'message': [ opt_str, '' ],
|
'message': [ opt_str, '' ],
|
||||||
}, {}),
|
}, {}),
|
||||||
|
'emoticons': ({
|
||||||
|
'path': [ opt_str, '' ],
|
||||||
|
}, {}),
|
||||||
|
'soundevents': ({
|
||||||
|
'enabled': [ opt_bool, True ],
|
||||||
|
'path': [ opt_str, '' ],
|
||||||
|
}, {}),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emoticons_default = {
|
||||||
|
':-)': 'plugins/gtkgui/emoticons/smile.png',
|
||||||
|
'(@)': 'plugins/gtkgui/emoticons/pussy.png',
|
||||||
|
'8)': 'plugins/gtkgui/emoticons/coolglasses.png',
|
||||||
|
':(': 'plugins/gtkgui/emoticons/unhappy.png',
|
||||||
|
':)': 'plugins/gtkgui/emoticons/smile.png',
|
||||||
|
'(})': 'plugins/gtkgui/emoticons/hugleft.png',
|
||||||
|
':$': 'plugins/gtkgui/emoticons/blush.png',
|
||||||
|
'(Y)': 'plugins/gtkgui/emoticons/yes.png',
|
||||||
|
':-@': 'plugins/gtkgui/emoticons/angry.png',
|
||||||
|
':-D': 'plugins/gtkgui/emoticons/biggrin.png',
|
||||||
|
'(U)': 'plugins/gtkgui/emoticons/brheart.png',
|
||||||
|
'(F)': 'plugins/gtkgui/emoticons/flower.png',
|
||||||
|
':-[': 'plugins/gtkgui/emoticons/bat.png',
|
||||||
|
':>': 'plugins/gtkgui/emoticons/biggrin.png',
|
||||||
|
'(T)': 'plugins/gtkgui/emoticons/phone.png',
|
||||||
|
':-S': 'plugins/gtkgui/emoticons/frowing.png',
|
||||||
|
':-P': 'plugins/gtkgui/emoticons/tongue.png',
|
||||||
|
'(H)': 'plugins/gtkgui/emoticons/coolglasses.png',
|
||||||
|
'(D)': 'plugins/gtkgui/emoticons/drink.png',
|
||||||
|
':-O': 'plugins/gtkgui/emoticons/oh.png',
|
||||||
|
'(C)': 'plugins/gtkgui/emoticons/coffee.png',
|
||||||
|
'({)': 'plugins/gtkgui/emoticons/hugright.png',
|
||||||
|
'(*)': 'plugins/gtkgui/emoticons/star.png',
|
||||||
|
'B-)': 'plugins/gtkgui/emoticons/coolglasses.png',
|
||||||
|
'(Z)': 'plugins/gtkgui/emoticons/boy.png',
|
||||||
|
'(E)': 'plugins/gtkgui/emoticons/mail.png',
|
||||||
|
'(N)': 'plugins/gtkgui/emoticons/no.png',
|
||||||
|
'(P)': 'plugins/gtkgui/emoticons/photo.png',
|
||||||
|
'(K)': 'plugins/gtkgui/emoticons/kiss.png',
|
||||||
|
'(R)': 'plugins/gtkgui/emoticons/rainbow.png',
|
||||||
|
':-|': 'plugins/gtkgui/emoticons/stare.png',
|
||||||
|
';-)': 'plugins/gtkgui/emoticons/wink.png',
|
||||||
|
';-(': 'plugins/gtkgui/emoticons/cry.png',
|
||||||
|
'(6)': 'plugins/gtkgui/emoticons/devil.png',
|
||||||
|
'(L)': 'plugins/gtkgui/emoticons/heart.png',
|
||||||
|
'(W)': 'plugins/gtkgui/emoticons/brflower.png',
|
||||||
|
':|': 'plugins/gtkgui/emoticons/stare.png',
|
||||||
|
':O': 'plugins/gtkgui/emoticons/oh.png',
|
||||||
|
';)': 'plugins/gtkgui/emoticons/wink.png',
|
||||||
|
';(': 'plugins/gtkgui/emoticons/cry.png',
|
||||||
|
':S': 'plugins/gtkgui/emoticons/frowing.png',
|
||||||
|
';\'-(': 'plugins/gtkgui/emoticons/cry.png',
|
||||||
|
':-(': 'plugins/gtkgui/emoticons/unhappy.png',
|
||||||
|
'8-)': 'plugins/gtkgui/emoticons/coolglasses.png',
|
||||||
|
'(B)': 'plugins/gtkgui/emoticons/beer.png',
|
||||||
|
':D': 'plugins/gtkgui/emoticons/biggrin.png',
|
||||||
|
'(8)': 'plugins/gtkgui/emoticons/music.png',
|
||||||
|
':@': 'plugins/gtkgui/emoticons/angry.png',
|
||||||
|
'B)': 'plugins/gtkgui/emoticons/coolglasses.png',
|
||||||
|
':-$': 'plugins/gtkgui/emoticons/blush.png',
|
||||||
|
':\'(': 'plugins/gtkgui/emoticons/cry.png',
|
||||||
|
':->': 'plugins/gtkgui/emoticons/biggrin.png',
|
||||||
|
':[': 'plugins/gtkgui/emoticons/bat.png',
|
||||||
|
'(I)': 'plugins/gtkgui/emoticons/lamp.png',
|
||||||
|
':P': 'plugins/gtkgui/emoticons/tongue.png',
|
||||||
|
'(%)': 'plugins/gtkgui/emoticons/cuffs.png',
|
||||||
|
'(S)': 'plugins/gtkgui/emoticons/moon.png',
|
||||||
|
}
|
||||||
|
|
||||||
|
statusmsg_default = {
|
||||||
|
'Nap': 'I\'m taking a nap.'
|
||||||
|
'Brb': 'Back in some minutes.'
|
||||||
|
'Eating': 'so leave me a message.'
|
||||||
|
'Movie' : 'I\'m watching a movie.'
|
||||||
|
'Working': 'I\'m working.'
|
||||||
|
}
|
||||||
|
|
||||||
|
soundevents_default = {
|
||||||
|
'first_message_received': [ True, 'sounds/message1.wav' ],
|
||||||
|
'next_message_received': [ True, 'sounds/message2.wav' ],
|
||||||
|
'contact_connected': [ True, 'sounds/connected.wav' ],
|
||||||
|
'contact_disconnected': [ True, 'sounds/disconnected.wav' ],
|
||||||
|
'message_sent': [ True, 'sounds/sent.wav' ],
|
||||||
|
}
|
||||||
|
|
||||||
def foreach(self, func):
|
def foreach(self, func):
|
||||||
for opt in self.__options:
|
for opt in self.__options:
|
||||||
func(opt, None, self.__options[opt])
|
func(opt, None, self.__options[opt])
|
||||||
|
@ -157,8 +219,6 @@ class Config:
|
||||||
if int(val) == 0 or int(val) == 1:
|
if int(val) == 0 or int(val) == 1:
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
if val == 'True' or val == 'False':
|
|
||||||
return 1
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def is_valid_string(self, val):
|
def is_valid_string(self, val):
|
||||||
|
@ -186,16 +246,9 @@ class Config:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def get(self, optname):
|
def get(self, optname):
|
||||||
if not self.exist(optname):
|
if not self.__options.has_key(optname):
|
||||||
return None
|
return None
|
||||||
opt = self.__options[optname]
|
return self.__options[optname][OPT_VAL]
|
||||||
if opt[OPT_TYPE] == opt_bool:
|
|
||||||
if opt[OPT_VAL] == 'False': return False
|
|
||||||
return True
|
|
||||||
elif opt[OPT_TYPE] == opt_int:
|
|
||||||
return int(opt[OPT_VAL])
|
|
||||||
else:
|
|
||||||
return opt[OPT_VAL]
|
|
||||||
|
|
||||||
def add_per(self, typename, name):
|
def add_per(self, typename, name):
|
||||||
if not self.__options_per_key.has_key(typename):
|
if not self.__options_per_key.has_key(typename):
|
||||||
|
@ -245,8 +298,17 @@ class Config:
|
||||||
return None
|
return None
|
||||||
return obj[subname][OPT_VAL]
|
return obj[subname][OPT_VAL]
|
||||||
|
|
||||||
def exist(self, optname):
|
|
||||||
return self.__options.has_key(optname)
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
#init default values
|
||||||
|
for event in soundevents_default:
|
||||||
|
default = soundevents_default[o]
|
||||||
|
config.add_per('soundevents', event)
|
||||||
|
config.set_per('soundevents', event, 'enable', default[0])
|
||||||
|
config.set_per('soundevents', event, 'path', default[1])
|
||||||
|
for emot in emoticons_default:
|
||||||
|
config.add_per('emoticons', emot)
|
||||||
|
config.set_per('emoticons', emot, 'path', emoticons_default[emot])
|
||||||
|
for msg in statusmsg_default:
|
||||||
|
config.add_per('statusmsg', msg)
|
||||||
|
config.set_per('statusmsg', msg, 'message', statusmsg_default[msg])
|
||||||
return
|
return
|
||||||
|
|
|
@ -390,17 +390,13 @@ class Preferences_window:
|
||||||
self.on_checkbutton_toggled(widget, 'ask_offline_status')
|
self.on_checkbutton_toggled(widget, 'ask_offline_status')
|
||||||
|
|
||||||
def on_sounds_treemodel_row_changed(self, model, path, iter):
|
def on_sounds_treemodel_row_changed(self, model, path, iter):
|
||||||
iter = model.get_iter_first()
|
sound_event = model.get_value(iter, 0)
|
||||||
while iter:
|
if model[path][1]:
|
||||||
path = model.get_path(iter)
|
gajim.config.set_per('soundevents', sound_event, 'enabled', True)
|
||||||
sound_event = model.get_value(iter, 0)
|
else:
|
||||||
if model[path][1]:
|
gajim.config.set_per('soundevents', sound_event, 'enabled', False)
|
||||||
gajim.config.set('sound_' + sound_event, True)
|
gajim.config.set_per('soundevents', sound_event, 'path', \
|
||||||
else:
|
model.get_value(iter, 2))
|
||||||
gajim.config.set('sound_' + sound_event, False)
|
|
||||||
gajim.config.set('sound_' + sound_event + '_file', \
|
|
||||||
model.get_value(iter, 2))
|
|
||||||
iter = model.iter_next(iter)
|
|
||||||
self.plugin.save_config()
|
self.plugin.save_config()
|
||||||
|
|
||||||
def on_auto_away_checkbutton_toggled(self, widget):
|
def on_auto_away_checkbutton_toggled(self, widget):
|
||||||
|
@ -539,21 +535,12 @@ class Preferences_window:
|
||||||
return
|
return
|
||||||
|
|
||||||
def fill_sound_treeview(self):
|
def fill_sound_treeview(self):
|
||||||
sounds = ['contact_disconnected', 'message_sent', 'contact_connected', \
|
sounds = gajim.config.get_per('soundevents')
|
||||||
'first_message_received', 'next_message_received']
|
|
||||||
events = {}
|
|
||||||
# config file MUST have sound_event AND sound_enevt_file
|
|
||||||
#events = {name : [use_it, file], name2 : [., .], ...}
|
|
||||||
for key in sounds:
|
|
||||||
if not (gajim.config.exist('sound_' + key) and gajim.config.exist(\
|
|
||||||
'sound_' + key + '_file')):
|
|
||||||
continue
|
|
||||||
events[key] = [gajim.config.get('sound_' + key), \
|
|
||||||
gajim.config.get('sound_' + key + '_file')]
|
|
||||||
model = self.sound_tree.get_model()
|
model = self.sound_tree.get_model()
|
||||||
model.clear()
|
model.clear()
|
||||||
for ev in events:
|
for sound in sounds:
|
||||||
iter = model.append((ev, events[ev][0], events[ev][1]))
|
iter = model.append((sound, gajim.config.get_per('soundevents', sound,\
|
||||||
|
'enabled'), gajim.config.get_per('soundevents', sound, 'path')))
|
||||||
|
|
||||||
def on_treeview_sounds_cursor_changed(self, widget, data=None):
|
def on_treeview_sounds_cursor_changed(self, widget, data=None):
|
||||||
(model, iter) = self.sound_tree.get_selection().get_selected()
|
(model, iter) = self.sound_tree.get_selection().get_selected()
|
||||||
|
@ -642,7 +629,7 @@ class Preferences_window:
|
||||||
self.iconset_combobox.set_model(model)
|
self.iconset_combobox.set_model(model)
|
||||||
l = []
|
l = []
|
||||||
for i in list_style:
|
for i in list_style:
|
||||||
if i != 'CVS' and i[0] != '.':
|
if i[0] != '.':
|
||||||
l.append(i)
|
l.append(i)
|
||||||
if l.count == 0:
|
if l.count == 0:
|
||||||
l.append(' ')
|
l.append(' ')
|
||||||
|
@ -1481,26 +1468,16 @@ class Add_remove_emoticons_window:
|
||||||
self.window.hide()
|
self.window.hide()
|
||||||
|
|
||||||
def on_emoticons_treemodel_row_deleted(self, model, path):
|
def on_emoticons_treemodel_row_deleted(self, model, path):
|
||||||
iter = model.get_iter_first()
|
iter = model.get_iter(path)
|
||||||
emots = []
|
gajim.config.get_per('emoticons', model.get_value(iter, 0))
|
||||||
while iter:
|
|
||||||
emots.append(model.get_value(iter, 0))
|
|
||||||
emots.append(model.get_value(iter, 1))
|
|
||||||
iter = model.iter_next(iter)
|
|
||||||
gajim.config.set('emoticons', '\t'.join(emots))
|
|
||||||
self.plugin.init_regexp()
|
|
||||||
self.plugin.save_config()
|
self.plugin.save_config()
|
||||||
|
|
||||||
def on_emoticons_treemodel_row_changed(self, model, path, iter):
|
def on_emoticons_treemodel_row_changed(self, model, path, iter):
|
||||||
if model[path][1] != None and len(model[path][1]) != 0:
|
emots = gajim.config.get_per('emoticons')
|
||||||
iter = model.get_iter_first()
|
emot = model.get_value(iter, 0)
|
||||||
emots = []
|
if not emot in emots:
|
||||||
while iter:
|
gajim.config.add_per('emoticons', emot)
|
||||||
emots.append(model.get_value(iter, 0))
|
gajim.config.set_per('emoticons', emot, 'path', model.get_value(iter, 1))
|
||||||
emots.append(model.get_value(iter, 1))
|
|
||||||
iter = model.iter_next(iter)
|
|
||||||
gajim.config.set('emoticons', '\t'.join(emots))
|
|
||||||
self.plugin.init_regexp()
|
|
||||||
self.plugin.save_config()
|
self.plugin.save_config()
|
||||||
|
|
||||||
def image_is_ok(self, image):
|
def image_is_ok(self, image):
|
||||||
|
@ -1519,22 +1496,13 @@ class Add_remove_emoticons_window:
|
||||||
return 0
|
return 0
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
def load_emots(self):
|
|
||||||
emots = {}
|
|
||||||
split_line = gajim.config.get('emoticons').split('\t')
|
|
||||||
for i in range(0, len(split_line)/2):
|
|
||||||
if not self.image_is_ok(split_line[2*i+1]):
|
|
||||||
continue
|
|
||||||
emots[split_line[2*i]] = split_line[2*i+1]
|
|
||||||
return emots
|
|
||||||
|
|
||||||
def fill_emot_treeview(self):
|
def fill_emot_treeview(self):
|
||||||
model = self.emot_tree.get_model()
|
model = self.emot_tree.get_model()
|
||||||
model.clear()
|
model.clear()
|
||||||
emots = self.load_emots()
|
emots = gajim.config.get_per('emoticons')
|
||||||
for i in emots:
|
for emot in emots:
|
||||||
file = emots[i]
|
file = gajim.config.get_per('emoticons', emot, 'path')
|
||||||
iter = model.append((i, file, None))
|
iter = model.append((emot, file, None))
|
||||||
if not os.path.exists(file):
|
if not os.path.exists(file):
|
||||||
continue
|
continue
|
||||||
img = gtk.Image()
|
img = gtk.Image()
|
||||||
|
|
|
@ -311,9 +311,9 @@ class interface:
|
||||||
#It isn't an agent
|
#It isn't an agent
|
||||||
self.roster.chg_user_status(user1, array[1], array[2], account)
|
self.roster.chg_user_status(user1, array[1], array[2], account)
|
||||||
#play sound
|
#play sound
|
||||||
if old_show < 2 and new_show > 1 and gajim.config.get( \
|
if old_show < 2 and new_show > 1 and gajim.config.get_per( \
|
||||||
'sound_contact_connected'):
|
'soundevents', 'contact_connected', 'enabled'):
|
||||||
self.play_sound('sound_contact_connected')
|
self.play_sound('contact_connected')
|
||||||
if not self.windows[account]['chats'].has_key(jid) and \
|
if not self.windows[account]['chats'].has_key(jid) and \
|
||||||
not self.queues[account].has_key(jid) and not gajim.config.get( \
|
not self.queues[account].has_key(jid) and not gajim.config.get( \
|
||||||
'autopopup'):
|
'autopopup'):
|
||||||
|
@ -328,9 +328,9 @@ class interface:
|
||||||
instance = dialogs.Popup_window(self, 'Contact Online', jid, \
|
instance = dialogs.Popup_window(self, 'Contact Online', jid, \
|
||||||
account)
|
account)
|
||||||
self.roster.popup_windows.append(instance)
|
self.roster.popup_windows.append(instance)
|
||||||
elif old_show > 1 and new_show < 2 and gajim.config.get( \
|
elif old_show > 1 and new_show < 2 and gajim.config.get_per( \
|
||||||
'sound_contact_disconnected'):
|
'soundevents', 'contact_disconnected', 'enabled'):
|
||||||
self.play_sound('sound_contact_disconnected')
|
self.play_sound('contact_disconnected')
|
||||||
if not self.windows[account]['chats'].has_key(jid) and \
|
if not self.windows[account]['chats'].has_key(jid) and \
|
||||||
not self.queues[account].has_key(jid) and not gajim.config.get( \
|
not self.queues[account].has_key(jid) and not gajim.config.get( \
|
||||||
'autopopup'):
|
'autopopup'):
|
||||||
|
@ -361,10 +361,12 @@ class interface:
|
||||||
instance = dialogs.Popup_window(self, 'New Message', jid, account)
|
instance = dialogs.Popup_window(self, 'New Message', jid, account)
|
||||||
self.roster.popup_windows.append(instance)
|
self.roster.popup_windows.append(instance)
|
||||||
self.roster.on_message(jid, array[1], array[2], account)
|
self.roster.on_message(jid, array[1], array[2], account)
|
||||||
if gajim.config.get('sound_first_message_received') and first:
|
if gajim.config.get_per('soundevents', 'first_message_received', \
|
||||||
self.play_sound('sound_first_message_received')
|
'enabled') and first:
|
||||||
if gajim.config.get('sound_next_message_received') and not first:
|
self.play_sound('first_message_received')
|
||||||
self.play_sound('sound_next_message_received')
|
if gajim.config.get_per('soundevents', 'next_message_received', \
|
||||||
|
'enabled') and not first:
|
||||||
|
self.play_sound('next_message_received')
|
||||||
|
|
||||||
def handle_event_msgerror(self, account, array):
|
def handle_event_msgerror(self, account, array):
|
||||||
#('MSGERROR', account, (user, error_code, error_msg, msg, time))
|
#('MSGERROR', account, (user, error_code, error_msg, msg, time))
|
||||||
|
@ -376,8 +378,8 @@ class interface:
|
||||||
|
|
||||||
def handle_event_msgsent(self, account, array):
|
def handle_event_msgsent(self, account, array):
|
||||||
#('MSG', account, (jid, msg, keyID))
|
#('MSG', account, (jid, msg, keyID))
|
||||||
if gajim.config.get('sound_message_sent'):
|
if gajim.config.get_per('soundevents', 'message_sent', 'enabled'):
|
||||||
self.play_sound('sound_message_sent')
|
self.play_sound('message_sent')
|
||||||
|
|
||||||
def handle_event_subscribe(self, account, array):
|
def handle_event_subscribe(self, account, array):
|
||||||
#('SUBSCRIBE', account, (jid, text))
|
#('SUBSCRIBE', account, (jid, text))
|
||||||
|
@ -641,13 +643,13 @@ class interface:
|
||||||
def init_regexp(self):
|
def init_regexp(self):
|
||||||
#initialize emoticons dictionary
|
#initialize emoticons dictionary
|
||||||
self.emoticons = dict()
|
self.emoticons = dict()
|
||||||
split_line = gajim.config.get('emoticons').split('\t')
|
emots = gajim.config.get_per('emoticons')
|
||||||
for i in range(0, len(split_line)/2):
|
for emot in emots:
|
||||||
emot_file = split_line[2*i+1]
|
emot_file = gajim.config.get_per('emoticons', emot, 'path')
|
||||||
if not self.image_is_ok(emot_file):
|
if not self.image_is_ok(emot_file):
|
||||||
continue
|
continue
|
||||||
pix = gtk.gdk.pixbuf_new_from_file(emot_file)
|
pix = gtk.gdk.pixbuf_new_from_file(emot_file)
|
||||||
self.emoticons[split_line[2*i]] = pix
|
self.emoticons[emot] = pix
|
||||||
|
|
||||||
# update regular expressions
|
# update regular expressions
|
||||||
self.make_regexps()
|
self.make_regexps()
|
||||||
|
|
Loading…
Add table
Reference in a new issue