From decb46c2a0299cc8c28a302fd6e1e1e2b1cc4937 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sat, 25 Oct 2003 17:50:34 +0000 Subject: [PATCH] color in conversation TextView --- doc/gajimrc | 2 ++ plugins/gtkgui.py | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/doc/gajimrc b/doc/gajimrc index f9eb0e682..093dd795c 100644 --- a/doc/gajimrc +++ b/doc/gajimrc @@ -11,3 +11,5 @@ ressource = gajim [GtkGui] showoffline = 0 +inmsgcolor = red +outmsgcolor = blue diff --git a/plugins/gtkgui.py b/plugins/gtkgui.py index 2de9d0d31..b7e8097a3 100644 --- a/plugins/gtkgui.py +++ b/plugins/gtkgui.py @@ -70,9 +70,11 @@ class message: def print_conversation(self, txt, contact = None): end_iter = self.convTxtBuffer.get_end_iter() - if contact: who = 'moi' - else: who = 'lui' - self.convTxtBuffer.insert(end_iter, '<'+who+'> '+txt+'\n', -1) + if contact: + self.convTxtBuffer.insert_with_tags_by_name(end_iter, ' ', 'outgoing') + else: + self.convTxtBuffer.insert_with_tags_by_name(end_iter, ' ', 'incomming') + self.convTxtBuffer.insert(end_iter, txt+'\n') self.conversation.scroll_to_mark(\ self.convTxtBuffer.get_mark('end'), 0.1, 0, 0, 0) @@ -92,6 +94,8 @@ class message: return 0 def __init__(self, jid, roster): + self.cfgParser = common.optparser.OptionsParser(CONFPATH) + self.cfgParser.parseCfgFile() self.jid = jid self.roster = roster self.xml = gtk.glade.XML('plugins/gtkgui.glade', 'Chat') @@ -105,6 +109,14 @@ class message: self.window.show() self.xml.signal_connect('gtk_widget_destroy', self.delete_event) self.xml.signal_connect('on_msg_key_press_event', self.on_msg_key_press_event) + self.tag = self.convTxtBuffer.create_tag("incomming") + color = self.cfgParser.GtkGui_inmsgcolor + if not color : color = red + self.tag.set_property("foreground", color) + self.tag = self.convTxtBuffer.create_tag("outgoing") + color = self.cfgParser.GtkGui_outmsgcolor + if not color : color = blue + self.tag.set_property("foreground", color) class roster: def get_icon_pixbuf(self, stock):