From 3b4a2f748a0b9fbd403243401b0649233ab49032 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Thu, 10 Mar 2005 23:21:30 +0000 Subject: [PATCH] force the infos = {} when we call Account_modificaion_window print special words in status messages --- plugins/gtkgui/config.py | 4 ++-- plugins/gtkgui/gtkgui.py | 29 ++++++++++++++++++++++------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/plugins/gtkgui/config.py b/plugins/gtkgui/config.py index 40da5a836..a96b41a21 100644 --- a/plugins/gtkgui/config.py +++ b/plugins/gtkgui/config.py @@ -1274,7 +1274,7 @@ class Account_modification_window: password_entry.set_text('') #infos must be a dictionnary - def __init__(self, plugin, infos = {}): + def __init__(self, plugin, infos): self.xml = gtk.glade.XML(GTKGUI_GLADE, 'account_modification_window', APP) self.window = self.xml.get_widget('account_modification_window') self.plugin = plugin @@ -1327,7 +1327,7 @@ class Accounts_window: """When new button is clicked : open an account information window""" if not self.plugin.windows.has_key('account_modification_window'): self.plugin.windows['account_modification_window'] = \ - Account_modification_window(self.plugin) + Account_modification_window(self.plugin, {}) def on_delete_button_clicked(self, widget): """When delete button is clicked : diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py index 29b15416c..8ed2343d4 100644 --- a/plugins/gtkgui/gtkgui.py +++ b/plugins/gtkgui/gtkgui.py @@ -692,7 +692,7 @@ class tabbed_chat_window: #we launch the correct application self.plugin.launch_browser_mailer(kind, word) - def print_special_text(self, text, jid, contact = ''): + def print_special_text(self, text, jid, contact): conversation_textview = self.xmls[jid].get_widget('conversation_textview') conversation_buffer = conversation_textview.get_buffer() @@ -734,7 +734,11 @@ class tabbed_chat_window: print tag end_iter = conversation_buffer.get_end_iter() - conversation_buffer.insert_with_tags_by_name(end_iter, text, tag) + if tag in ['bold', 'italic', 'underline'] and contact == 'status': + conversation_buffer.insert_with_tags_by_name(end_iter, text,\ + 'status', tag) + else: + conversation_buffer.insert_with_tags_by_name(end_iter, text, tag) def print_conversation(self, text, jid, contact = '', tim = None): """Print a line in the conversation : @@ -772,8 +776,11 @@ class tabbed_chat_window: else: ttext = '<' + name + '> ' otext = text + '\n' - - conversation_buffer.insert_with_tags_by_name(end_iter, ttext, tag) + #if it's a status we print special words + if tag != 'status': + conversation_buffer.insert_with_tags_by_name(end_iter, ttext, tag) + else: + otext = ttext start = 0 end = 0 @@ -791,13 +798,21 @@ class tabbed_chat_window: if start != 0: text_before_special_text = otext[index:start] end_iter = conversation_buffer.get_end_iter() - conversation_buffer.insert(end_iter, text_before_special_text) + if tag == 'status': + conversation_buffer.insert_with_tags_by_name(end_iter, \ + text_before_special_text, tag) + else: + conversation_buffer.insert(end_iter, text_before_special_text) self.print_special_text(special_text, jid, contact) index = end # update index #add the rest in the index and after end_iter = conversation_buffer.get_end_iter() - conversation_buffer.insert(end_iter, otext[index:]) + if tag == 'status': + conversation_buffer.insert_with_tags_by_name(end_iter, \ + otext[index:], tag) + else: + conversation_buffer.insert(end_iter, otext[index:]) #scroll to the end of the textview end_rect = conversation_textview.get_iter_location(end_iter) @@ -2840,7 +2855,7 @@ class roster_window: if len(self.plugin.accounts) == 0: self.plugin.windows['accounts_window'] = Accounts_window(self.plugin) self.plugin.windows['account_modification_window'] = \ - Account_modification_window(self.plugin) + Account_modification_window(self.plugin, {}) class systrayDummy: """Class when we don't want icon in the systray"""