assume config has each default value, so no need to verify each time we want to use it
This commit is contained in:
parent
792aeb573f
commit
1db49881c6
3 changed files with 13 additions and 34 deletions
|
@ -281,8 +281,11 @@ class GajimCore:
|
||||||
self.hub.sendPlugin('CONFIG', None, (ev[2][0], self.accounts))
|
self.hub.sendPlugin('CONFIG', None, (ev[2][0], self.accounts))
|
||||||
else:
|
else:
|
||||||
if self.cfgParser.tab.has_key(ev[2][1]):
|
if self.cfgParser.tab.has_key(ev[2][1]):
|
||||||
self.hub.sendPlugin('CONFIG', None, (ev[2][0], \
|
config = self.cfgParser.__getattr__(ev[2][1])
|
||||||
self.cfgParser.__getattr__(ev[2][1])))
|
for item in ev[2][2].keys():
|
||||||
|
if not config.has_key(item):
|
||||||
|
config[item] = ev[2][2][item]
|
||||||
|
self.hub.sendPlugin('CONFIG', None, (ev[2][0], config))
|
||||||
else:
|
else:
|
||||||
self.cfgParser.tab[ev[2][1]] = ev[2][2]
|
self.cfgParser.tab[ev[2][1]] = ev[2][2]
|
||||||
self.cfgParser.writeCfgFile()
|
self.cfgParser.writeCfgFile()
|
||||||
|
|
|
@ -271,24 +271,18 @@ class preference_Window:
|
||||||
|
|
||||||
#Color for incomming messages
|
#Color for incomming messages
|
||||||
colSt = self.plugin.config['inmsgcolor']
|
colSt = self.plugin.config['inmsgcolor']
|
||||||
if not colSt:
|
|
||||||
colSt = '#ff0000'
|
|
||||||
cmapIn = self.da_in.get_colormap()
|
cmapIn = self.da_in.get_colormap()
|
||||||
self.colorIn = cmapIn.alloc_color(colSt)
|
self.colorIn = cmapIn.alloc_color(colSt)
|
||||||
self.da_in.window.set_background(self.colorIn)
|
self.da_in.window.set_background(self.colorIn)
|
||||||
|
|
||||||
#Color for outgoing messages
|
#Color for outgoing messages
|
||||||
colSt = self.plugin.config['outmsgcolor']
|
colSt = self.plugin.config['outmsgcolor']
|
||||||
if not colSt:
|
|
||||||
colSt = '#0000ff'
|
|
||||||
cmapOut = self.da_out.get_colormap()
|
cmapOut = self.da_out.get_colormap()
|
||||||
self.colorOut = cmapOut.alloc_color(colSt)
|
self.colorOut = cmapOut.alloc_color(colSt)
|
||||||
self.da_out.window.set_background(self.colorOut)
|
self.da_out.window.set_background(self.colorOut)
|
||||||
|
|
||||||
#Color for status messages
|
#Color for status messages
|
||||||
colSt = self.plugin.config['statusmsgcolor']
|
colSt = self.plugin.config['statusmsgcolor']
|
||||||
if not colSt:
|
|
||||||
colSt = '#00ff00'
|
|
||||||
cmapStatus = self.da_status.get_colormap()
|
cmapStatus = self.da_status.get_colormap()
|
||||||
self.colorStatus = cmapStatus.alloc_color(colSt)
|
self.colorStatus = cmapStatus.alloc_color(colSt)
|
||||||
self.da_status.window.set_background(self.colorStatus)
|
self.da_status.window.set_background(self.colorStatus)
|
||||||
|
@ -306,39 +300,27 @@ class preference_Window:
|
||||||
self.combo_iconstyle.entry.set_text(self.plugin.config['iconstyle'])
|
self.combo_iconstyle.entry.set_text(self.plugin.config['iconstyle'])
|
||||||
|
|
||||||
#Autopopup
|
#Autopopup
|
||||||
st = 1
|
st = self.plugin.config['autopopup']
|
||||||
if self.plugin.config.has_key('autopopup'):
|
|
||||||
st = self.plugin.config['autopopup']
|
|
||||||
self.chk_autopp.set_active(st)
|
self.chk_autopp.set_active(st)
|
||||||
|
|
||||||
#Autopopupaway
|
#Autopopupaway
|
||||||
st = 1
|
st = self.plugin.config['autopopupaway']
|
||||||
if self.plugin.config.has_key('autopopupaway'):
|
|
||||||
st = self.plugin.config['autopopupaway']
|
|
||||||
self.chk_autoppaway.set_active(st)
|
self.chk_autoppaway.set_active(st)
|
||||||
|
|
||||||
#Autoaway
|
#Autoaway
|
||||||
st = 1
|
st = self.plugin.config['autoaway']
|
||||||
if self.plugin.config.has_key('autoaway'):
|
|
||||||
st = self.plugin.config['autoaway']
|
|
||||||
self.chk_autoaway.set_active(st)
|
self.chk_autoaway.set_active(st)
|
||||||
|
|
||||||
#Autoawaytime
|
#Autoawaytime
|
||||||
st = 10
|
st = self.plugin.config['autoawaytime']
|
||||||
if self.plugin.config.has_key('autoawaytime'):
|
|
||||||
st = self.plugin.config['autoawaytime']
|
|
||||||
self.spin_autoawaytime.set_value(st)
|
self.spin_autoawaytime.set_value(st)
|
||||||
|
|
||||||
#Autoxa
|
#Autoxa
|
||||||
st = 1
|
st = self.plugin.config['autoxa']
|
||||||
if self.plugin.config.has_key('autoxa'):
|
|
||||||
st = self.plugin.config['autoxa']
|
|
||||||
self.chk_autoxa.set_active(st)
|
self.chk_autoxa.set_active(st)
|
||||||
|
|
||||||
#Autoxatime
|
#Autoxatime
|
||||||
st = 20
|
st = self.plugin.config['autoxatime']
|
||||||
if self.plugin.config.has_key('autoxatime'):
|
|
||||||
st = self.plugin.config['autoxatime']
|
|
||||||
self.spin_autoxatime.set_value(st)
|
self.spin_autoxatime.set_value(st)
|
||||||
|
|
||||||
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
|
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
|
||||||
|
|
|
@ -170,18 +170,12 @@ class message_Window:
|
||||||
self.on_msg_key_press_event)
|
self.on_msg_key_press_event)
|
||||||
self.tagIn = buffer.create_tag("incoming")
|
self.tagIn = buffer.create_tag("incoming")
|
||||||
color = self.plugin.config['inmsgcolor']
|
color = self.plugin.config['inmsgcolor']
|
||||||
if not color:
|
|
||||||
color = 'red'
|
|
||||||
self.tagIn.set_property("foreground", color)
|
self.tagIn.set_property("foreground", color)
|
||||||
self.tagOut = buffer.create_tag("outgoing")
|
self.tagOut = buffer.create_tag("outgoing")
|
||||||
color = self.plugin.config['outmsgcolor']
|
color = self.plugin.config['outmsgcolor']
|
||||||
if not color:
|
|
||||||
color = 'blue'
|
|
||||||
self.tagOut.set_property("foreground", color)
|
self.tagOut.set_property("foreground", color)
|
||||||
self.tagStatus = buffer.create_tag("status")
|
self.tagStatus = buffer.create_tag("status")
|
||||||
color = self.plugin.config['statusmsgcolor']
|
color = self.plugin.config['statusmsgcolor']
|
||||||
if not color:
|
|
||||||
color = 'green'
|
|
||||||
self.tagStatus.set_property("foreground", color)
|
self.tagStatus.set_property("foreground", color)
|
||||||
#print queued messages
|
#print queued messages
|
||||||
if plugin.queues[account].has_key(user.jid):
|
if plugin.queues[account].has_key(user.jid):
|
||||||
|
@ -1669,9 +1663,9 @@ class plugin:
|
||||||
self.send('ASK_CONFIG', None, ('GtkGui', 'GtkGui', {'autopopup':1,\
|
self.send('ASK_CONFIG', None, ('GtkGui', 'GtkGui', {'autopopup':1,\
|
||||||
'autopopupaway':1,\
|
'autopopupaway':1,\
|
||||||
'showoffline':0,\
|
'showoffline':0,\
|
||||||
'autoaway':0,\
|
'autoaway':1,\
|
||||||
'autoawaytime':10,\
|
'autoawaytime':10,\
|
||||||
'autoxa':0,\
|
'autoxa':1,\
|
||||||
'autoxatime':20,\
|
'autoxatime':20,\
|
||||||
'iconstyle':'sun',\
|
'iconstyle':'sun',\
|
||||||
'inmsgcolor':'#ff0000',\
|
'inmsgcolor':'#ff0000',\
|
||||||
|
|
Loading…
Add table
Reference in a new issue