update files from trunk

This commit is contained in:
Yann Leboulanger 2005-04-12 15:30:09 +00:00
parent 119ac50004
commit fbf6c84e52
8 changed files with 996 additions and 280 deletions

View file

@ -215,7 +215,9 @@ class Chat:
self.xmls[jid].get_widget('conversation_textview') self.xmls[jid].get_widget('conversation_textview')
conversation_buffer = conversation_textview.get_buffer() conversation_buffer = conversation_textview.get_buffer()
end_iter = conversation_buffer.get_end_iter() end_iter = conversation_buffer.get_end_iter()
conversation_buffer.create_mark('end', end_iter, 0)
conversation_buffer.create_mark('end', end_iter, False)
self.tagIn[jid] = conversation_buffer.create_tag('incoming') self.tagIn[jid] = conversation_buffer.create_tag('incoming')
color = self.plugin.config['inmsgcolor'] color = self.plugin.config['inmsgcolor']
self.tagIn[jid].set_property('foreground', color) self.tagIn[jid].set_property('foreground', color)
@ -270,59 +272,79 @@ class Chat:
self.show_title() self.show_title()
def on_conversation_textview_key_press_event(self, widget, event): def on_conversation_textview_key_press_event(self, widget, event):
"""Do not black these evnts and send them to the notebook""" """Do not block these events and send them to the notebook"""
if event.keyval == gtk.keysyms.Tab and \ if (event.state & gtk.gdk.CONTROL_MASK) and \
(event.state & gtk.gdk.CONTROL_MASK): # CTRL + TAB (event.state & gtk.gdk.SHIFT_MASK):
self.notebook.emit('key_press_event', event) if event.hardware_keycode == 23: # CTRL + SHIFT + TAB
elif event.keyval == gtk.keysyms.Page_Down: # PAGE DOWN
if event.state & gtk.gdk.CONTROL_MASK: # CTRL + PAGE DOWN
self.notebook.emit('key_press_event', event) self.notebook.emit('key_press_event', event)
elif event.keyval == gtk.keysyms.Page_Up: # PAGE UP elif event.state & gtk.gdk.CONTROL_MASK:
if event.state & gtk.gdk.CONTROL_MASK: # CTRL + PAGE UP if event.keyval == gtk.keysyms.Tab: # CTRL + TAB
self.notebook.emit('key_press_event', event) self.notebook.emit('key_press_event', event)
elif event.keyval == gtk.keysyms.Page_Down: # CTRL + PAGE DOWN
self.notebook.emit('key_press_event', event)
elif event.keyval == gtk.keysyms.Page_Up: # CTRL + PAGE UP
self.notebook.emit('key_press_event', event)
def on_chat_notebook_key_press_event(self, widget, event): def on_chat_notebook_key_press_event(self, widget, event):
st = '1234567890' # zero is here cause humans count from 1, pc from 0 :P st = '1234567890' # zero is here cause humans count from 1, pc from 0 :P
jid = self.get_active_jid() jid = self.get_active_jid()
if event.keyval == gtk.keysyms.Escape: # ESCAPE if event.keyval == gtk.keysyms.Escape: # ESCAPE
self.remove_tab(jid) self.remove_tab(jid)
elif event.keyval == gtk.keysyms.F4 and \
(event.state & gtk.gdk.CONTROL_MASK): # CTRL + F4
self.remove_tab(jid)
elif event.string and event.string in st \ elif event.string and event.string in st \
and (event.state & gtk.gdk.MOD1_MASK): # alt + 1,2,3.. and (event.state & gtk.gdk.MOD1_MASK): # alt + 1,2,3..
self.notebook.set_current_page(st.index(event.string)) self.notebook.set_current_page(st.index(event.string))
elif event.keyval == gtk.keysyms.Page_Down: # PAGE DOWN elif event.keyval == gtk.keysyms.Page_Down:
if event.state & gtk.gdk.CONTROL_MASK: if event.state & gtk.gdk.CONTROL_MASK: # CTRL + PAGE DOWN
current = self.notebook.get_current_page() current = self.notebook.get_current_page()
if current > 0: if current > 0:
self.notebook.set_current_page(current-1) self.notebook.set_current_page(current-1)
elif event.state & gtk.gdk.SHIFT_MASK: elif event.state & gtk.gdk.SHIFT_MASK: # SHIFT + PAGE DOWN
conversation_textview = self.xmls[jid].\ conversation_textview = self.xmls[jid].\
get_widget('conversation_textview') get_widget('conversation_textview')
rect = conversation_textview.get_visible_rect() rect = conversation_textview.get_visible_rect()
iter = conversation_textview.get_iter_at_location(rect.x,\ iter = conversation_textview.get_iter_at_location(rect.x,\
rect.y + rect.height) rect.y + rect.height)
conversation_textview.scroll_to_iter(iter, 0.1, True, 0, 0) conversation_textview.scroll_to_iter(iter, 0.1, True, 0, 0)
elif event.keyval == gtk.keysyms.Page_Up: # PAGE UP elif event.keyval == gtk.keysyms.Page_Up:
if event.state & gtk.gdk.CONTROL_MASK: if event.state & gtk.gdk.CONTROL_MASK: # CTRL + PAGE UP
current = self.notebook.get_current_page() current = self.notebook.get_current_page()
if current < (self.notebook.get_n_pages()-1): if current < (self.notebook.get_n_pages()-1):
self.notebook.set_current_page(current+1) self.notebook.set_current_page(current+1)
elif event.state & gtk.gdk.SHIFT_MASK: elif event.state & gtk.gdk.SHIFT_MASK: # SHIFT + PAGE UP
conversation_textview = self.xmls[jid].\ conversation_textview = self.xmls[jid].\
get_widget('conversation_textview') get_widget('conversation_textview')
rect = conversation_textview.get_visible_rect() rect = conversation_textview.get_visible_rect()
iter = conversation_textview.get_iter_at_location(rect.x, rect.y) iter = conversation_textview.get_iter_at_location(rect.x, rect.y)
conversation_textview.scroll_to_iter(iter, 0.1, True, 0, 1) conversation_textview.scroll_to_iter(iter, 0.1, True, 0, 1)
elif event.keyval == gtk.keysyms.Tab and \ # or event.keyval == gtk.keysyms.KP_Up
(event.state & gtk.gdk.CONTROL_MASK): # CTRL + TAB elif event.keyval == gtk.keysyms.Up:
current = self.notebook.get_current_page() if event.state & gtk.gdk.SHIFT_MASK: # SHIFT + UP
if current < (self.notebook.get_n_pages()-1): print 'be' # FIXME: find a way to to keyUP in scrolledwindow
self.notebook.set_current_page(current+1) conversation_scrolledwindow = self.xml.get_widget\
else: ('conversation_scrolledwindow')
self.notebook.set_current_page(0) conversation_scrolledwindow.emit('scroll-child', \
gtk.SCROLL_PAGE_BACKWARD, False)
elif event.hardware_keycode == 23: # TAB
if (event.state & gtk.gdk.CONTROL_MASK) and \
(event.state & gtk.gdk.SHIFT_MASK): # CTRL + SHIFT + TAB
current = self.notebook.get_current_page()
if current > 0:
self.notebook.set_current_page(current-1)
else:
self.notebook.set_current_page(self.notebook.get_n_pages()-1)
elif event.state & gtk.gdk.CONTROL_MASK: # CTRL + TAB
current = self.notebook.get_current_page()
if current < (self.notebook.get_n_pages()-1):
self.notebook.set_current_page(current+1)
else:
self.notebook.set_current_page(0)
elif (event.state & gtk.gdk.CONTROL_MASK) or (event.keyval ==\ elif (event.state & gtk.gdk.CONTROL_MASK) or (event.keyval ==\
gtk.keysyms.Control_L) or (event.keyval == gtk.keysyms.Control_R): gtk.keysyms.Control_L) or (event.keyval == gtk.keysyms.Control_R):
# we pressed a control key or ctrl+sth : we don't block the event # we pressed a control key or ctrl+sth: we don't block the event
# in order to let ctrl+c do its work # in order to let ctrl+c (copy text) and others do their default work
pass pass
else: # it's a normal key press make sure message_textview has focus else: # it's a normal key press make sure message_textview has focus
message_textview = self.xmls[jid].get_widget('message_textview') message_textview = self.xmls[jid].get_widget('message_textview')
@ -375,7 +397,10 @@ class Chat:
iter = widget.get_iter_at_location(x, y) iter = widget.get_iter_at_location(x, y)
tags = iter.get_tags() tags = iter.get_tags()
if tags: if tags:
return True for tag in tags:
tag_name = tag.get_property('name')
if 'url' in tag_name or 'mail' in tag_name:
return True
def print_time_timeout(self, jid): def print_time_timeout(self, jid):
if not jid in self.xmls.keys(): if not jid in self.xmls.keys():
@ -438,7 +463,7 @@ class Chat:
while not end_iter.ends_tag(texttag): while not end_iter.ends_tag(texttag):
end_iter.forward_char() end_iter.forward_char()
word = begin_iter.get_text(end_iter) word = begin_iter.get_text(end_iter)
if event.button == 3: if event.button == 3: # right click
self.make_link_menu(event, kind, word) self.make_link_menu(event, kind, word)
else: else:
#we launch the correct application #we launch the correct application
@ -548,14 +573,26 @@ class Chat:
self.print_with_tag_list(conversation_buffer, special_text, end_iter, \ self.print_with_tag_list(conversation_buffer, special_text, end_iter, \
all_tags) all_tags)
def scroll_to_end(self, textview):
buffer = textview.get_buffer()
textview.scroll_to_mark(buffer.get_mark('end'), 0, True, 0, 1)
return False
def print_conversation_line(self, text, jid, kind, name, tim, \ def print_conversation_line(self, text, jid, kind, name, tim, \
other_tags_for_name = []): other_tags_for_name = []):
conversation_textview = self.xmls[jid].get_widget('conversation_textview') conversation_textview = self.xmls[jid].get_widget('conversation_textview')
conversation_buffer = conversation_textview.get_buffer() conversation_buffer = conversation_textview.get_buffer()
print_all_special = False print_all_special = False
at_the_end = False
end_iter = conversation_buffer.get_end_iter()
end_rect = conversation_textview.get_iter_location(end_iter)
visible_rect = conversation_textview.get_visible_rect()
if end_rect.y <= (visible_rect.y + visible_rect.height):
at_the_end = True
if not text: if not text:
text = '' text = ''
end_iter = conversation_buffer.get_end_iter() if conversation_buffer.get_char_count() > 0:
conversation_buffer.insert(end_iter, '\n')
if self.plugin.config['print_time'] == 'always': if self.plugin.config['print_time'] == 'always':
if not tim: if not tim:
tim = time.localtime() tim = time.localtime()
@ -583,7 +620,6 @@ class Chat:
+ self.after_nickname_symbols + ' ' + self.after_nickname_symbols + ' '
self.print_with_tag_list(conversation_buffer, format, end_iter, tags) self.print_with_tag_list(conversation_buffer, format, end_iter, tags)
text += '\n'
# detect urls formatting and if the user has it on emoticons # detect urls formatting and if the user has it on emoticons
index = self.detect_and_print_special_text(text, jid, \ index = self.detect_and_print_special_text(text, jid, \
tags, print_all_special) tags, print_all_special)
@ -597,16 +633,12 @@ class Chat:
conversation_buffer.insert(end_iter, text[index:]) conversation_buffer.insert(end_iter, text[index:])
#scroll to the end of the textview #scroll to the end of the textview
end_iter = conversation_buffer.get_end_iter()
end_rect = conversation_textview.get_iter_location(end_iter)
visible_rect = conversation_textview.get_visible_rect()
end = False end = False
if end_rect.y <= (visible_rect.y + visible_rect.height) or \ if at_the_end or (kind == 'outgoing'):
(kind == 'outgoing'):
#we are at the end or we are sending something #we are at the end or we are sending something
end = True end = True
conversation_textview.scroll_to_mark(conversation_buffer.\ # We scroll to the end after the scrollbar has appeared
get_mark('end'), 0.1, 0, 0, 0) gobject.timeout_add(50, self.scroll_to_end, conversation_textview)
if ((jid != self.get_active_jid()) or (not self.window.is_active()) or \ if ((jid != self.get_active_jid()) or (not self.window.is_active()) or \
(not end)) and kind == 'incoming': (not end)) and kind == 'incoming':
self.nb_unread[jid] += 1 self.nb_unread[jid] += 1

View file

@ -42,11 +42,18 @@ class Preferences_window:
return True # do NOT destroy the window return True # do NOT destroy the window
def on_close_button_clicked(self, widget): def on_close_button_clicked(self, widget):
self.window.hide() self.window.hide()
def on_preferences_window_show(self, widget): def on_preferences_window_show(self, widget):
self.notebook.set_current_page(0) self.notebook.set_current_page(0)
if os.name == 'nt': # if windows, player must not be visible
self.xml.get_widget('soundplayer_hbox').set_property('visible', False)
self.trayicon_checkbutton.set_property('visible', False)
def on_preferences_window_key_press_event(self, widget, event):
if event.keyval == gtk.keysyms.Escape: # ESCAPE
self.window.hide()
def on_checkbutton_toggled(self, widget, config_name, \ def on_checkbutton_toggled(self, widget, config_name, \
change_sensitivity_widgets = None): change_sensitivity_widgets = None):
if widget.get_active(): if widget.get_active():
@ -56,8 +63,9 @@ class Preferences_window:
if change_sensitivity_widgets != None: if change_sensitivity_widgets != None:
for w in change_sensitivity_widgets: for w in change_sensitivity_widgets:
w.set_sensitive(widget.get_active()) w.set_sensitive(widget.get_active())
self.plugin.save_config()
def on_tray_icon_checkbutton_toggled(self, widget): def on_trayicon_checkbutton_toggled(self, widget):
if widget.get_active(): if widget.get_active():
self.plugin.config['trayicon'] = 1 self.plugin.config['trayicon'] = 1
self.plugin.show_systray() self.plugin.show_systray()
@ -67,12 +75,14 @@ class Preferences_window:
self.plugin.hide_systray() self.plugin.hide_systray()
self.plugin.send('CONFIG', None, ('GtkGui', self.plugin.config, 'GtkGui')) self.plugin.send('CONFIG', None, ('GtkGui', self.plugin.config, 'GtkGui'))
self.plugin.roster.draw_roster() self.plugin.roster.draw_roster()
self.plugin.save_config()
def on_save_position_checkbutton_toggled(self, widget): def on_save_position_checkbutton_toggled(self, widget):
if widget.get_active(): if widget.get_active():
self.plugin.config['saveposition'] = 1 self.plugin.config['saveposition'] = 1
else: else:
self.plugin.config['saveposition'] = 0 self.plugin.config['saveposition'] = 0
self.plugin.save_config()
def on_merge_checkbutton_toggled(self, widget): def on_merge_checkbutton_toggled(self, widget):
if widget.get_active(): if widget.get_active():
@ -81,6 +91,7 @@ class Preferences_window:
self.plugin.config['mergeaccounts'] = 0 self.plugin.config['mergeaccounts'] = 0
self.plugin.roster.regroup = self.plugin.config['mergeaccounts'] self.plugin.roster.regroup = self.plugin.config['mergeaccounts']
self.plugin.roster.draw_roster() self.plugin.roster.draw_roster()
self.plugin.save_config()
def on_iconset_combobox_changed(self, widget): def on_iconset_combobox_changed(self, widget):
model = widget.get_model() model = widget.get_model()
@ -88,6 +99,7 @@ class Preferences_window:
icon_string = model[active][0] icon_string = model[active][0]
self.plugin.config['iconset'] = icon_string self.plugin.config['iconset'] = icon_string
self.plugin.roster.reload_pixbufs() self.plugin.roster.reload_pixbufs()
self.plugin.save_config()
def on_account_text_colorbutton_color_set(self, widget): def on_account_text_colorbutton_color_set(self, widget):
"""Take The Color For The Account Text""" """Take The Color For The Account Text"""
@ -96,6 +108,7 @@ class Preferences_window:
(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4] (hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4]
self.plugin.config['accounttextcolor'] = color_string self.plugin.config['accounttextcolor'] = color_string
self.plugin.roster.draw_roster() self.plugin.roster.draw_roster()
self.plugin.save_config()
def on_group_text_colorbutton_color_set(self, widget): def on_group_text_colorbutton_color_set(self, widget):
"""Take The Color For The Group Text""" """Take The Color For The Group Text"""
@ -104,6 +117,7 @@ class Preferences_window:
(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4] (hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4]
self.plugin.config['grouptextcolor'] = color_string self.plugin.config['grouptextcolor'] = color_string
self.plugin.roster.draw_roster() self.plugin.roster.draw_roster()
self.plugin.save_config()
def on_user_text_colorbutton_color_set(self, widget): def on_user_text_colorbutton_color_set(self, widget):
"""Take The Color For The User Text""" """Take The Color For The User Text"""
@ -112,6 +126,7 @@ class Preferences_window:
(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4] (hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4]
self.plugin.config['usertextcolor'] = color_string self.plugin.config['usertextcolor'] = color_string
self.plugin.roster.draw_roster() self.plugin.roster.draw_roster()
self.plugin.save_config()
def on_account_text_bg_colorbutton_color_set(self, widget): def on_account_text_bg_colorbutton_color_set(self, widget):
"""Take The Color For The Background Of Account Text""" """Take The Color For The Background Of Account Text"""
@ -120,6 +135,7 @@ class Preferences_window:
(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4] (hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4]
self.plugin.config['accountbgcolor'] = color_string self.plugin.config['accountbgcolor'] = color_string
self.plugin.roster.draw_roster() self.plugin.roster.draw_roster()
self.plugin.save_config()
def on_group_text_bg_colorbutton_color_set(self, widget): def on_group_text_bg_colorbutton_color_set(self, widget):
"""Take The Color For The Background Of Group Text""" """Take The Color For The Background Of Group Text"""
@ -128,6 +144,7 @@ class Preferences_window:
(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4] (hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4]
self.plugin.config['groupbgcolor'] = color_string self.plugin.config['groupbgcolor'] = color_string
self.plugin.roster.draw_roster() self.plugin.roster.draw_roster()
self.plugin.save_config()
def on_user_text_bg_colorbutton_color_set(self, widget): def on_user_text_bg_colorbutton_color_set(self, widget):
"""Take The Color For The Background Of User Text""" """Take The Color For The Background Of User Text"""
@ -136,24 +153,28 @@ class Preferences_window:
(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4] (hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4]
self.plugin.config['userbgcolor'] = color_string self.plugin.config['userbgcolor'] = color_string
self.plugin.roster.draw_roster() self.plugin.roster.draw_roster()
self.plugin.save_config()
def on_account_text_fontbutton_font_set(self, widget): def on_account_text_fontbutton_font_set(self, widget):
"""Take The Font For The User Text""" """Take The Font For The User Text"""
font_string = widget.get_font_name() font_string = widget.get_font_name()
self.plugin.config['accountfont'] = font_string self.plugin.config['accountfont'] = font_string
self.plugin.roster.draw_roster() self.plugin.roster.draw_roster()
self.plugin.save_config()
def on_group_text_fontbutton_font_set(self, widget): def on_group_text_fontbutton_font_set(self, widget):
"""Take The Font For The Group Text""" """Take The Font For The Group Text"""
font_string = widget.get_font_name() font_string = widget.get_font_name()
self.plugin.config['groupfont'] = font_string self.plugin.config['groupfont'] = font_string
self.plugin.roster.draw_roster() self.plugin.roster.draw_roster()
self.plugin.save_config()
def on_user_text_fontbutton_font_set(self, widget): def on_user_text_fontbutton_font_set(self, widget):
"""Take The Font For The User Text""" """Take The Font For The User Text"""
font_string = widget.get_font_name() font_string = widget.get_font_name()
self.plugin.config['userfont'] = font_string self.plugin.config['userfont'] = font_string
self.plugin.roster.draw_roster() self.plugin.roster.draw_roster()
self.plugin.save_config()
def on_reset_colors_and_fonts_button_clicked(self, widget): def on_reset_colors_and_fonts_button_clicked(self, widget):
defaults = self.plugin.default_config defaults = self.plugin.default_config
@ -185,6 +206,7 @@ class Preferences_window:
self.xml.get_widget('user_text_fontbutton').set_font_name(\ self.xml.get_widget('user_text_fontbutton').set_font_name(\
defaults['userfont']) defaults['userfont'])
self.plugin.roster.draw_roster() self.plugin.roster.draw_roster()
self.plugin.save_config()
def on_use_tabbed_chat_window_checkbutton_toggled(self, widget): def on_use_tabbed_chat_window_checkbutton_toggled(self, widget):
buf1 = {} buf1 = {}
@ -239,6 +261,7 @@ class Preferences_window:
# buf1[acct][jid]) # buf1[acct][jid])
# self.plugin.windows[acct]['chats'][jid].xmls[jid].\ # self.plugin.windows[acct]['chats'][jid].xmls[jid].\
# get_widget('message_textview').set_buffer(buf2[acct][jid]) # get_widget('message_textview').set_buffer(buf2[acct][jid])
self.plugin.save_config()
def update_print_time(self): def update_print_time(self):
"""Update time in Opened Chat Windows""" """Update time in Opened Chat Windows"""
@ -253,28 +276,35 @@ class Preferences_window:
if widget.get_active(): if widget.get_active():
self.plugin.config['print_time'] = 'never' self.plugin.config['print_time'] = 'never'
self.update_print_time() self.update_print_time()
self.plugin.save_config()
def on_time_sometimes_radiobutton_toggled(self, widget): def on_time_sometimes_radiobutton_toggled(self, widget):
if widget.get_active(): if widget.get_active():
self.plugin.config['print_time'] = 'sometimes' self.plugin.config['print_time'] = 'sometimes'
self.update_print_time() self.update_print_time()
self.plugin.save_config()
def on_time_always_radiobutton_toggled(self, widget): def on_time_always_radiobutton_toggled(self, widget):
if widget.get_active(): if widget.get_active():
self.plugin.config['print_time'] = 'always' self.plugin.config['print_time'] = 'always'
self.update_print_time() self.update_print_time()
self.plugin.save_config()
def on_before_time_entry_focus_out_event(self, widget, event): def on_before_time_entry_focus_out_event(self, widget, event):
self.plugin.config['before_time'] = widget.get_text() self.plugin.config['before_time'] = widget.get_text()
self.plugin.save_config()
def on_after_time_entry_focus_out_event(self, widget, event): def on_after_time_entry_focus_out_event(self, widget, event):
self.plugin.config['after_time'] = widget.get_text() self.plugin.config['after_time'] = widget.get_text()
self.plugin.save_config()
def on_before_nickname_entry_focus_out_event(self, widget, event): def on_before_nickname_entry_focus_out_event(self, widget, event):
self.plugin.config['before_nickname'] = widget.get_text() self.plugin.config['before_nickname'] = widget.get_text()
self.plugin.save_config()
def on_after_nickname_entry_focus_out_event(self, widget, event): def on_after_nickname_entry_focus_out_event(self, widget, event):
self.plugin.config['after_nickname'] = widget.get_text() self.plugin.config['after_nickname'] = widget.get_text()
self.plugin.save_config()
def update_text_tags(self): def update_text_tags(self):
"""Update color tags in Opened Chat Windows""" """Update color tags in Opened Chat Windows"""
@ -292,6 +322,7 @@ class Preferences_window:
(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4] (hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4]
self.plugin.config['inmsgcolor'] = color_string self.plugin.config['inmsgcolor'] = color_string
self.update_text_tags() self.update_text_tags()
self.plugin.save_config()
def on_outgoing_msg_colorbutton_color_set(self, widget): def on_outgoing_msg_colorbutton_color_set(self, widget):
"""Take The Color For The Outgoing Messages""" """Take The Color For The Outgoing Messages"""
@ -300,6 +331,7 @@ class Preferences_window:
(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4] (hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4]
self.plugin.config['outmsgcolor'] = color_string self.plugin.config['outmsgcolor'] = color_string
self.update_text_tags() self.update_text_tags()
self.plugin.save_config()
def on_status_msg_colorbutton_color_set(self, widget): def on_status_msg_colorbutton_color_set(self, widget):
"""Take The Color For The Status Messages""" """Take The Color For The Status Messages"""
@ -308,6 +340,7 @@ class Preferences_window:
(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4] (hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4]
self.plugin.config['statusmsgcolor'] = color_string self.plugin.config['statusmsgcolor'] = color_string
self.update_text_tags() self.update_text_tags()
self.plugin.save_config()
def on_reset_colors_button_clicked(self, widget): def on_reset_colors_button_clicked(self, widget):
defaults = self.plugin.default_config defaults = self.plugin.default_config
@ -321,6 +354,7 @@ class Preferences_window:
self.xml.get_widget('status_msg_colorbutton').set_color(\ self.xml.get_widget('status_msg_colorbutton').set_color(\
gtk.gdk.color_parse(defaults['statusmsgcolor'])) gtk.gdk.color_parse(defaults['statusmsgcolor']))
self.update_text_tags() self.update_text_tags()
self.plugin.save_config()
def on_use_emoticons_checkbutton_toggled(self, widget): def on_use_emoticons_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'useemoticons', \ self.on_checkbutton_toggled(widget, 'useemoticons', \
@ -345,13 +379,13 @@ class Preferences_window:
def on_play_sounds_checkbutton_toggled(self, widget): def on_play_sounds_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'sounds_on',\ self.on_checkbutton_toggled(widget, 'sounds_on',\
[self.xml.get_widget('sound_player_hbox'),\ [self.xml.get_widget('soundplayer_hbox'),\
self.xml.get_widget('sounds_scrolledwindow'),\ self.xml.get_widget('sounds_scrolledwindow'),\
self.xml.get_widget('browse_sounds_hbox')]) self.xml.get_widget('browse_sounds_hbox')])
def on_soundplayer_entry_changed(self, widget): def on_soundplayer_entry_changed(self, widget):
self.plugin.config['soundplayer'] = widget.get_text() self.plugin.config['soundplayer'] = widget.get_text()
self.plugin.save_config()
def on_prompt_online_status_message_checkbutton_toggled(self, widget): def on_prompt_online_status_message_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'ask_online_status') self.on_checkbutton_toggled(widget, 'ask_online_status')
@ -371,6 +405,7 @@ class Preferences_window:
self.plugin.config['sound_' + sound_event + '_file'] = \ self.plugin.config['sound_' + sound_event + '_file'] = \
model.get_value(iter, 2) model.get_value(iter, 2)
iter = model.iter_next(iter) iter = model.iter_next(iter)
self.plugin.save_config()
def on_auto_away_checkbutton_toggled(self, widget): def on_auto_away_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'autoaway', \ self.on_checkbutton_toggled(widget, 'autoaway', \
@ -382,6 +417,7 @@ class Preferences_window:
self.plugin.sleeper = common.sleepy.Sleepy(\ self.plugin.sleeper = common.sleepy.Sleepy(\
self.plugin.config['autoawaytime']*60, \ self.plugin.config['autoawaytime']*60, \
self.plugin.config['autoxatime']*60) self.plugin.config['autoxatime']*60)
self.plugin.save_config()
def on_auto_xa_checkbutton_toggled(self, widget): def on_auto_xa_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'autoxa', \ self.on_checkbutton_toggled(widget, 'autoxa', \
@ -393,6 +429,7 @@ class Preferences_window:
self.plugin.sleeper = common.sleepy.Sleepy(\ self.plugin.sleeper = common.sleepy.Sleepy(\
self.plugin.config['autoawaytime']*60, \ self.plugin.config['autoawaytime']*60, \
self.plugin.config['autoxatime']*60) self.plugin.config['autoxatime']*60)
self.plugin.save_config()
def on_msg_treemodel_row_changed(self, model, path, iter): def on_msg_treemodel_row_changed(self, model, path, iter):
iter = model.get_iter_first() iter = model.get_iter_first()
@ -406,6 +443,7 @@ class Preferences_window:
del self.plugin.config['msg%i_name' % i] del self.plugin.config['msg%i_name' % i]
del self.plugin.config['msg%i' % i] del self.plugin.config['msg%i' % i]
i += 1 i += 1
self.plugin.save_config()
def on_msg_treemodel_row_deleted(self, model, path, iter): def on_msg_treemodel_row_deleted(self, model, path, iter):
iter = model.get_iter_first() iter = model.get_iter_first()
@ -419,6 +457,7 @@ class Preferences_window:
del self.plugin.config['msg%i_name' % i] del self.plugin.config['msg%i_name' % i]
del self.plugin.config['msg%i' % i] del self.plugin.config['msg%i' % i]
i += 1 i += 1
self.plugin.save_config()
def on_links_open_with_combobox_changed(self, widget): def on_links_open_with_combobox_changed(self, widget):
if widget.get_active() == 2: if widget.get_active() == 2:
@ -430,12 +469,15 @@ class Preferences_window:
if widget.get_active() == 1: if widget.get_active() == 1:
self.plugin.config['openwith'] = 'kfmclient exec' self.plugin.config['openwith'] = 'kfmclient exec'
self.xml.get_widget('custom_apps_frame').set_sensitive(False) self.xml.get_widget('custom_apps_frame').set_sensitive(False)
self.plugin.save_config()
def on_custom_browser_entry_changed(self, widget): def on_custom_browser_entry_changed(self, widget):
self.plugin.config['custombrowser'] = widget.get_text() self.plugin.config['custombrowser'] = widget.get_text()
self.plugin.save_config()
def on_custom_mail_client_entry_changed(self, widget): def on_custom_mail_client_entry_changed(self, widget):
self.plugin.config['custommailapp'] = widget.get_text() self.plugin.config['custommailapp'] = widget.get_text()
self.plugin.save_config()
def on_log_in_contact_checkbutton_toggled(self, widget): def on_log_in_contact_checkbutton_toggled(self, widget):
if widget.get_active(): if widget.get_active():
@ -443,6 +485,7 @@ class Preferences_window:
else: else:
self.config_logger['lognotusr'] = 0 self.config_logger['lognotusr'] = 0
self.plugin.send('CONFIG', None, ('Logger', self.config_logger, 'GtkGui')) self.plugin.send('CONFIG', None, ('Logger', self.config_logger, 'GtkGui'))
self.plugin.save_config()
def on_log_in_extern_checkbutton_toggled(self, widget): def on_log_in_extern_checkbutton_toggled(self, widget):
if widget.get_active(): if widget.get_active():
@ -450,6 +493,7 @@ class Preferences_window:
else: else:
self.config_logger['lognotsep'] = 0 self.config_logger['lognotsep'] = 0
self.plugin.send('CONFIG', None, ('Logger', self.config_logger, 'GtkGui')) self.plugin.send('CONFIG', None, ('Logger', self.config_logger, 'GtkGui'))
self.plugin.save_config()
def on_do_not_send_os_info_checkbutton_toggled(self, widget): def on_do_not_send_os_info_checkbutton_toggled(self, widget):
if widget.get_active(): if widget.get_active():
@ -457,6 +501,7 @@ class Preferences_window:
self.plugin.config['do_not_send_os_info'] = 1 self.plugin.config['do_not_send_os_info'] = 1
else: else:
self.plugin.config['do_not_send_os_info'] = 0 self.plugin.config['do_not_send_os_info'] = 0
self.plugin.save_config()
def fill_msg_treeview(self): def fill_msg_treeview(self):
@ -590,15 +635,15 @@ class Preferences_window:
self.auto_xa_checkbutton = self.xml.get_widget('auto_xa_checkbutton') self.auto_xa_checkbutton = self.xml.get_widget('auto_xa_checkbutton')
self.auto_xa_time_spinbutton = self.xml.get_widget \ self.auto_xa_time_spinbutton = self.xml.get_widget \
('auto_xa_time_spinbutton') ('auto_xa_time_spinbutton')
self.tray_icon_checkbutton = self.xml.get_widget('tray_icon_checkbutton') self.trayicon_checkbutton = self.xml.get_widget('trayicon_checkbutton')
self.notebook = self.xml.get_widget('preferences_notebook') self.notebook = self.xml.get_widget('preferences_notebook')
#trayicon #trayicon
if self.plugin.systray_capabilities: if self.plugin.systray_capabilities:
st = self.plugin.config['trayicon'] st = self.plugin.config['trayicon']
self.tray_icon_checkbutton.set_active(st) self.trayicon_checkbutton.set_active(st)
else: else:
self.tray_icon_checkbutton.set_sensitive(False) self.trayicon_checkbutton.set_sensitive(False)
#Save position #Save position
st = self.plugin.config['saveposition'] st = self.plugin.config['saveposition']
@ -726,17 +771,19 @@ class Preferences_window:
self.xml.get_widget('ignore_events_from_unknown_contacts_checkbutton').\ self.xml.get_widget('ignore_events_from_unknown_contacts_checkbutton').\
set_active(self.plugin.config['ignore_unknown_contacts']) set_active(self.plugin.config['ignore_unknown_contacts'])
if not self.plugin.config['sounds_on']: #sounds
self.xml.get_widget('sound_player_hbox').set_sensitive(False) if self.plugin.config['sounds_on']:
self.xml.get_widget('play_sounds_checkbutton').set_active(True)
else:
self.xml.get_widget('soundplayer_hbox').set_sensitive(False)
self.xml.get_widget('sounds_scrolledwindow').set_sensitive(False) self.xml.get_widget('sounds_scrolledwindow').set_sensitive(False)
self.xml.get_widget('browse_sounds_hbox').set_sensitive(False) self.xml.get_widget('browse_sounds_hbox').set_sensitive(False)
#FIXME:
#sound player #sound player
self.xml.get_widget('soundplayer_entry').set_text(\ self.xml.get_widget('soundplayer_entry').set_text(\
self.plugin.config['soundplayer']) self.plugin.config['soundplayer'])
#sounds #sounds treeview
self.sound_tree = self.xml.get_widget('sounds_treeview') self.sound_tree = self.xml.get_widget('sounds_treeview')
model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_BOOLEAN, \ model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_BOOLEAN, \
gobject.TYPE_STRING) gobject.TYPE_STRING)
@ -762,12 +809,6 @@ class Preferences_window:
col.pack_start(renderer) col.pack_start(renderer)
col.set_attributes(renderer, text=2) col.set_attributes(renderer, text=2)
self.fill_sound_treeview() self.fill_sound_treeview()
if not os.name == 'posix':
self.xml.get_widget('soundplayer_entry').set_sensitive(False)
self.sound_tree.set_sensitive(False)
self.xml.get_widget('sounds_entry').set_sensitive(False)
self.xml.get_widget('sounds_button').set_sensitive(False)
#Autoaway #Autoaway
st = self.plugin.config['autoaway'] st = self.plugin.config['autoaway']
@ -857,13 +898,18 @@ class Account_modification_window:
def on_close_button_clicked(self, widget): def on_close_button_clicked(self, widget):
"""When Close button is clicked""" """When Close button is clicked"""
widget.get_toplevel().destroy() self.window.destroy()
def on_checkbutton_toggled(self, widget, widgets): def on_checkbutton_toggled(self, widget, widgets):
"""set or unset sensitivity of widgets when widget is toggled""" """set or unset sensitivity of widgets when widget is toggled"""
for w in widgets: for w in widgets:
w.set_sensitive(widget.get_active()) w.set_sensitive(widget.get_active())
def on_use_proxy_checkbutton_toggled(self, widget):
proxyhost_entry = self.xml.get_widget('proxyhost_entry')
proxyport_entry = self.xml.get_widget('proxyport_entry')
self.on_checkbutton_toggled(widget, [proxyhost_entry, proxyport_entry])
def init_account(self, infos): def init_account(self, infos):
"""Initialize window with defaults values""" """Initialize window with defaults values"""
if infos.has_key('accname'): if infos.has_key('accname'):
@ -882,14 +928,25 @@ class Account_modification_window:
self.xml.get_widget('resource_entry').set_text(infos['resource']) self.xml.get_widget('resource_entry').set_text(infos['resource'])
if infos.has_key('priority'): if infos.has_key('priority'):
self.xml.get_widget('priority_spinbutton').set_value(infos['priority']) self.xml.get_widget('priority_spinbutton').set_value(infos['priority'])
use_proxy = False
if infos.has_key('use_proxy'): if infos.has_key('use_proxy'):
if infos['use_proxy'] != 0:
use_proxy = True
self.xml.get_widget('use_proxy_checkbutton').\ self.xml.get_widget('use_proxy_checkbutton').\
set_active(infos['use_proxy']) set_active(infos['use_proxy'])
self.xml.get_widget('proxyhost_entry').set_sensitive(use_proxy)
self.xml.get_widget('proxyport_entry').set_sensitive(use_proxy)
if infos.has_key('proxyhost'): if infos.has_key('proxyhost'):
self.xml.get_widget('proxyhost_entry').set_text(infos['proxyhost']) self.xml.get_widget('proxyhost_entry').set_text(infos['proxyhost'])
if infos.has_key('proxyport'): if infos.has_key('proxyport'):
self.xml.get_widget('proxyport_entry').set_text(str(\ self.xml.get_widget('proxyport_entry').set_text(str(\
infos['proxyport'])) infos['proxyport']))
gpg_key_label = self.xml.get_widget('gpg_key_label') gpg_key_label = self.xml.get_widget('gpg_key_label')
if not self.plugin.config.has_key('usegpg'): if not self.plugin.config.has_key('usegpg'):
gpg_key_label.set_text('GPG is not usable on this computer') gpg_key_label.set_text('GPG is not usable on this computer')
@ -921,7 +978,7 @@ class Account_modification_window:
self.xml.get_widget('log_history_checkbutton').set_active(0) self.xml.get_widget('log_history_checkbutton').set_active(0)
def on_save_button_clicked(self, widget): def on_save_button_clicked(self, widget):
"""When save button is clicked : Save informations in config file""" """When save button is clicked: Save information in config file"""
save_password = 0 save_password = 0
if self.xml.get_widget('save_password_checkbutton').get_active(): if self.xml.get_widget('save_password_checkbutton').get_active():
save_password = 1 save_password = 1
@ -977,8 +1034,12 @@ class Account_modification_window:
except ValueError: except ValueError:
Error_dialog(_('Proxy Port must be a port number')) Error_dialog(_('Proxy Port must be a port number'))
return return
else:
Error_dialog(_('You must enter a proxy port to use proxy'))
return
if proxyhost == '': if proxyhost == '':
Error_dialog(_('You must enter a proxy host to use proxy')) Error_dialog(_('You must enter a proxy host to use proxy'))
return
(login, hostname) = jid.split('@') (login, hostname) = jid.split('@')
key_name = self.xml.get_widget('gpg_name_label').get_text() key_name = self.xml.get_widget('gpg_name_label').get_text()
@ -1045,7 +1106,7 @@ class Account_modification_window:
self.plugin.windows['accounts'].init_accounts() self.plugin.windows['accounts'].init_accounts()
#refresh roster #refresh roster
self.plugin.roster.draw_roster() self.plugin.roster.draw_roster()
widget.get_toplevel().destroy() self.window.destroy()
return return
#if it's a new account #if it's a new account
if name in self.plugin.accounts.keys(): if name in self.plugin.accounts.keys():
@ -1082,7 +1143,7 @@ class Account_modification_window:
self.plugin.windows['accounts'].init_accounts() self.plugin.windows['accounts'].init_accounts()
#refresh roster #refresh roster
self.plugin.roster.draw_roster() self.plugin.roster.draw_roster()
widget.get_toplevel().destroy() self.window.destroy()
def on_change_password_button_clicked(self, widget): def on_change_password_button_clicked(self, widget):
dialog = Change_password_dialog(self.plugin, self.account) dialog = Change_password_dialog(self.plugin, self.account)
@ -1213,6 +1274,7 @@ class Account_modification_window:
self.xml.get_widget('gpg_password_entry').set_sensitive(False) self.xml.get_widget('gpg_password_entry').set_sensitive(False)
self.xml.get_widget('password_entry').set_sensitive(False) self.xml.get_widget('password_entry').set_sensitive(False)
self.xml.get_widget('log_history_checkbutton').set_active(1) self.xml.get_widget('log_history_checkbutton').set_active(1)
#default is checked #default is checked
self.xml.get_widget('sync_with_global_status_checkbutton').set_active(1) self.xml.get_widget('sync_with_global_status_checkbutton').set_active(1)
self.xml.signal_autoconnect(self) self.xml.signal_autoconnect(self)
@ -1230,7 +1292,7 @@ class Accounts_window:
del self.plugin.windows['accounts'] del self.plugin.windows['accounts']
def on_close_button_clicked(self, widget): def on_close_button_clicked(self, widget):
widget.get_toplevel().destroy() self.window.destroy()
def init_accounts(self): def init_accounts(self):
"""initialize listStore with existing accounts""" """initialize listStore with existing accounts"""
@ -1325,7 +1387,7 @@ class Service_registration_window:
Window that appears when we want to subscribe to a service""" Window that appears when we want to subscribe to a service"""
def on_cancel_button_clicked(self, widget): def on_cancel_button_clicked(self, widget):
"""When Cancel button is clicked""" """When Cancel button is clicked"""
widget.get_toplevel().destroy() self.window.destroy()
def draw_table(self): def draw_table(self):
"""Draw the table in the window""" """Draw the table in the window"""
@ -1355,7 +1417,7 @@ class Service_registration_window:
self.plugin.roster.contacts[self.account][self.service] = [user1] self.plugin.roster.contacts[self.account][self.service] = [user1]
self.plugin.roster.add_user_to_roster(self.service, self.account) self.plugin.roster.add_user_to_roster(self.service, self.account)
self.plugin.send('REG_AGENT', self.account, self.service) self.plugin.send('REG_AGENT', self.account, self.service)
widget.get_toplevel().destroy() self.window.destroy()
def __init__(self, service, infos, plugin, account): def __init__(self, service, infos, plugin, account):
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'service_registration_window', APP) self.xml = gtk.glade.XML(GTKGUI_GLADE, 'service_registration_window', APP)
@ -1421,6 +1483,7 @@ class Add_remove_emoticons_window:
iter = model.iter_next(iter) iter = model.iter_next(iter)
self.plugin.config['emoticons'] = '\t'.join(emots) self.plugin.config['emoticons'] = '\t'.join(emots)
self.plugin.init_regexp() self.plugin.init_regexp()
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: if model[path][1] != None and len(model[path][1]) != 0:
@ -1431,7 +1494,8 @@ class Add_remove_emoticons_window:
emots.append(model.get_value(iter, 1)) emots.append(model.get_value(iter, 1))
iter = model.iter_next(iter) iter = model.iter_next(iter)
self.plugin.config['emoticons'] = '\t'.join(emots) self.plugin.config['emoticons'] = '\t'.join(emots)
self.plugin.init_regexp() self.plugin.init_regexp()
self.plugin.save_config()
def image_is_ok(self, image): def image_is_ok(self, image):
if not os.path.exists(image): if not os.path.exists(image):
@ -1563,7 +1627,7 @@ class Service_discovery_window:
def on_close_button_clicked(self, widget): def on_close_button_clicked(self, widget):
"""When Close button is clicked""" """When Close button is clicked"""
widget.get_toplevel().destroy() self.window.destroy()
def browse(self, jid): def browse(self, jid):
"""Send a request to the core to know the available services""" """Send a request to the core to know the available services"""
@ -1733,7 +1797,7 @@ class Service_discovery_window:
return return
service = model.get_value(iter, 1) service = model.get_value(iter, 1)
self.plugin.send('REG_AGENT_INFO', self.account, service) self.plugin.send('REG_AGENT_INFO', self.account, service)
widget.get_toplevel().destroy() self.window.destroy()
def on_services_treeview_cursor_changed(self, widget): def on_services_treeview_cursor_changed(self, widget):
"""When we select a row : """When we select a row :
@ -1765,6 +1829,7 @@ class Service_discovery_window:
' '.join(self.latest_addresses) ' '.join(self.latest_addresses)
self.services_treeview.get_model().clear() self.services_treeview.get_model().clear()
self.browse(server_address) self.browse(server_address)
self.plugin.save_config()
def __init__(self, plugin, account): def __init__(self, plugin, account):
if plugin.connected[account] < 2: if plugin.connected[account] < 2:

View file

@ -31,7 +31,7 @@ import version
GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade' GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade'
class vcard_information_window: class Vcard_information_window:
"""Class for user's information window""" """Class for user's information window"""
def on_user_information_window_destroy(self, widget=None): def on_user_information_window_destroy(self, widget=None):
"""close window""" """close window"""
@ -39,12 +39,12 @@ class vcard_information_window:
def on_vcard_information_window_key_press_event(self, widget, event): def on_vcard_information_window_key_press_event(self, widget, event):
if event.keyval == gtk.keysyms.Escape: # ESCAPE if event.keyval == gtk.keysyms.Escape: # ESCAPE
widget.destroy() self.window.destroy()
def on_close_button_clicked(self, widget): def on_close_button_clicked(self, widget):
"""Save user's informations and update the roster on the Jabber server""" """Save user's informations and update the roster on the Jabber server"""
if self.vcard: if self.vcard:
widget.get_toplevel().destroy() self.window.destroy()
return return
#update user.name if it's not "" #update user.name if it's not ""
name_entry = self.xml.get_widget('nickname_entry') name_entry = self.xml.get_widget('nickname_entry')
@ -73,7 +73,7 @@ class vcard_information_window:
self.plugin.accounts[self.account] = account_info self.plugin.accounts[self.account] = account_info
self.plugin.send('CONFIG', None, ('accounts', self.plugin.accounts, \ self.plugin.send('CONFIG', None, ('accounts', self.plugin.accounts, \
'Gtkgui')) 'Gtkgui'))
widget.get_toplevel().destroy() self.window.destroy()
def set_value(self, entry_name, value): def set_value(self, entry_name, value):
try: try:
@ -115,13 +115,13 @@ class vcard_information_window:
resources = self.user.resource + ' (' + str(self.user.priority) + ')' resources = self.user.resource + ' (' + str(self.user.priority) + ')'
if not self.user.status: if not self.user.status:
self.user.status = '' self.user.status = ''
stats = self.user.show + ' : ' + self.user.status stats = self.user.show + ': ' + self.user.status
for u in self.plugin.roster.contacts[self.account][self.user.jid]: for u in self.plugin.roster.contacts[self.account][self.user.jid]:
if u.resource != self.user.resource: if u.resource != self.user.resource:
resources += '\n' + u.resource + ' (' + str(u.priority) + ')' resources += '\n' + u.resource + ' (' + str(u.priority) + ')'
if not u.status: if not u.status:
u.status = '' u.status = ''
stats += '\n' + u.show + ' : ' + u.status stats += '\n' + u.show + ': ' + u.status
self.xml.get_widget('resource_label').set_text(resources) self.xml.get_widget('resource_label').set_text(resources)
self.xml.get_widget('status_label').set_text(stats) self.xml.get_widget('status_label').set_text(stats)
self.plugin.send('ASK_VCARD', self.account, self.user.jid) self.plugin.send('ASK_VCARD', self.account, self.user.jid)
@ -490,7 +490,7 @@ class Add_new_contact_window:
def on_cancel_button_clicked(self, widget): def on_cancel_button_clicked(self, widget):
"""When Cancel button is clicked""" """When Cancel button is clicked"""
widget.get_toplevel().destroy() self.window.destroy()
def on_subscribe_button_clicked(self, widget): def on_subscribe_button_clicked(self, widget):
"""When Subscribe button is clicked""" """When Subscribe button is clicked"""
@ -510,7 +510,7 @@ class Add_new_contact_window:
nickname) nickname)
if self.xml.get_widget('auto_authorize_checkbutton').get_active(): if self.xml.get_widget('auto_authorize_checkbutton').get_active():
self.plugin.send('AUTH', self.account, jid) self.plugin.send('AUTH', self.account, jid)
widget.get_toplevel().destroy() self.window.destroy()
def fill_jid(self): def fill_jid(self):
protocol_combobox = self.xml.get_widget('protocol_combobox') protocol_combobox = self.xml.get_widget('protocol_combobox')
@ -633,6 +633,7 @@ class Error_dialog:
class subscription_request_window: class subscription_request_window:
def __init__(self, plugin, jid, text, account): def __init__(self, plugin, jid, text, account):
xml = gtk.glade.XML(GTKGUI_GLADE, 'subscription_request_window', APP) xml = gtk.glade.XML(GTKGUI_GLADE, 'subscription_request_window', APP)
self.window = xml.get_widget('subscription_request_window')
self.plugin = plugin self.plugin = plugin
self.jid = jid self.jid = jid
self.account = account self.account = account
@ -646,19 +647,19 @@ class subscription_request_window:
window that appears when a user wants to add us to his/her roster""" window that appears when a user wants to add us to his/her roster"""
def on_close_button_clicked(self, widget): def on_close_button_clicked(self, widget):
"""When Close button is clicked""" """When Close button is clicked"""
widget.get_toplevel().destroy() self.window.destroy()
def on_authorize_button_clicked(self, widget): def on_authorize_button_clicked(self, widget):
"""Accept the request""" """Accept the request"""
self.plugin.send('AUTH', self.account, self.jid) self.plugin.send('AUTH', self.account, self.jid)
widget.get_toplevel().destroy() self.window.destroy()
if not self.plugin.roster.contacts[self.account].has_key(self.jid): if not self.plugin.roster.contacts[self.account].has_key(self.jid):
Add_new_contact_window(self.plugin, self.account, self.jid) Add_new_contact_window(self.plugin, self.account, self.jid)
def on_deny_button_clicked(self, widget): def on_deny_button_clicked(self, widget):
"""refuse the request""" """refuse the request"""
self.plugin.send('DENY', self.account, self.jid) self.plugin.send('DENY', self.account, self.jid)
widget.get_toplevel().destroy() self.window.destroy()
class Join_groupchat_window: class Join_groupchat_window:
def __init__(self, plugin, account, server='', room = ''): def __init__(self, plugin, account, server='', room = ''):
@ -705,7 +706,7 @@ class Join_groupchat_window:
def on_cancel_button_clicked(self, widget): def on_cancel_button_clicked(self, widget):
"""When Cancel button is clicked""" """When Cancel button is clicked"""
widget.get_toplevel().destroy() self.window.destroy()
def on_join_button_clicked(self, widget): def on_join_button_clicked(self, widget):
"""When Join button is clicked""" """When Join button is clicked"""
@ -725,7 +726,7 @@ class Join_groupchat_window:
self.plugin.send('GC_JOIN', self.account, (nickname, room, server, \ self.plugin.send('GC_JOIN', self.account, (nickname, room, server, \
password)) password))
widget.get_toplevel().destroy() self.window.destroy()
class New_message_dialog: class New_message_dialog:
def __init__(self, plugin, account): def __init__(self, plugin, account):
@ -755,7 +756,7 @@ class New_message_dialog:
def on_cancel_button_clicked(self, widget): def on_cancel_button_clicked(self, widget):
"""When Cancel button is clicked""" """When Cancel button is clicked"""
widget.get_toplevel().destroy() self.window.destroy()
def on_chat_button_clicked(self, widget): def on_chat_button_clicked(self, widget):
"""When Chat button is clicked""" """When Chat button is clicked"""
@ -763,6 +764,7 @@ class New_message_dialog:
if jid.find('@') == -1: # if no @ was given if jid.find('@') == -1: # if no @ was given
Error_dialog(_('User ID is not valid')) Error_dialog(_('User ID is not valid'))
return return
self.window.destroy()
# use User class, new_chat expects it that way # use User class, new_chat expects it that way
# is it in the roster? # is it in the roster?
if self.plugin.roster.contacts[self.account].has_key(jid): if self.plugin.roster.contacts[self.account].has_key(jid):
@ -778,8 +780,6 @@ class New_message_dialog:
self.plugin.windows[self.account]['chats'][jid].active_tab(jid) self.plugin.windows[self.account]['chats'][jid].active_tab(jid)
self.plugin.windows[self.account]['chats'][jid].window.present() self.plugin.windows[self.account]['chats'][jid].window.present()
#FIXME: PROBLEM WITH FOCUS #FIXME: PROBLEM WITH FOCUS
widget.get_toplevel().destroy()
class Change_password_dialog: class Change_password_dialog:
def __init__(self, plugin, account): def __init__(self, plugin, account):
@ -817,8 +817,10 @@ class Change_password_dialog:
return message return message
class Popup_window: class Popup_window:
def __init__(self, plugin, event_type, event_desc): def __init__(self, plugin, event_type, jid, account):
self.plugin = plugin self.plugin = plugin
self.account = account
self.jid = jid
xml = gtk.glade.XML(GTKGUI_GLADE, 'popup_window', APP) xml = gtk.glade.XML(GTKGUI_GLADE, 'popup_window', APP)
self.window = xml.get_widget('popup_window') self.window = xml.get_widget('popup_window')
@ -828,7 +830,13 @@ class Popup_window:
eventbox = xml.get_widget('eventbox') eventbox = xml.get_widget('eventbox')
event_type_label.set_markup('<b>'+event_type+'</b>') event_type_label.set_markup('<b>'+event_type+'</b>')
event_description_label.set_text(event_desc)
if self.jid in self.plugin.roster.contacts[account]:
txt = self.plugin.roster.contacts[account][self.jid][0].name
else:
txt = self.jid
event_description_label.set_text(txt)
# set colors [ http://www.w3schools.com/html/html_colornames.asp ] # set colors [ http://www.w3schools.com/html/html_colornames.asp ]
self.window.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('black')) self.window.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('black'))
@ -841,28 +849,27 @@ class Popup_window:
elif event_type == 'New Message': elif event_type == 'New Message':
close_button.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('dodgerblue')) close_button.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('dodgerblue'))
eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('dodgerblue')) eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('dodgerblue'))
txt = 'From ' + txt
# position the window to bottom-right of screen # position the window to bottom-right of screen
window_width, window_height = self.window.get_size() window_width, self.window_height = self.window.get_size()
self.plugin.roster.popups_height += window_height self.plugin.roster.popups_height += self.window_height
self.window.move(gtk.gdk.screen_width() - window_width, \ self.window.move(gtk.gdk.screen_width() - window_width, \
gtk.gdk.screen_height() - self.plugin.roster.popups_height) gtk.gdk.screen_height() - self.plugin.roster.popups_height)
xml.signal_autoconnect(self) xml.signal_autoconnect(self)
close_button.connect('clicked', self.on_close_button_clicked, window_height)
self.window.show_all() self.window.show_all()
gobject.timeout_add(5000, self.on_timeout)
gobject.timeout_add(5000, self.on_timeout, window_height) def on_close_button_clicked(self, widget):
self.adjust_height_and_move_popup_windows()
def on_close_button_clicked(self, widget, window_height): def on_timeout(self):
self.adjust_height_and_move_popup_windows(window_height) self.adjust_height_and_move_popup_windows()
def on_timeout(self, window_height):
self.adjust_height_and_move_popup_windows(window_height)
def adjust_height_and_move_popup_windows(self, window_height): def adjust_height_and_move_popup_windows(self):
#remove #remove
self.plugin.roster.popups_height -= window_height self.plugin.roster.popups_height -= self.window_height
self.window.destroy() self.window.destroy()
if len(self.plugin.roster.popup_windows) > 0: if len(self.plugin.roster.popup_windows) > 0:
@ -878,4 +885,17 @@ class Popup_window:
gtk.gdk.screen_height() - self.plugin.roster.popups_height) gtk.gdk.screen_height() - self.plugin.roster.popups_height)
def on_popup_window_button_press_event(self, widget, event): def on_popup_window_button_press_event(self, widget, event):
print 'IN YOUR DREAMS ONLY..' # use User class, new_chat expects it that way
# is it in the roster?
if self.plugin.roster.contacts[self.account].has_key(self.jid):
user = self.plugin.roster.contacts[self.account][self.jid][0]
else:
user = gtkgui.User(self.jid, self.jid, ['not in the roster'], \
'not in the roster', 'not in the roster', 'none', None, '', 0, '')
self.plugin.roster.contacts[self.account][self.jid] = [user]
self.plugin.roster.add_user_to_roster(user.self.jid, self.account)
self.plugin.roster.new_chat(user, self.account)
self.plugin.windows[self.account]['chats'][self.jid].active_tab(self.jid)
self.plugin.windows[self.account]['chats'][self.jid].window.present()
self.adjust_height_and_move_popup_windows()

View file

@ -45,6 +45,7 @@ class Groupchat_window(Chat):
self.subjects = {} self.subjects = {}
self.new_group(room_jid, nick) self.new_group(room_jid, nick)
self.show_title() self.show_title()
print "self.xml.get_widget('message_textview') is", self.xml.get_widget('message_textview'), "!!"
self.xml.signal_connect('on_groupchat_window_destroy', \ self.xml.signal_connect('on_groupchat_window_destroy', \
self.on_groupchat_window_destroy) self.on_groupchat_window_destroy)
self.xml.signal_connect('on_groupchat_window_delete_event', \ self.xml.signal_connect('on_groupchat_window_delete_event', \
@ -240,9 +241,12 @@ class Groupchat_window(Chat):
and printed in the conversation. Tab does autocompete in nickames""" and printed in the conversation. Tab does autocompete in nickames"""
jid = self.get_active_jid() jid = self.get_active_jid()
conversation_textview = self.xmls[jid].get_widget('conversation_textview') conversation_textview = self.xmls[jid].get_widget('conversation_textview')
if event.keyval == gtk.keysyms.Tab and \ if event.hardware_keycode == 23: # TAB
(event.state & gtk.gdk.CONTROL_MASK): # CTRL + TAB if (event.state & gtk.gdk.CONTROL_MASK) and \
self.notebook.emit('key_press_event', event) (event.state & gtk.gdk.SHIFT_MASK): # CTRL + SHIFT + TAB
self.notebook.emit('key_press_event', event)
elif event.state & gtk.gdk.CONTROL_MASK: # CTRL + TAB
self.notebook.emit('key_press_event', event)
elif event.keyval == gtk.keysyms.Page_Down: # PAGE DOWN elif event.keyval == gtk.keysyms.Page_Down: # PAGE DOWN
if event.state & gtk.gdk.CONTROL_MASK: # CTRL + PAGE DOWN if event.state & gtk.gdk.CONTROL_MASK: # CTRL + PAGE DOWN
self.notebook.emit('key_press_event', event) self.notebook.emit('key_press_event', event)
@ -256,7 +260,7 @@ class Groupchat_window(Chat):
elif event.keyval == gtk.keysyms.Return or \ elif event.keyval == gtk.keysyms.Return or \
event.keyval == gtk.keysyms.KP_Enter: # ENTER event.keyval == gtk.keysyms.KP_Enter: # ENTER
if (event.state & gtk.gdk.SHIFT_MASK): if (event.state & gtk.gdk.SHIFT_MASK):
return 0 return False
message_buffer = widget.get_buffer() message_buffer = widget.get_buffer()
start_iter = message_buffer.get_start_iter() start_iter = message_buffer.get_start_iter()
end_iter = message_buffer.get_end_iter() end_iter = message_buffer.get_end_iter()
@ -266,7 +270,7 @@ class Groupchat_window(Chat):
self.plugin.send('GC_MSG', self.account, (room_jid, txt)) self.plugin.send('GC_MSG', self.account, (room_jid, txt))
message_buffer.set_text('', -1) message_buffer.set_text('', -1)
widget.grab_focus() widget.grab_focus()
return 1 return True
elif event.keyval == gtk.keysyms.Tab: # TAB elif event.keyval == gtk.keysyms.Tab: # TAB
room_jid = self.get_active_jid() room_jid = self.get_active_jid()
list_nick = self.get_nick_list(room_jid) list_nick = self.get_nick_list(room_jid)
@ -276,18 +280,18 @@ class Groupchat_window(Chat):
end_iter = message_buffer.get_iter_at_mark(cursor_position) end_iter = message_buffer.get_iter_at_mark(cursor_position)
text = message_buffer.get_text(start_iter, end_iter, 0) text = message_buffer.get_text(start_iter, end_iter, 0)
if not text: if not text:
return 0 return False
splited_text = text.split() splitted_text = text.split()
begin = splited_text[-1] begin = splitted_text[-1] # begining of the latest word we typed
for nick in list_nick: for nick in list_nick:
if nick.find(begin) == 0: if nick.find(begin) == 0: # the word is the begining of a nick
if len(splited_text) == 1: if len(splitted_text) == 1: # This is the 1st word of the line ?
add = ': ' add = ': '
else: else:
add = ' ' add = ' '
message_buffer.insert_at_cursor(nick[len(begin):] + add) message_buffer.insert_at_cursor(nick[len(begin):] + add)
return 1 return True
return 0 return False
def print_conversation(self, text, room_jid, contact = '', tim = None): def print_conversation(self, text, room_jid, contact = '', tim = None):
"""Print a line in the conversation : """Print a line in the conversation :
@ -371,8 +375,10 @@ class Groupchat_window(Chat):
"""Call vcard_information_window class to display user's information""" """Call vcard_information_window class to display user's information"""
if not self.plugin.windows[self.account]['infos'].has_key(jid): if not self.plugin.windows[self.account]['infos'].has_key(jid):
self.plugin.windows[self.account]['infos'][jid] = \ self.plugin.windows[self.account]['infos'][jid] = \
vcard_information_window(jid, self.plugin, self.account, True) Vcard_information_window(jid, self.plugin, self.account, True)
self.plugin.send('ASK_VCARD', self.account, jid) self.plugin.send('ASK_VCARD', self.account, jid)
#FIXME: maybe use roster.on_info above?
#FIXME: we need the resource but it's not saved #FIXME: we need the resource but it's not saved
#self.plugin.send('ASK_OS_INFO', self.account, jid, resource) #self.plugin.send('ASK_OS_INFO', self.account, jid, resource)

File diff suppressed because it is too large Load diff

View file

@ -64,6 +64,11 @@ import Queue
import sre import sre
import common.sleepy import common.sleepy
try:
import winsound # windows-only built-in module for playing wav
except ImportError:
pass
class CellRendererImage(gtk.GenericCellRenderer): class CellRendererImage(gtk.GenericCellRenderer):
__gproperties__ = { __gproperties__ = {
@ -273,24 +278,25 @@ class plugin:
def play_timeout(self, pid): def play_timeout(self, pid):
pidp, r = os.waitpid(pid, os.WNOHANG) pidp, r = os.waitpid(pid, os.WNOHANG)
return 0 return 0
def play_sound(self, event): def play_sound(self, event):
if os.name != 'posix': if not self.config['sounds_on']:
return return
if self.config['soundplayer'] == '': path_to_soundfile = self.config[event + '_file']
if not os.path.exists(path_to_soundfile):
return return
if not self.config[event]: if os.name == 'nt':
return winsound.PlaySound(path_to_soundfile, \
file = self.config[event + '_file'] winsound.SND_FILENAME|winsound.SND_ASYNC)
if not os.path.exists(file): elif os.name == 'posix':
return if self.config['soundplayer'] == '':
argv = self.config['soundplayer'].split() return
argv.append(file) argv = self.config['soundplayer'].split()
pid = os.spawnvp(os.P_NOWAIT, argv[0], argv) argv.append(path_to_soundfile)
pidp, r = os.waitpid(pid, os.WNOHANG) pid = os.spawnvp(os.P_NOWAIT, argv[0], argv)
if pidp == 0: pidp, r = os.waitpid(pid, os.WNOHANG)
gobject.timeout_add(10000, self.play_timeout, pid) if pidp == 0:
gobject.timeout_add(10000, self.play_timeout, pid)
def send(self, event, account, data): def send(self, event, account, data):
self.queueOUT.put((event, account, data)) self.queueOUT.put((event, account, data))
@ -334,6 +340,7 @@ class plugin:
# role, affiliation, real_jid, reason, actor, statusCode)) # role, affiliation, real_jid, reason, actor, statusCode))
statuss = ['offline', 'error', 'online', 'chat', 'away', 'xa', 'dnd', 'invisible'] statuss = ['offline', 'error', 'online', 'chat', 'away', 'xa', 'dnd', 'invisible']
old_show = 0 old_show = 0
new_show = statuss.index(array[1])
jid = array[0].split('/')[0] jid = array[0].split('/')[0]
keyID = array[5] keyID = array[5]
resource = array[3] resource = array[3]
@ -370,18 +377,23 @@ class plugin:
user1.priority, user1.keyID) user1.priority, user1.keyID)
luser.append(user1) luser.append(user1)
user1.resource = resource user1.resource = resource
if old_show == 0 and statuss.index(array[1]) > 1: if user1.jid.find('@') > 0: # It's not an agent
if not user1.jid in self.roster.newly_added[account]: if old_show == 0 and new_show > 1:
self.roster.newly_added[account].append(user1.jid) if not user1.jid in self.roster.newly_added[account]:
if user1.jid in self.roster.to_be_removed[account]: self.roster.newly_added[account].append(user1.jid)
self.roster.to_be_removed[account].remove(user1.jid) if user1.jid in self.roster.to_be_removed[account]:
gobject.timeout_add(5000, self.roster.remove_newly_added, user1.jid, account) self.roster.to_be_removed[account].remove(user1.jid)
if old_show > 1 and statuss.index(array[1]) == 0 and self.connected[account] > 1: gobject.timeout_add(5000, self.roster.remove_newly_added, \
if not user1.jid in self.roster.to_be_removed[account]: user1.jid, account)
self.roster.to_be_removed[account].append(user1.jid) if old_show > 1 and new_show == 0 and self.connected[account] > 1:
if user1.jid in self.roster.newly_added[account]: if not user1.jid in self.roster.to_be_removed[account]:
self.roster.newly_added[account].remove(user1.jid) self.roster.to_be_removed[account].append(user1.jid)
gobject.timeout_add(5000, self.roster.really_remove_user, user1, account) if user1.jid in self.roster.newly_added[account]:
self.roster.newly_added[account].remove(user1.jid)
self.roster.redraw_jid(user1.jid, account)
if not self.queues[account].has_key(jid):
gobject.timeout_add(5000, self.roster.really_remove_user, \
user1, account)
user1.show = array[1] user1.show = array[1]
user1.status = array[2] user1.status = array[2]
user1.priority = priority user1.priority = priority
@ -395,21 +407,29 @@ class plugin:
#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 statuss.index(user1.show) > 1 and \ if old_show < 2 and new_show > 1 and \
self.config['sound_contact_connected']: self.config['sound_contact_connected']:
self.play_sound('sound_contact_connected') self.play_sound('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 self.queues[account].has_key(jid) and \
not self.config['autopopup']: not self.config['autopopup']:
instance = Popup_window(self, 'Contact Online', jid ) #FIXME:
#DOES NOT ALWAYS WORK WHY?
#I control nkour@lagaule in jabber
# have nkour@lagaul in nkour@jabber.org
#go online from psi in lagaule
#gajim doesn't give a shit
# WHY? same with offline
# new message works
instance = Popup_window(self, 'Contact Online', jid, account)
self.roster.popup_windows.append(instance) self.roster.popup_windows.append(instance)
elif old_show > 1 and statuss.index(user1.show) < 2 and \ elif old_show > 1 and new_show < 2 and \
self.config['sound_contact_disconnected']: self.config['sound_contact_disconnected']:
self.play_sound('sound_contact_disconnected') self.play_sound('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 self.queues[account].has_key(jid) and \
not self.config['autopopup']: not self.config['autopopup']:
instance = Popup_window(self, 'Contact Offline', jid ) instance = Popup_window(self, 'Contact Offline', jid, account)
self.roster.popup_windows.append(instance) self.roster.popup_windows.append(instance)
elif self.windows[account]['gc'].has_key(ji): elif self.windows[account]['gc'].has_key(ji):
@ -432,7 +452,7 @@ class plugin:
not self.queues[account].has_key(jid): not self.queues[account].has_key(jid):
first = True first = True
if not self.config['autopopup']: if not self.config['autopopup']:
instance = Popup_window(self, 'New Message', 'From '+ jid ) instance = 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 self.config['sound_first_message_received'] and first: if self.config['sound_first_message_received'] and first:
@ -450,7 +470,8 @@ class plugin:
def handle_event_msgsent(self, account, array): def handle_event_msgsent(self, account, array):
#('MSG', account, (jid, msg, keyID)) #('MSG', account, (jid, msg, keyID))
self.play_sound('sound_message_sent') if self.config['sound_message_sent']:
self.play_sound('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))
@ -536,7 +557,12 @@ class plugin:
self.roster.draw_roster() self.roster.draw_roster()
def handle_event_quit(self, p1, p2): def handle_event_quit(self, p1, p2):
self.roster.on_quit() self.roster.on_quit() # SUCH FUNCTION DOES NOT EXIST!!
def save_config(self):
hidden_lines = self.config['hiddenlines'].split('\t')
self.config['hiddenlines'] = '\t'.join(hidden_lines)
self.send('CONFIG', None, ('GtkGui', self.config, 'GtkGui'))
def handle_event_myvcard(self, account, array): def handle_event_myvcard(self, account, array):
nick = '' nick = ''
@ -927,7 +953,7 @@ class plugin:
#2:autoaway and use sleeper #2:autoaway and use sleeper
#3:autoxa and use sleeper #3:autoxa and use sleeper
self.send('ASK_ROSTER', a, self.queueIN) self.send('ASK_ROSTER', a, self.queueIN)
#in pygtk2.4 FIXME: (nk) WHAT DO YOU MEAN?
iconset = self.config['iconset'] iconset = self.config['iconset']
if not iconset: if not iconset:
iconset = 'sun' iconset = 'sun'

View file

@ -204,7 +204,9 @@ class Roster_window:
prio = u.priority prio = u.priority
user = u user = u
for iter in iters: for iter in iters:
if self.plugin.queues[account].has_key(jid): if jid.find("@") <= 0: # It's an agent
img = self.pixbufs[user.show]
elif self.plugin.queues[account].has_key(jid):
img = self.pixbufs['message'] img = self.pixbufs['message']
else: else:
if user.sub != 'both': if user.sub != 'both':
@ -392,9 +394,11 @@ class Roster_window:
def on_info(self, widget, user, account): def on_info(self, widget, user, account):
"""Call vcard_information_window class to display user's information""" """Call vcard_information_window class to display user's information"""
if not self.plugin.windows[account]['infos'].has_key(user.jid): if self.plugin.windows[account]['infos'].has_key(user.jid):
self.plugin.windows[account]['infos'][user.jid].window.present()
else:
self.plugin.windows[account]['infos'][user.jid] = \ self.plugin.windows[account]['infos'][user.jid] = \
vcard_information_window(user, self.plugin, account) Vcard_information_window(user, self.plugin, account)
def on_agent_logging(self, widget, jid, state, account): def on_agent_logging(self, widget, jid, state, account):
"""When an agent is requested to log in or off""" """When an agent is requested to log in or off"""
@ -921,8 +925,6 @@ class Roster_window:
def on_about_menuitem_activate(self, widget): def on_about_menuitem_activate(self, widget):
About_dialog() About_dialog()
#inst = Popup_window(self.plugin, 'Fake Message', 'nkour@')
#self.popup_windows.append( inst )
def on_accounts_menuitem_activate(self, widget): def on_accounts_menuitem_activate(self, widget):
if self.plugin.windows.has_key('accounts'): if self.plugin.windows.has_key('accounts'):
@ -969,8 +971,7 @@ class Roster_window:
self.plugin.config['width'], self.plugin.config['height'] = \ self.plugin.config['width'], self.plugin.config['height'] = \
self.window.get_size() self.window.get_size()
self.plugin.config['hiddenlines'] = '\t'.join(self.hidden_lines) self.plugin.save_config()
self.plugin.send('CONFIG', None, ('GtkGui', self.plugin.config, 'GtkGui'))
self.plugin.send('QUIT', None, ('gtkgui', 1)) self.plugin.send('QUIT', None, ('gtkgui', 1))
print _("plugin gtkgui stopped") print _("plugin gtkgui stopped")
self.close_all(self.plugin.windows) self.close_all(self.plugin.windows)

View file

@ -150,14 +150,17 @@ class Tabbed_chat_window(Chat):
self.print_time_timeout, user.jid) self.print_time_timeout, user.jid)
def on_message_textview_key_press_event(self, widget, event): def on_message_textview_key_press_event(self, widget, event):
"""When a key is pressed : """When a key is pressed:
if enter is pressed without the shit key, message (if not empty) is sent if enter is pressed without the shit key, message (if not empty) is sent
and printed in the conversation""" and printed in the conversation"""
jid = self.get_active_jid() jid = self.get_active_jid()
conversation_textview = self.xmls[jid].get_widget('conversation_textview') conversation_textview = self.xmls[jid].get_widget('conversation_textview')
if event.keyval == gtk.keysyms.Tab and \ if event.hardware_keycode == 23: # TAB
(event.state & gtk.gdk.CONTROL_MASK): # CTRL + TAB if (event.state & gtk.gdk.CONTROL_MASK) and \
self.notebook.emit('key_press_event', event) (event.state & gtk.gdk.SHIFT_MASK): # CTRL + SHIFT + TAB
self.notebook.emit('key_press_event', event)
elif event.state & gtk.gdk.CONTROL_MASK: # CTRL + TAB
self.notebook.emit('key_press_event', event)
elif event.keyval == gtk.keysyms.Page_Down: # PAGE DOWN elif event.keyval == gtk.keysyms.Page_Down: # PAGE DOWN
if event.state & gtk.gdk.CONTROL_MASK: # CTRL + PAGE DOWN if event.state & gtk.gdk.CONTROL_MASK: # CTRL + PAGE DOWN
self.notebook.emit('key_press_event', event) self.notebook.emit('key_press_event', event)
@ -212,7 +215,7 @@ class Tabbed_chat_window(Chat):
if (user.show == 'offline' or user.show == 'error') and \ if (user.show == 'offline' or user.show == 'error') and \
not showOffline: not showOffline:
if len(self.plugin.roster.contacts[self.account][jid]) == 1: if len(self.plugin.roster.contacts[self.account][jid]) == 1:
self.plugin.roster.remove_user(user, self.account) self.plugin.roster.really_remove_user(user, self.account)
def print_conversation(self, text, jid, contact = '', tim = None): def print_conversation(self, text, jid, contact = '', tim = None):
"""Print a line in the conversation : """Print a line in the conversation :