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
|
@ -281,8 +281,11 @@ class GajimCore:
|
|||
self.hub.sendPlugin('CONFIG', None, (ev[2][0], self.accounts))
|
||||
else:
|
||||
if self.cfgParser.tab.has_key(ev[2][1]):
|
||||
self.hub.sendPlugin('CONFIG', None, (ev[2][0], \
|
||||
self.cfgParser.__getattr__(ev[2][1])))
|
||||
config = 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:
|
||||
self.cfgParser.tab[ev[2][1]] = ev[2][2]
|
||||
self.cfgParser.writeCfgFile()
|
||||
|
|
|
@ -271,24 +271,18 @@ class preference_Window:
|
|||
|
||||
#Color for incomming messages
|
||||
colSt = self.plugin.config['inmsgcolor']
|
||||
if not colSt:
|
||||
colSt = '#ff0000'
|
||||
cmapIn = self.da_in.get_colormap()
|
||||
self.colorIn = cmapIn.alloc_color(colSt)
|
||||
self.da_in.window.set_background(self.colorIn)
|
||||
|
||||
#Color for outgoing messages
|
||||
colSt = self.plugin.config['outmsgcolor']
|
||||
if not colSt:
|
||||
colSt = '#0000ff'
|
||||
cmapOut = self.da_out.get_colormap()
|
||||
self.colorOut = cmapOut.alloc_color(colSt)
|
||||
self.da_out.window.set_background(self.colorOut)
|
||||
|
||||
#Color for status messages
|
||||
colSt = self.plugin.config['statusmsgcolor']
|
||||
if not colSt:
|
||||
colSt = '#00ff00'
|
||||
cmapStatus = self.da_status.get_colormap()
|
||||
self.colorStatus = cmapStatus.alloc_color(colSt)
|
||||
self.da_status.window.set_background(self.colorStatus)
|
||||
|
@ -306,38 +300,26 @@ class preference_Window:
|
|||
self.combo_iconstyle.entry.set_text(self.plugin.config['iconstyle'])
|
||||
|
||||
#Autopopup
|
||||
st = 1
|
||||
if self.plugin.config.has_key('autopopup'):
|
||||
st = self.plugin.config['autopopup']
|
||||
self.chk_autopp.set_active(st)
|
||||
|
||||
#Autopopupaway
|
||||
st = 1
|
||||
if self.plugin.config.has_key('autopopupaway'):
|
||||
st = self.plugin.config['autopopupaway']
|
||||
self.chk_autoppaway.set_active(st)
|
||||
|
||||
#Autoaway
|
||||
st = 1
|
||||
if self.plugin.config.has_key('autoaway'):
|
||||
st = self.plugin.config['autoaway']
|
||||
self.chk_autoaway.set_active(st)
|
||||
|
||||
#Autoawaytime
|
||||
st = 10
|
||||
if self.plugin.config.has_key('autoawaytime'):
|
||||
st = self.plugin.config['autoawaytime']
|
||||
self.spin_autoawaytime.set_value(st)
|
||||
|
||||
#Autoxa
|
||||
st = 1
|
||||
if self.plugin.config.has_key('autoxa'):
|
||||
st = self.plugin.config['autoxa']
|
||||
self.chk_autoxa.set_active(st)
|
||||
|
||||
#Autoxatime
|
||||
st = 20
|
||||
if self.plugin.config.has_key('autoxatime'):
|
||||
st = self.plugin.config['autoxatime']
|
||||
self.spin_autoxatime.set_value(st)
|
||||
|
||||
|
|
|
@ -170,18 +170,12 @@ class message_Window:
|
|||
self.on_msg_key_press_event)
|
||||
self.tagIn = buffer.create_tag("incoming")
|
||||
color = self.plugin.config['inmsgcolor']
|
||||
if not color:
|
||||
color = 'red'
|
||||
self.tagIn.set_property("foreground", color)
|
||||
self.tagOut = buffer.create_tag("outgoing")
|
||||
color = self.plugin.config['outmsgcolor']
|
||||
if not color:
|
||||
color = 'blue'
|
||||
self.tagOut.set_property("foreground", color)
|
||||
self.tagStatus = buffer.create_tag("status")
|
||||
color = self.plugin.config['statusmsgcolor']
|
||||
if not color:
|
||||
color = 'green'
|
||||
self.tagStatus.set_property("foreground", color)
|
||||
#print queued messages
|
||||
if plugin.queues[account].has_key(user.jid):
|
||||
|
@ -1669,9 +1663,9 @@ class plugin:
|
|||
self.send('ASK_CONFIG', None, ('GtkGui', 'GtkGui', {'autopopup':1,\
|
||||
'autopopupaway':1,\
|
||||
'showoffline':0,\
|
||||
'autoaway':0,\
|
||||
'autoaway':1,\
|
||||
'autoawaytime':10,\
|
||||
'autoxa':0,\
|
||||
'autoxa':1,\
|
||||
'autoxatime':20,\
|
||||
'iconstyle':'sun',\
|
||||
'inmsgcolor':'#ff0000',\
|
||||
|
|
Loading…
Reference in New Issue