From c9d65729df4f9da7a9e1d259418914ba15bc033d Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Sat, 5 Mar 2005 19:47:49 +0000 Subject: [PATCH] some fixes --- plugins/gtkgui/gtkgui.glade | 18 +++++----------- plugins/gtkgui/gtkgui.py | 43 +++++++++++++++++++------------------ 2 files changed, 27 insertions(+), 34 deletions(-) diff --git a/plugins/gtkgui/gtkgui.glade b/plugins/gtkgui/gtkgui.glade index 4f7ec503c..b029e65f4 100644 --- a/plugins/gtkgui/gtkgui.glade +++ b/plugins/gtkgui/gtkgui.glade @@ -6833,7 +6833,6 @@ Custom - 4 True Groupchat GTK_WINDOW_TOPLEVEL @@ -6867,7 +6866,7 @@ Custom True - Subject : + Subject: False False GTK_JUSTIFY_LEFT @@ -6895,8 +6894,7 @@ Custom True * - False - + True 0 @@ -6908,6 +6906,8 @@ Custom True + True + True True Set True @@ -6931,9 +6931,7 @@ Custom - 4 True - True True True GTK_POS_TOP @@ -6978,7 +6976,6 @@ Custom True - True GTK_RELIEF_NORMAL True @@ -7012,19 +7009,16 @@ Custom True - True 225 True - True 100 True - True GTK_POLICY_NEVER GTK_POLICY_AUTOMATIC GTK_SHADOW_IN @@ -7055,7 +7049,6 @@ Custom True - True GTK_POLICY_AUTOMATIC GTK_POLICY_AUTOMATIC GTK_SHADOW_IN @@ -7064,7 +7057,6 @@ Custom True - True False False True @@ -7096,7 +7088,6 @@ Custom True - True GTK_POLICY_AUTOMATIC GTK_POLICY_AUTOMATIC GTK_SHADOW_IN @@ -7106,6 +7097,7 @@ Custom True True + True True False True diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py index ba8c947ae..344bb9b8a 100644 --- a/plugins/gtkgui/gtkgui.py +++ b/plugins/gtkgui/gtkgui.py @@ -488,8 +488,7 @@ class tabbed_chat_window: else: self.chat_notebook.set_current_page(0) 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') if not message_textview.is_focus(): message_textview.grab_focus() @@ -804,12 +803,6 @@ class Groupchat_window: def set_subject(self, room_jid, subject): self.subjects[room_jid] = subject self.xml.get_widget('subject_entry').set_text(subject) - - def on_subject_entry_key_press_event(self, widget, event): - if event.keyval == gtk.keysyms.Return: - room_jid = self.get_active_jid() - subject = widget.get_text() - self.plugin.send('GC_SUBJECT', self.account, (room_jid, subject)) def on_set_button_clicked(self, widget): room_jid = self.get_active_jid() @@ -821,10 +814,10 @@ class Groupchat_window: self.remove_tab(room_jid) 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 - and printed in the conversation""" - if event.keyval == gtk.keysyms.Return: + and printed in the conversation. Tab does autocompete in nickames""" + if event.keyval == gtk.keysyms.Return: # ENTER if (event.state & gtk.gdk.SHIFT_MASK): return 0 message_buffer = widget.get_buffer() @@ -837,7 +830,7 @@ class Groupchat_window: message_buffer.set_text('', -1) widget.grab_focus() return 1 - elif event.keyval == gtk.keysyms.Tab: + elif event.keyval == gtk.keysyms.Tab: # TAB room_jid = self.get_active_jid() list_nick = self.get_user_list(room_jid) message_buffer = widget.get_buffer() @@ -848,19 +841,19 @@ class Groupchat_window: begin = txt.split()[-1] for nick in list_nick: if nick.find(begin) == 0: - message_buffer.insert_at_cursor(nick[len(begin):] + ' ') + message_buffer.insert_at_cursor(nick[len(begin):] + ': ') return 1 return 0 def on_groupchat_window_key_press_event(self, widget, event): - st = "1234567890" + st = "1234567890" # humans count from 1, pc from 0 :P room_jid = self.get_active_jid() - if event.keyval == gtk.keysyms.Escape: + if event.keyval == gtk.keysyms.Escape: #ESCAPE self.remove_tab(room_jid) elif event.string and event.string in st \ - and (event.state & gtk.gdk.MOD1_MASK): + and (event.state & gtk.gdk.MOD1_MASK): # alt + 1,2,3 ... self.chat_notebook.set_current_page(st.index(event.string)) - elif event.keyval == gtk.keysyms.Page_Down: + elif event.keyval == gtk.keysyms.Page_Down: # PAGEDOWN if event.state & gtk.gdk.CONTROL_MASK: current = self.chat_notebook.get_current_page() if current > 0: @@ -875,7 +868,7 @@ class Groupchat_window: iter = conversation_textview.get_iter_at_location(rect.x,\ rect.y + rect.height) conversation_textview.scroll_to_iter(iter, 0.1, True, 0, 0) - elif event.keyval == gtk.keysyms.Page_Up: + elif event.keyval == gtk.keysyms.Page_Up: # PAGEUP if event.state & gtk.gdk.CONTROL_MASK: current = self.chat_notebook.get_current_page() if current < (self.chat_notebook.get_n_pages()-1): @@ -889,12 +882,21 @@ class Groupchat_window: iter = conversation_textview.get_iter_at_location(rect.x, rect.y) conversation_textview.scroll_to_iter(iter, 0.1, True, 0, 1) elif event.keyval == gtk.keysyms.Tab and \ - (event.state & gtk.gdk.CONTROL_MASK): + (event.state & gtk.gdk.CONTROL_MASK): # CTRL+TAB current = self.chat_notebook.get_current_page() if current < (self.chat_notebook.get_n_pages()-1): self.chat_notebook.set_current_page(current+1) else: self.chat_notebook.set_current_page(0) + + '''FIXME: + NOT GOOD steals focus from Subject entry and I cannot find a way to prevent this + + else: # it's a normal key press make sure message_textview has focus + message_textview = self.xmls[room_jid].get_widget('message_textview') + if not message_textview.is_focus(): + message_textview.grab_focus() + ''' def print_conversation(self, txt, room_jid, contact = None, tim = None): """Print a line in the conversation : @@ -1237,10 +1239,9 @@ class Groupchat_window: self.on_groupchat_window_key_press_event) self.xml.signal_connect('on_chat_notebook_switch_page', \ self.on_chat_notebook_switch_page) - self.xml.signal_connect('on_subject_entry_key_press_event', \ - self.on_subject_entry_key_press_event) self.xml.signal_connect('on_set_button_clicked', \ self.on_set_button_clicked) + #FIXME: (nk) WHY AUTOCONNECT segfaults? [haven't test here but looks the same] with tabbed chat window ;P class history_window: """Class for bowser agent window :