From 2816f2dc2cdcf9ae44f4f857af8a93228827ef28 Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Sat, 2 Apr 2005 19:52:00 +0000 Subject: [PATCH] user can change [] <> --- plugins/gtkgui/chat.py | 12 +- plugins/gtkgui/config.py | 50 ++- plugins/gtkgui/gtkgui.glade | 869 +++++++++++++++++++++++------------- plugins/gtkgui/gtkgui.py | 7 +- 4 files changed, 610 insertions(+), 328 deletions(-) diff --git a/plugins/gtkgui/chat.py b/plugins/gtkgui/chat.py index 38aee7577..e3e9311ab 100644 --- a/plugins/gtkgui/chat.py +++ b/plugins/gtkgui/chat.py @@ -559,7 +559,10 @@ class Chat: if self.plugin.config['print_time'] == 'always': if not tim: tim = time.localtime() - tim_format = time.strftime("[%H:%M:%S]", tim) + self.before_time_symbols = self.plugin.config['before_time'] + self.after_time_symbols = self.plugin.config['after_time'] + format = self.before_time_symbols + '%H:%M:%S' + self.after_time_symbols + tim_format = time.strftime(format, tim) conversation_buffer.insert(end_iter, tim_format + ' ') if kind == 'status': @@ -574,8 +577,11 @@ class Chat: tags = other_tags_for_name[:] #create a new list tags.append(kind) if name and not print_all_special: - self.print_with_tag_list(conversation_buffer, '<' + name + '> ', \ - end_iter, tags) + self.before_nickname_symbols = self.plugin.config['before_nickname'] + self.after_nickname_symbols = self.plugin.config['after_nickname'] + format = self.before_nickname_symbols + name\ + + self.after_nickname_symbols + ' ' + self.print_with_tag_list(conversation_buffer, format, end_iter, tags) text += '\n' # detect urls formatting and if the user has it on emoticons diff --git a/plugins/gtkgui/config.py b/plugins/gtkgui/config.py index aa905dca4..d9169c2fd 100644 --- a/plugins/gtkgui/config.py +++ b/plugins/gtkgui/config.py @@ -47,6 +47,18 @@ class Preferences_window: def on_preferences_window_show(self, widget): self.notebook.set_current_page(0) + def on_before_time_entry_focus_out_event(self, widget, event): + self.plugin.config['before_time'] = widget.get_text() + + def on_after_time_entry_focus_out_event(self, widget, event): + self.plugin.config['after_time'] = widget.get_text() + + def on_before_nickname_entry_focus_out_event(self, widget, event): + self.plugin.config['before_nickname'] = widget.get_text() + + def on_after_nickname_entry_focus_out_event(self, widget, event): + self.plugin.config['after_nickname'] = widget.get_text() + def on_tray_icon_checkbutton_toggled(self, widget): if widget.get_active(): self.plugin.config['trayicon'] = 1 @@ -230,7 +242,7 @@ class Preferences_window: # get_widget('message_textview').set_buffer(buf2[acct][jid]) def update_text_tags(self): - """Update Opened Chat Windows""" + """Update color tags in Opened Chat Windows""" for a in self.plugin.accounts.keys(): if self.plugin.windows[a]['chats'].has_key('tabbed'): self.plugin.windows[a]['chats']['tabbed'].update_tags() @@ -239,7 +251,7 @@ class Preferences_window: self.plugin.windows[a]['chats'][jid].update_tags() def update_print_time(self): - """Update Opened Chat Windows""" + """Update time in Opened Chat Windows""" for a in self.plugin.accounts.keys(): if self.plugin.windows[a]['chats'].has_key('tabbed'): self.plugin.windows[a]['chats']['tabbed'].update_print_time() @@ -690,7 +702,7 @@ class Preferences_window: model.set_value(iter, 1, 1) def __init__(self, plugin): - """Initialize Preference window""" + """Initialize Preferences window""" self.xml = gtk.glade.XML(GTKGUI_GLADE, 'preferences_window', APP) self.window = self.xml.get_widget('preferences_window') self.plugin = plugin @@ -784,6 +796,30 @@ class Preferences_window: #use tabbed chat window st = self.plugin.config['usetabbedchat'] self.xml.get_widget('use_tabbed_chat_window_checkbutton').set_active(st) + + #Print time + if self.plugin.config['print_time'] == 'never': + self.xml.get_widget('time_never_radiobutton').set_active(1) + elif self.plugin.config['print_time'] == 'sometimes': + self.xml.get_widget('time_sometimes_radiobutton').set_active(1) + else: + self.xml.get_widget('time_always_radiobutton').set_active(1) + + #before time + st = self.plugin.config['before_time'] + self.xml.get_widget('before_time_entry').set_text(st) + + #after time + st = self.plugin.config['after_time'] + self.xml.get_widget('after_time_entry').set_text(st) + + #before nickname + st = self.plugin.config['before_nickname'] + self.xml.get_widget('before_nickname_entry').set_text(st) + + #after nickanme + st = self.plugin.config['after_nickname'] + self.xml.get_widget('after_nickname_entry').set_text(st) #Color for incomming messages colSt = self.plugin.config['inmsgcolor'] @@ -799,14 +835,6 @@ class Preferences_window: colSt = self.plugin.config['statusmsgcolor'] self.xml.get_widget('status_msg_colorbutton').set_color(\ gtk.gdk.color_parse(colSt)) - - #Print time - if self.plugin.config['print_time'] == 'never': - self.xml.get_widget('time_never_radiobutton').set_active(1) - elif self.plugin.config['print_time'] == 'sometimes': - self.xml.get_widget('time_sometimes_radiobutton').set_active(1) - else: - self.xml.get_widget('time_always_radiobutton').set_active(1) #Use emoticons st = self.plugin.config['useemoticons'] diff --git a/plugins/gtkgui/gtkgui.glade b/plugins/gtkgui/gtkgui.glade index 1ed04bc79..bec843b38 100644 --- a/plugins/gtkgui/gtkgui.glade +++ b/plugins/gtkgui/gtkgui.glade @@ -1875,7 +1875,6 @@ True - False False True 0 @@ -2879,7 +2878,7 @@ 4 500 - 384 + 380 Preferences GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE @@ -3587,7 +3586,7 @@ 5 True False - 2 + 5 @@ -3610,219 +3609,46 @@ - + True - - - 0 - True - True - - - - - - True - 4 - 3 - False - 5 - 20 + 0 + 0.5 + GTK_SHADOW_ETCHED_IN - + True - Incoming message: - False - False - GTK_JUSTIFY_CENTER - True - False - 0 + 0.5 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - Outgoing message: - False - False - GTK_JUSTIFY_CENTER - True - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - Status message: - False - False - GTK_JUSTIFY_CENTER - True - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 2 - 3 - fill - - - - - - - True - True - True - True - True - False - True - - - - 1 - 2 - 0 - 1 - - - - - - - - True - True - False - True - - - - 1 - 2 - 1 - 2 - - - - - - - - True - True - False - True - - - - 1 - 2 - 2 - 3 - - - - - - - - True - True - GTK_RELIEF_NORMAL - False - + 1 + 1 + 0 + 0 + 12 + 0 - + True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 + False + 10 - + True False 2 - + True - gtk-revert-to-saved - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - Reset to default colors - True + Print time: + False False GTK_JUSTIFY_LEFT False False - 0.5 + 0 0.5 0 0 @@ -3837,58 +3663,551 @@ False + + + + True + True + Never + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + + + + + True + True + Every 5 minutes + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + + + + + True + True + On every line + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + + + 0 + False + True + + + + + + True + 2 + 4 + False + 2 + 5 + + + + True + After time: + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 2 + 3 + 0 + 1 + + + + + + + + True + After nickname: + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 2 + 3 + 1 + 2 + + + + + + + + True + Before nickname: + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + + + + + + + + True + Before time: + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + + + + + + + + 40 + True + True + True + True + 0 + + True + * + False + + + + 1 + 2 + 0 + 1 + + + + + + + + 40 + True + True + True + True + 0 + + True + * + False + + + + 1 + 2 + 1 + 2 + + + + + + + + 40 + True + True + True + True + 0 + + True + * + False + + + + 3 + 4 + 1 + 2 + + + + + + + + 39 + True + True + True + True + 0 + + True + * + False + + + + 3 + 4 + 0 + 1 + + + + + + + 0 + False + True + + + + + + True + 4 + 3 + False + 5 + 20 + + + + True + Incoming message: + False + False + GTK_JUSTIFY_CENTER + True + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + Outgoing message: + False + False + GTK_JUSTIFY_CENTER + True + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + Status message: + False + False + GTK_JUSTIFY_CENTER + True + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + True + True + True + True + False + True + + + + 1 + 2 + 0 + 1 + + + + + + + + True + True + False + True + + + + 1 + 2 + 1 + 2 + + + + + + + + True + True + False + True + + + + 1 + 2 + 2 + 3 + + + + + + + + True + True + GTK_RELIEF_NORMAL + False + + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-revert-to-saved + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + Reset to default colors + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + + + + 0 + 2 + 3 + 4 + fill + + + + + + 0 + False + True + - - 0 - 2 - 3 - 4 - fill - - - - - 0 - False - True - - - - - - True - - - 0 - True - True - - - - - - True - 3 - 2 - False - 0 - 10 - + True - Print time: + <b>Format of a chat line</b> False - False + True GTK_JUSTIFY_LEFT False False - 0 + 0.5 0.5 0 0 @@ -3898,83 +4217,7 @@ 0 - 0 - 1 - 0 - 1 - fill - - - - - - - True - True - Never - True - GTK_RELIEF_NORMAL - True - False - False - True - - - - 1 - 2 - 0 - 1 - fill - - - - - - - True - True - Every 5 minutes - True - GTK_RELIEF_NORMAL - True - False - False - True - time_never_radiobutton - - - - 1 - 2 - 1 - 2 - fill - - - - - - - True - True - On every line - True - GTK_RELIEF_NORMAL - True - False - False - True - time_never_radiobutton - - - - 1 - 2 - 2 - 3 - fill - + label_item @@ -8811,7 +9054,7 @@ Custom - True + False False diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py index c9bcbff51..5af5ee2a6 100644 --- a/plugins/gtkgui/gtkgui.py +++ b/plugins/gtkgui/gtkgui.py @@ -865,7 +865,12 @@ class plugin: 'y-position': 0,\ 'width': 150,\ 'height': 400,\ - 'latest_disco_addresses': ''} + 'latest_disco_addresses': '',\ + 'before_time': '[',\ + 'after_time': ']',\ + 'before_nickname': '<',\ + 'after_nickname': '>',\ + } self.send('ASK_CONFIG', None, ('GtkGui', 'GtkGui', self.default_config)) self.config = self.wait('CONFIG') self.send('ASK_CONFIG', None, ('GtkGui', 'accounts'))