parent
e8b6c78f5e
commit
6b75452557
|
@ -131,7 +131,7 @@ class Debug:
|
||||||
# with prefix = chr(27) + '[34m'
|
# with prefix = chr(27) + '[34m'
|
||||||
# sufix = chr(27) + '[37;1m\n'
|
# sufix = chr(27) + '[37;1m\n'
|
||||||
#
|
#
|
||||||
prefix = 'DEBUG: ',
|
prefix = color_red + 'DEBUG: ' + color_white,
|
||||||
sufix = '\n',
|
sufix = '\n',
|
||||||
#
|
#
|
||||||
# If you want unix style timestamps,
|
# If you want unix style timestamps,
|
||||||
|
@ -139,7 +139,7 @@ class Debug:
|
||||||
# 1 before prefix, good when prefix is a string
|
# 1 before prefix, good when prefix is a string
|
||||||
# 2 after prefix, good when prefix is a color
|
# 2 after prefix, good when prefix is a color
|
||||||
#
|
#
|
||||||
time_stamp = 0,
|
time_stamp = 2,
|
||||||
#
|
#
|
||||||
# flag_show should normaly be of, but can be turned on to get a
|
# flag_show should normaly be of, but can be turned on to get a
|
||||||
# good view of what flags are actually used for calls,
|
# good view of what flags are actually used for calls,
|
||||||
|
|
29
core/core.py
29
core/core.py
|
@ -35,6 +35,7 @@ log.setLevel(logging.DEBUG)
|
||||||
CONFPATH = "~/.gajimrc"
|
CONFPATH = "~/.gajimrc"
|
||||||
|
|
||||||
class GajimCore:
|
class GajimCore:
|
||||||
|
"""Core"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.connected = 0
|
self.connected = 0
|
||||||
self.cfgParser = common.optparser.OptionsParser(CONFPATH)
|
self.cfgParser = common.optparser.OptionsParser(CONFPATH)
|
||||||
|
@ -43,11 +44,13 @@ class GajimCore:
|
||||||
# END __init__
|
# END __init__
|
||||||
|
|
||||||
def messageCB(self, con, msg):
|
def messageCB(self, con, msg):
|
||||||
|
"""Called when we recieve a message"""
|
||||||
self.hub.sendPlugin('MSG', (msg.getFrom().getBasic(), \
|
self.hub.sendPlugin('MSG', (msg.getFrom().getBasic(), \
|
||||||
msg.getBody()))
|
msg.getBody()))
|
||||||
# END messageCB
|
# END messageCB
|
||||||
|
|
||||||
def presenceCB(self, con, prs):
|
def presenceCB(self, con, prs):
|
||||||
|
"""Called when we recieve a presence"""
|
||||||
who = str(prs.getFrom())
|
who = str(prs.getFrom())
|
||||||
type = prs.getType()
|
type = prs.getType()
|
||||||
if type == None: type = 'available'
|
if type == None: type = 'available'
|
||||||
|
@ -98,6 +101,7 @@ class GajimCore:
|
||||||
# END presenceCB
|
# END presenceCB
|
||||||
|
|
||||||
def disconnectedCB(self, con):
|
def disconnectedCB(self, con):
|
||||||
|
"""Called when we are disconnected"""
|
||||||
log.debug("disconnectedCB")
|
log.debug("disconnectedCB")
|
||||||
if self.connected == 1:
|
if self.connected == 1:
|
||||||
self.connected = 0
|
self.connected = 0
|
||||||
|
@ -106,13 +110,14 @@ class GajimCore:
|
||||||
# END disconenctedCB
|
# END disconenctedCB
|
||||||
|
|
||||||
def connect(self, account):
|
def connect(self, account):
|
||||||
|
"""Connect and authentificate to the Jabber server"""
|
||||||
self.cfgParser.parseCfgFile()
|
self.cfgParser.parseCfgFile()
|
||||||
hostname = self.cfgParser.__getattr__("%s" % account+"_hostname")
|
hostname = self.cfgParser.__getattr__("%s" % account+"_hostname")
|
||||||
name = self.cfgParser.__getattr__("%s" % account+"_name")
|
name = self.cfgParser.__getattr__("%s" % account+"_name")
|
||||||
password = self.cfgParser.__getattr__("%s" % account+"_password")
|
password = self.cfgParser.__getattr__("%s" % account+"_password")
|
||||||
ressource = self.cfgParser.__getattr__("%s" % account+"_ressource")
|
ressource = self.cfgParser.__getattr__("%s" % account+"_ressource")
|
||||||
self.con = common.jabber.Client(host = \
|
self.con = common.jabber.Client(host = \
|
||||||
hostname, debug = [common.jabber.DBG_ALWAYS], log = sys.stderr, connection=common.xmlstream.TCP, port=5222)
|
hostname, debug = [common.jabber.DBG_INIT], log = sys.stderr, connection=common.xmlstream.TCP, port=5222)
|
||||||
# hostname, debug = [common.jabber.DBG_ALWAYS], log = sys.stderr, connection=common.xmlstream.TCP_SSL, port=5223)
|
# hostname, debug = [common.jabber.DBG_ALWAYS], log = sys.stderr, connection=common.xmlstream.TCP_SSL, port=5223)
|
||||||
try:
|
try:
|
||||||
self.con.connect()
|
self.con.connect()
|
||||||
|
@ -121,15 +126,17 @@ class GajimCore:
|
||||||
self.hub.sendPlugin('STATUS', 'offline')
|
self.hub.sendPlugin('STATUS', 'offline')
|
||||||
self.hub.sendPlugin('WARNING', "Couldn't connect to %s" % hostname)
|
self.hub.sendPlugin('WARNING', "Couldn't connect to %s" % hostname)
|
||||||
return 0
|
return 0
|
||||||
|
except self.con.socket.gaierror, e:
|
||||||
|
log.debug("Couldn't connect to %s %s" % (hostname, e))
|
||||||
|
self.hub.sendPlugin('STATUS', 'offline')
|
||||||
|
self.hub.sendPlugin('WARNING', "Couldn't connect to %s" % hostname)
|
||||||
|
return 0
|
||||||
else:
|
else:
|
||||||
log.debug("Connected to server")
|
log.debug("Connected to server")
|
||||||
|
|
||||||
self.con.registerHandler('message', self.messageCB)
|
self.con.registerHandler('message', self.messageCB)
|
||||||
self.con.registerHandler('presence', self.presenceCB)
|
self.con.registerHandler('presence', self.presenceCB)
|
||||||
self.con.setDisconnectHandler(self.disconnectedCB)
|
self.con.setDisconnectHandler(self.disconnectedCB)
|
||||||
# self.con.setMessageHandler(self.messageCB)
|
|
||||||
# self.con.setPresenceHandler(self.presenceCB)
|
|
||||||
# self.con.setDisconnectHandler(self.disconnectedCB)
|
|
||||||
#BUG in jabberpy library : if hostname is wrong : "boucle"
|
#BUG in jabberpy library : if hostname is wrong : "boucle"
|
||||||
if self.con.auth(name, password, ressource):
|
if self.con.auth(name, password, ressource):
|
||||||
self.con.requestRoster()
|
self.con.requestRoster()
|
||||||
|
@ -148,6 +155,7 @@ class GajimCore:
|
||||||
# END connect
|
# END connect
|
||||||
|
|
||||||
def mainLoop(self):
|
def mainLoop(self):
|
||||||
|
"""Main Loop : Read the incomming queue to execute commands comming from plugins and process Jabber"""
|
||||||
while 1:
|
while 1:
|
||||||
if not self.hub.queueIn.empty():
|
if not self.hub.queueIn.empty():
|
||||||
ev = self.hub.queueIn.get()
|
ev = self.hub.queueIn.get()
|
||||||
|
@ -238,8 +246,9 @@ class GajimCore:
|
||||||
# END GajimCore
|
# END GajimCore
|
||||||
|
|
||||||
def loadPlugins(gc):
|
def loadPlugins(gc):
|
||||||
|
"""Load defaults plugins : 'modules' option in section Core in ConfFile and register then to the hub"""
|
||||||
modStr = gc.cfgParser.Core_modules
|
modStr = gc.cfgParser.Core_modules
|
||||||
if modStr :
|
if modStr:
|
||||||
mods = string.split (modStr, ' ')
|
mods = string.split (modStr, ' ')
|
||||||
|
|
||||||
for mod in mods:
|
for mod in mods:
|
||||||
|
@ -260,7 +269,15 @@ def loadPlugins(gc):
|
||||||
# END loadPLugins
|
# END loadPLugins
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
|
"""Start the Core"""
|
||||||
gc = GajimCore()
|
gc = GajimCore()
|
||||||
loadPlugins(gc)
|
loadPlugins(gc)
|
||||||
gc.mainLoop()
|
try:
|
||||||
|
gc.mainLoop()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print "Keyboard Interrupt : Bye!"
|
||||||
|
if self.r.connected:
|
||||||
|
self.r.con.disconnect()
|
||||||
|
gc.hub.sendPlugin('QUIT', ())
|
||||||
|
return 0
|
||||||
# END start
|
# END start
|
||||||
|
|
|
@ -30,6 +30,7 @@ Wbrowser = 0
|
||||||
Waccounts = 0
|
Waccounts = 0
|
||||||
|
|
||||||
class user:
|
class user:
|
||||||
|
"""Informations concerning each users"""
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
if len(args) == 0:
|
if len(args) == 0:
|
||||||
self.jid = ''
|
self.jid = ''
|
||||||
|
@ -57,13 +58,17 @@ class user:
|
||||||
else: raise TypeError, 'bad arguments'
|
else: raise TypeError, 'bad arguments'
|
||||||
|
|
||||||
class info_user:
|
class info_user:
|
||||||
|
"""Class for user's information window"""
|
||||||
def delete_event(self, widget):
|
def delete_event(self, widget):
|
||||||
|
"""close window"""
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
def add_grp_to_user(self, model, path, iter):
|
def add_grp_to_user(self, model, path, iter):
|
||||||
|
"""Insert user to the group in inter"""
|
||||||
self.user.groups.append(model.get_value(iter, 0))
|
self.user.groups.append(model.get_value(iter, 0))
|
||||||
|
|
||||||
def on_close(self, widget):
|
def on_close(self, widget):
|
||||||
|
"""Save user's informations and update the roster on the Jabber server"""
|
||||||
for i in self.r.l_contact[self.user.jid]['iter']:
|
for i in self.r.l_contact[self.user.jid]['iter']:
|
||||||
self.r.treestore.remove(i)
|
self.r.treestore.remove(i)
|
||||||
self.r.l_contact[self.user.jid]['iter'] = []
|
self.r.l_contact[self.user.jid]['iter'] = []
|
||||||
|
@ -75,26 +80,34 @@ class info_user:
|
||||||
self.delete_event(self)
|
self.delete_event(self)
|
||||||
|
|
||||||
def add_grp(self, model, path, iter, stors):
|
def add_grp(self, model, path, iter, stors):
|
||||||
|
"""Transfert the iter from stors[0] to stors[1]"""
|
||||||
i = stors[1].append()
|
i = stors[1].append()
|
||||||
stors[1].set(i, 0, stors[0].get_value(iter, 0))
|
stors[1].set(i, 0, stors[0].get_value(iter, 0))
|
||||||
stors[0].remove(iter)
|
stors[0].remove(iter)
|
||||||
|
|
||||||
def on_add(self, widget):
|
def on_add(self, widget):
|
||||||
|
"""When Add button is clicked"""
|
||||||
select = self.list1.get_selection()
|
select = self.list1.get_selection()
|
||||||
select.selected_foreach(self.add_grp, (self.store1, self.store2))
|
select.selected_foreach(self.add_grp, (self.store1, self.store2))
|
||||||
|
|
||||||
def on_remove(self, widget):
|
def on_remove(self, widget):
|
||||||
|
"""When Remove button is clicked"""
|
||||||
select = self.list2.get_selection()
|
select = self.list2.get_selection()
|
||||||
select.selected_foreach(self.add_grp, (self.store2, self.store1))
|
select.selected_foreach(self.add_grp, (self.store2, self.store1))
|
||||||
|
|
||||||
def on_new_key_pressed(self, widget, event):
|
def on_new_key_pressed(self, widget, event):
|
||||||
|
"""If enter is pressed in new group entry, add the group"""
|
||||||
if event.keyval == gtk.keysyms.Return:
|
if event.keyval == gtk.keysyms.Return:
|
||||||
txt = self.entry_new.get_text()
|
txt = self.entry_new.get_text()
|
||||||
iter = self.store1.append()
|
iter = self.store1.append()
|
||||||
self.store1.set(iter, 0, txt)
|
self.store1.set(iter, 0, txt)
|
||||||
self.entry_new.set_text('')
|
self.entry_new.set_text('')
|
||||||
|
return 1
|
||||||
|
else:
|
||||||
|
return 0
|
||||||
|
|
||||||
def init_lists(self):
|
def init_lists(self):
|
||||||
|
"""Initialize both available and current listStores"""
|
||||||
#list available
|
#list available
|
||||||
self.store1 = gtk.ListStore(gobject.TYPE_STRING)
|
self.store1 = gtk.ListStore(gobject.TYPE_STRING)
|
||||||
for i in self.r.l_group.keys():
|
for i in self.r.l_group.keys():
|
||||||
|
@ -127,21 +140,28 @@ class info_user:
|
||||||
self.xml.get_widget('label_id').set_text(user.jid)
|
self.xml.get_widget('label_id').set_text(user.jid)
|
||||||
self.xml.get_widget('label_resource').set_text(user.resource)
|
self.xml.get_widget('label_resource').set_text(user.resource)
|
||||||
self.xml.get_widget('entry_name').set_text(user.name)
|
self.xml.get_widget('entry_name').set_text(user.name)
|
||||||
self.xml.get_widget('label_status').set_text(user.show + ' : ' + user.status)
|
if not user.status:
|
||||||
|
user.status = ''
|
||||||
|
self.xml.get_widget('label_status').set_text(user.show + ' : ' + \
|
||||||
|
user.status)
|
||||||
self.init_lists()
|
self.init_lists()
|
||||||
|
|
||||||
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
|
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
|
||||||
self.xml.signal_connect('on_close_clicked', self.on_close)
|
self.xml.signal_connect('on_close_clicked', self.on_close)
|
||||||
self.xml.signal_connect('on_add_clicked', self.on_add)
|
self.xml.signal_connect('on_add_clicked', self.on_add)
|
||||||
self.xml.signal_connect('on_remove_clicked', self.on_remove)
|
self.xml.signal_connect('on_remove_clicked', self.on_remove)
|
||||||
self.xml.signal_connect('on_entry_new_key_press_event', self.on_new_key_pressed)
|
self.xml.signal_connect('on_entry_new_key_press_event', \
|
||||||
|
self.on_new_key_pressed)
|
||||||
|
|
||||||
|
|
||||||
class prefs:
|
class prefs:
|
||||||
|
"""Class for Preferences window"""
|
||||||
def delete_event(self, widget):
|
def delete_event(self, widget):
|
||||||
|
"""close window"""
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
def on_color_button_clicked(self, widget):
|
def on_color_button_clicked(self, widget):
|
||||||
|
"""Open a ColorSelectionDialog and change button's color"""
|
||||||
if widget.name == 'colorIn':
|
if widget.name == 'colorIn':
|
||||||
color = self.colorIn
|
color = self.colorIn
|
||||||
da = self.da_in
|
da = self.da_in
|
||||||
|
@ -169,6 +189,7 @@ class prefs:
|
||||||
colorseldlg.destroy()
|
colorseldlg.destroy()
|
||||||
|
|
||||||
def write_cfg(self):
|
def write_cfg(self):
|
||||||
|
"""Save preferences in config File and apply them"""
|
||||||
#Color for incomming messages
|
#Color for incomming messages
|
||||||
colSt = '#'+(hex(self.colorIn.red)+'0')[2:4]\
|
colSt = '#'+(hex(self.colorIn.red)+'0')[2:4]\
|
||||||
+(hex(self.colorIn.green)+'0')[2:4]\
|
+(hex(self.colorIn.green)+'0')[2:4]\
|
||||||
|
@ -235,10 +256,12 @@ class prefs:
|
||||||
self.r.redraw_roster()
|
self.r.redraw_roster()
|
||||||
|
|
||||||
def on_ok(self, widget):
|
def on_ok(self, widget):
|
||||||
|
"""When Ok button is clicked"""
|
||||||
self.write_cfg()
|
self.write_cfg()
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
def __init__(self, roster):
|
def __init__(self, roster):
|
||||||
|
"""Initialize Preference window"""
|
||||||
self.xml = gtk.glade.XML('plugins/gtkgui/gtkgui.glade', 'Prefs')
|
self.xml = gtk.glade.XML('plugins/gtkgui/gtkgui.glade', 'Prefs')
|
||||||
self.window = self.xml.get_widget("Prefs")
|
self.window = self.xml.get_widget("Prefs")
|
||||||
self.r = roster
|
self.r = roster
|
||||||
|
@ -320,19 +343,25 @@ class prefs:
|
||||||
self.spin_autoxatime.set_value(ti)
|
self.spin_autoxatime.set_value(ti)
|
||||||
|
|
||||||
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
|
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
|
||||||
self.xml.signal_connect('on_but_col_clicked', self.on_color_button_clicked)
|
self.xml.signal_connect('on_but_col_clicked', \
|
||||||
|
self.on_color_button_clicked)
|
||||||
self.xml.signal_connect('on_ok_clicked', self.on_ok)
|
self.xml.signal_connect('on_ok_clicked', self.on_ok)
|
||||||
|
|
||||||
class away_msg:
|
class away_msg:
|
||||||
|
"""Class for Away Message Window"""
|
||||||
def delete_event(self, widget):
|
def delete_event(self, widget):
|
||||||
|
"""close window"""
|
||||||
|
self.window.destroy()
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
def on_ok(self):
|
def on_ok(self):
|
||||||
|
"""When Ok button is clicked"""
|
||||||
beg, end = self.txtBuffer.get_bounds()
|
beg, end = self.txtBuffer.get_bounds()
|
||||||
self.msg = self.txtBuffer.get_text(beg, end, 0)
|
self.msg = self.txtBuffer.get_text(beg, end, 0)
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
"""Wait for Ok button to be pressed and return away messsage"""
|
||||||
rep = self.window.run()
|
rep = self.window.run()
|
||||||
if rep == gtk.RESPONSE_OK:
|
if rep == gtk.RESPONSE_OK:
|
||||||
self.on_ok()
|
self.on_ok()
|
||||||
|
@ -347,10 +376,13 @@ class away_msg:
|
||||||
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
|
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
|
||||||
|
|
||||||
class add:
|
class add:
|
||||||
|
"""Class for Add user window"""
|
||||||
def delete_event(self, widget):
|
def delete_event(self, widget):
|
||||||
|
"""close window"""
|
||||||
self.Wadd.destroy()
|
self.Wadd.destroy()
|
||||||
|
|
||||||
def on_subscribe(self, widget):
|
def on_subscribe(self, widget):
|
||||||
|
"""When Subscribe button is clicked"""
|
||||||
who = self.xml.get_widget("entry_who").get_text()
|
who = self.xml.get_widget("entry_who").get_text()
|
||||||
buf = self.xml.get_widget("textview_sub").get_buffer()
|
buf = self.xml.get_widget("textview_sub").get_buffer()
|
||||||
start_iter = buf.get_start_iter()
|
start_iter = buf.get_start_iter()
|
||||||
|
@ -369,7 +401,9 @@ class add:
|
||||||
self.xml.signal_connect('on_button_sub_clicked', self.on_subscribe)
|
self.xml.signal_connect('on_button_sub_clicked', self.on_subscribe)
|
||||||
|
|
||||||
class warning:
|
class warning:
|
||||||
|
"""Class for warning window : print a warning message"""
|
||||||
def delete_event(self, widget):
|
def delete_event(self, widget):
|
||||||
|
"""close window"""
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
def __init__(self, txt):
|
def __init__(self, txt):
|
||||||
|
@ -379,7 +413,9 @@ class warning:
|
||||||
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
|
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
|
||||||
|
|
||||||
class about:
|
class about:
|
||||||
|
"""Class for about window"""
|
||||||
def delete_event(self, widget):
|
def delete_event(self, widget):
|
||||||
|
"""close window"""
|
||||||
self.Wabout.destroy()
|
self.Wabout.destroy()
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -388,10 +424,13 @@ class about:
|
||||||
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
|
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
|
||||||
|
|
||||||
class account_pref:
|
class account_pref:
|
||||||
|
"""Class for account informations"""
|
||||||
def delete_event(self, widget):
|
def delete_event(self, widget):
|
||||||
|
"""close window"""
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
def init_account(self, infos):
|
def init_account(self, infos):
|
||||||
|
"""Initialize window with defaults values"""
|
||||||
if infos.has_key('name'):
|
if infos.has_key('name'):
|
||||||
self.xml.get_widget("entry_name").set_text(infos['name'])
|
self.xml.get_widget("entry_name").set_text(infos['name'])
|
||||||
if infos.has_key('jid'):
|
if infos.has_key('jid'):
|
||||||
|
@ -402,6 +441,7 @@ class account_pref:
|
||||||
self.xml.get_widget("entry_ressource").set_text(infos['ressource'])
|
self.xml.get_widget("entry_ressource").set_text(infos['ressource'])
|
||||||
|
|
||||||
def on_save_clicked(self, widget):
|
def on_save_clicked(self, widget):
|
||||||
|
"""When save button is clicked : Save informations in config file"""
|
||||||
name = self.xml.get_widget("entry_name").get_text()
|
name = self.xml.get_widget("entry_name").get_text()
|
||||||
jid = self.xml.get_widget('entry_jid').get_text()
|
jid = self.xml.get_widget('entry_jid').get_text()
|
||||||
if (name == ''):
|
if (name == ''):
|
||||||
|
@ -465,25 +505,32 @@ class account_pref:
|
||||||
self.xml.signal_connect('on_save_clicked', self.on_save_clicked)
|
self.xml.signal_connect('on_save_clicked', self.on_save_clicked)
|
||||||
|
|
||||||
class accounts:
|
class accounts:
|
||||||
|
"""Class for accounts window : lists of accounts"""
|
||||||
def delete_event(self, widget):
|
def delete_event(self, widget):
|
||||||
|
"""close window"""
|
||||||
global Waccounts
|
global Waccounts
|
||||||
Waccounts = 0
|
Waccounts = 0
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
def init_accounts(self):
|
def init_accounts(self):
|
||||||
|
"""initialize listStore with existing accounts"""
|
||||||
self.model.clear()
|
self.model.clear()
|
||||||
for account in self.accounts:
|
for account in self.accounts:
|
||||||
iter = self.model.append()
|
iter = self.model.append()
|
||||||
self.model.set(iter, 0, account, 1, self.cfgParser.__getattr__("%s" % account+"_hostname"))
|
self.model.set(iter, 0, account, 1, self.cfgParser.__getattr__("%s" % account+"_hostname"))
|
||||||
|
|
||||||
def on_row_activated(self, widget):
|
def on_row_activated(self, widget):
|
||||||
|
"""Activate delete and modify buttons when a row is selected"""
|
||||||
self.modButt.set_sensitive(TRUE)
|
self.modButt.set_sensitive(TRUE)
|
||||||
self.delButt.set_sensitive(TRUE)
|
self.delButt.set_sensitive(TRUE)
|
||||||
|
|
||||||
def on_new_clicked(self, widget):
|
def on_new_clicked(self, widget):
|
||||||
|
"""When new button is clicked : open an account information window"""
|
||||||
account_pref(self)
|
account_pref(self)
|
||||||
|
|
||||||
def on_delete_clicked(self, widget):
|
def on_delete_clicked(self, widget):
|
||||||
|
"""When delete button is clicked :
|
||||||
|
Remove an account from the listStore and from the config file"""
|
||||||
sel = self.treeview.get_selection()
|
sel = self.treeview.get_selection()
|
||||||
(mod, iter) = sel.get_selected()
|
(mod, iter) = sel.get_selected()
|
||||||
account = self.model.get_value(iter, 0)
|
account = self.model.get_value(iter, 0)
|
||||||
|
@ -496,6 +543,8 @@ class accounts:
|
||||||
self.init_accounts()
|
self.init_accounts()
|
||||||
|
|
||||||
def on_modify_clicked(self, widget):
|
def on_modify_clicked(self, widget):
|
||||||
|
"""When modify button is clicked :
|
||||||
|
open the account information window for this account"""
|
||||||
infos = {}
|
infos = {}
|
||||||
sel = self.treeview.get_selection()
|
sel = self.treeview.get_selection()
|
||||||
(mod, iter) = sel.get_selected()
|
(mod, iter) = sel.get_selected()
|
||||||
|
@ -534,6 +583,7 @@ class accounts:
|
||||||
|
|
||||||
class confirm:
|
class confirm:
|
||||||
def delete_event(self, widget):
|
def delete_event(self, widget):
|
||||||
|
"""close window"""
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
def req_usub(self, widget):
|
def req_usub(self, widget):
|
||||||
|
@ -554,6 +604,7 @@ class confirm:
|
||||||
|
|
||||||
class authorize:
|
class authorize:
|
||||||
def delete_event(self, widget):
|
def delete_event(self, widget):
|
||||||
|
"""close window"""
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
def auth(self, widget):
|
def auth(self, widget):
|
||||||
|
@ -578,6 +629,7 @@ class authorize:
|
||||||
|
|
||||||
class agent_reg:
|
class agent_reg:
|
||||||
def delete_event(self, widget):
|
def delete_event(self, widget):
|
||||||
|
"""close window"""
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
def draw_table(self):
|
def draw_table(self):
|
||||||
|
@ -620,6 +672,7 @@ class agent_reg:
|
||||||
|
|
||||||
class browser:
|
class browser:
|
||||||
def delete_event(self, widget):
|
def delete_event(self, widget):
|
||||||
|
"""close window"""
|
||||||
global Wbrowser
|
global Wbrowser
|
||||||
Wbrowser = 0
|
Wbrowser = 0
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
@ -665,6 +718,7 @@ class browser:
|
||||||
|
|
||||||
class message:
|
class message:
|
||||||
def delete_event(self, widget):
|
def delete_event(self, widget):
|
||||||
|
"""close window"""
|
||||||
del self.r.tab_messages[self.user.jid]
|
del self.r.tab_messages[self.user.jid]
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
|
@ -1257,6 +1311,8 @@ class plugin:
|
||||||
self.r.cfgParser.parseCfgFile()
|
self.r.cfgParser.parseCfgFile()
|
||||||
if (Waccounts != 0):
|
if (Waccounts != 0):
|
||||||
Waccounts.init_accounts()
|
Waccounts.init_accounts()
|
||||||
|
elif ev[0] == 'QUIT':
|
||||||
|
self.r.on_quit(self)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
def read_sleepy(self):
|
def read_sleepy(self):
|
||||||
|
|
|
@ -28,3 +28,4 @@ import common
|
||||||
import core
|
import core
|
||||||
|
|
||||||
core.core.start()
|
core.core.start()
|
||||||
|
print "Core Stopped"
|
||||||
|
|
Loading…
Reference in New Issue