it is now possible to configure logger plugin from gtkgui plugin

This commit is contained in:
Yann Leboulanger 2004-11-04 01:03:17 +00:00
parent 811dfbebed
commit 48dfd4a3ea
5 changed files with 235 additions and 16 deletions

View File

@ -631,7 +631,7 @@ class GajimCore:
self.cfgParser.writeCfgFile()
config['usegpg'] = USE_GPG
self.hub.sendPlugin('CONFIG', None, (ev[2][0], config))
#('CONFIG', account, (section, config))
#('CONFIG', account, (section, config, who_sent))
elif ev[0] == 'CONFIG':
if ev[2][0] == 'accounts':
#Remove all old accounts
@ -653,6 +653,8 @@ class GajimCore:
self.gpg[a] = MyGnuPG()
else:
self.cfgParser.tab[ev[2][0]] = ev[2][1]
if ev[2][0] != ev[2][2]:
self.hub.sendPlugin('CONFIG', None, (ev[2][0], ev[2][1]))
self.cfgParser.writeCfgFile()
#TODO: tell the changes to other plugins
#('STATUS', account, (status, msg))

View File

@ -256,8 +256,19 @@ class preference_Window:
self.plugin.config['trayicon'] = 1
else:
self.plugin.config['trayicon'] = 0
self.plugin.send('CONFIG', None, ('GtkGui', self.plugin.config))
self.plugin.send('CONFIG', None, ('GtkGui', self.plugin.config, 'GtkGui'))
self.plugin.roster.draw_roster()
#log presences in user file
if self.xml.get_widget('chk_log_pres_usr').get_active():
self.config_logger['lognotusr'] = 1
else:
self.config_logger['lognotusr'] = 0
#log presences in external file
if self.xml.get_widget('chk_log_pres_ext').get_active():
self.config_logger['lognotsep'] = 1
else:
self.config_logger['lognotsep'] = 0
self.plugin.send('CONFIG', None, ('Logger', self.config_logger, 'GtkGui'))
def on_ok(self, widget):
"""When Ok button is clicked"""
@ -280,6 +291,9 @@ class preference_Window:
def on_presence_button_clicked(self, widget, data=None):
self.change_notebook_page(2)
def on_log_button_clicked(self, widget, data=None):
self.change_notebook_page(3)
def fill_msg_treeview(self):
i = 0
self.xml.get_widget('delete_msg_button').set_sensitive(False)
@ -344,13 +358,6 @@ class preference_Window:
self.chk_trayicon = self.xml.get_widget('chk_trayicon')
self.notebook = self.xml.get_widget('preferences_notebook')
button = self.xml.get_widget('lookfeel_button')
button.connect('clicked', self.on_lookfeel_button_clicked)
button = self.xml.get_widget('events_button')
button.connect('clicked', self.on_events_button_clicked)
button = self.xml.get_widget('presence_button')
button.connect('clicked', self.on_presence_button_clicked)
#Color for incomming messages
colSt = self.plugin.config['inmsgcolor']
self.xml.get_widget('colorbutton_in').set_color(\
@ -488,6 +495,26 @@ class preference_Window:
self.on_chk_toggled, [self.spin_autoawaytime])
self.xml.signal_connect('on_chk_autoxa_toggled', \
self.on_chk_toggled, [self.spin_autoxatime])
self.xml.signal_connect('on_lookfeel_button_clicked', \
self.on_lookfeel_button_clicked)
self.xml.signal_connect('on_events_button_clicked', \
self.on_events_button_clicked)
self.xml.signal_connect('on_presence_button_clicked', \
self.on_presence_button_clicked)
self.xml.signal_connect('on_log_button_clicked', \
self.on_log_button_clicked)
self.plugin.send('ASK_CONFIG', None, ('GtkGui', 'Logger', {'lognotsep':1,\
'lognotusr':1}))
self.config_logger = self.plugin.wait('CONFIG')
#log presences in user file
st = self.config_logger['lognotusr']
self.xml.get_widget('chk_log_pres_usr').set_active(st)
#log presences in external file
st = self.config_logger['lognotsep']
self.xml.get_widget('chk_log_pres_ext').set_active(st)
class accountPreference_Window:
"""Class for account informations"""
@ -637,7 +664,8 @@ class accountPreference_Window:
entryProxyhost.get_text(), 'proxyport': proxyPort, 'keyid': keyID, \
'keyname': keyName, 'savegpgpass': save_gpg_pass, \
'gpgpass': gpg_pass}
self.plugin.send('CONFIG', None, ('accounts', self.plugin.accounts))
self.plugin.send('CONFIG', None, ('accounts', self.plugin.accounts, \
'GtkGui'))
#refresh accounts window
if self.plugin.windows.has_key('accounts'):
self.plugin.windows['accounts'].init_accounts()
@ -662,7 +690,8 @@ class accountPreference_Window:
autoconnect, 'use_proxy': useProxy, 'proxyhost': \
entryProxyhost.get_text(), 'proxyport': proxyPort, 'keyid': keyID, \
'keyname': keyName, 'savegpgpass': save_gpg_pass, 'gpgpass': gpg_pass}
self.plugin.send('CONFIG', None, ('accounts', self.plugin.accounts))
self.plugin.send('CONFIG', None, ('accounts', self.plugin.accounts, \
'GtkGui'))
#update variables
self.plugin.windows[name] = {'infos': {}, 'chats': {}, 'gc': {}}
self.plugin.queues[name] = {}
@ -792,7 +821,8 @@ class accounts_Window:
if self.plugin.connected[account]:
self.plugin.send('STATUS', account, ('offline', 'offline'))
del self.plugin.accounts[account]
self.plugin.send('CONFIG', None, ('accounts', self.plugin.accounts))
self.plugin.send('CONFIG', None, ('accounts', self.plugin.accounts, \
'GtkGui'))
del self.plugin.windows[account]
del self.plugin.queues[account]
del self.plugin.connected[account]

View File

@ -3626,6 +3626,63 @@ on the server.</property>
</child>
</widget>
</child>
<child>
<widget class="GtkButton" id="button28">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">False</property>
<signal name="clicked" handler="on_log_button_clicked" last_modification_time="Wed, 03 Nov 2004 22:15:28 GMT"/>
<child>
<widget class="GtkVBox" id="vbox39">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkImage" id="image173">
<property name="visible">True</property>
<property name="stock">gtk-justify-fill</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label170">
<property name="visible">True</property>
<property name="label" translatable="yes">Log</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
@ -4882,6 +4939,133 @@ when NOT online</property>
<property name="type">tab</property>
</packing>
</child>
<child>
<widget class="GtkFixed" id="fixed6">
<property name="visible">True</property>
<child>
<widget class="GtkFrame" id="frame20">
<property name="width_request">344</property>
<property name="height_request">122</property>
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="GtkAlignment" id="alignment32">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">12</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkVBox" id="vbox40">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkCheckButton" id="chk_log_pres_usr">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Log presences in user's log file</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_log_pres_ext">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Log presences in an external file</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label171">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Log presences&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="x">0</property>
<property name="y">0</property>
</packing>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>
<property name="tab_fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label169">
<property name="visible">True</property>
<property name="label" translatable="yes">Log</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="type">tab</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>

View File

@ -1535,7 +1535,7 @@ class roster_Window:
"""When we quit the gtk plugin :
tell that to the core and exit gtk"""
self.plugin.config['hiddenlines'] = string.join(self.hidden_lines, '\t')
self.plugin.send('CONFIG', None, ('GtkGui', self.plugin.config))
self.plugin.send('CONFIG', None, ('GtkGui', self.plugin.config, 'GtkGui'))
self.plugin.send('QUIT', None, ('gtkgui', 1))
print _("plugin gtkgui stopped")
self.close_all(self.plugin.windows)
@ -1671,7 +1671,7 @@ class roster_Window:
"""when show offline option is changed :
redraw the treeview"""
self.plugin.config['showoffline'] = 1 - self.plugin.config['showoffline']
self.plugin.send('CONFIG', None, ('GtkGui', self.plugin.config))
self.plugin.send('CONFIG', None, ('GtkGui', self.plugin.config, 'GtkGui'))
self.draw_roster()
def iconCellDataFunc(self, column, renderer, model, iter, data=None):
@ -2243,7 +2243,7 @@ class plugin:
'use_proxy': array[6],\
'proxyhost': array[7], \
'proxyport': array[8]}
self.send('CONFIG', None, ('accounts', self.accounts))
self.send('CONFIG', None, ('accounts', self.accounts, 'GtkGui'))
self.windows[name] = {'infos': {}, 'chats': {}, 'gc': {}}
self.queues[name] = {}
self.connected[name] = 0
@ -2478,7 +2478,7 @@ class plugin:
import trayicon
except:
self.config['trayicon'] = 0
self.send('CONFIG', None, ('GtkGui', self.config))
self.send('CONFIG', None, ('GtkGui', self.config, 'GtkGui'))
self.systray = systrayDummy()
else:
self.systray = systray(self)

View File

@ -116,6 +116,9 @@ class plugin:
t = time.mktime(ev[2][2])
fic.write("%s:recv:%s:%s\n" % (t, nick, msg))
fic.close()
elif ev[0] == 'CONFIG':
if ev[2][0] == 'Logger':
self.config = ev[2][1]
time.sleep(0.1)
def wait(self, what):