added Ctrl+Shift+Tab in GC. GC needs to give focus to message textview on on showing, and after switching tabs [it need some code from tabbedchat]

This commit is contained in:
Nikos Kouremenos 2005-04-09 00:11:05 +00:00
parent b71e2de1ba
commit b357978f49
3 changed files with 20 additions and 15 deletions

View File

@ -45,6 +45,7 @@ class Groupchat_window(Chat):
self.subjects = {}
self.new_group(room_jid, nick)
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.on_groupchat_window_destroy)
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"""
jid = self.get_active_jid()
conversation_textview = self.xmls[jid].get_widget('conversation_textview')
if event.keyval == gtk.keysyms.Tab and \
(event.state & gtk.gdk.CONTROL_MASK): # CTRL + TAB
self.notebook.emit('key_press_event', event)
if event.hardware_keycode == 23: # TAB
if (event.state & gtk.gdk.CONTROL_MASK) and \
(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
if event.state & gtk.gdk.CONTROL_MASK: # CTRL + PAGE DOWN
self.notebook.emit('key_press_event', event)
@ -256,7 +260,7 @@ class Groupchat_window(Chat):
elif event.keyval == gtk.keysyms.Return or \
event.keyval == gtk.keysyms.KP_Enter: # ENTER
if (event.state & gtk.gdk.SHIFT_MASK):
return 0
return False
message_buffer = widget.get_buffer()
start_iter = message_buffer.get_start_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))
message_buffer.set_text('', -1)
widget.grab_focus()
return 1
return True
elif event.keyval == gtk.keysyms.Tab: # TAB
room_jid = self.get_active_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)
text = message_buffer.get_text(start_iter, end_iter, 0)
if not text:
return 0
splited_text = text.split()
begin = splited_text[-1]
return False
splitted_text = text.split()
begin = splitted_text[-1] #how is this the begin? This is the end! NO?
for nick in list_nick:
if nick.find(begin) == 0:
if len(splited_text) == 1:
if nick.find(begin) != -1:
if len(splitted_text) == 1:
add = ': '
else:
add = ' '
message_buffer.insert_at_cursor(nick[len(begin):] + add)
return 1
return 0
return True
return False
def print_conversation(self, text, room_jid, contact = '', tim = None):
"""Print a line in the conversation :

View File

@ -7862,6 +7862,7 @@ Custom</property>
<child>
<widget class="GtkScrolledWindow" id="conversation_scrolledwindow">
<property name="width_request">200</property>
<property name="visible">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
@ -7891,7 +7892,7 @@ Custom</property>
</child>
</widget>
<packing>
<property name="shrink">True</property>
<property name="shrink">False</property>
<property name="resize">True</property>
</packing>
</child>
@ -7918,7 +7919,7 @@ Custom</property>
<property name="has_focus">True</property>
<property name="editable">True</property>
<property name="overwrite">False</property>
<property name="accepts_tab">True</property>
<property name="accepts_tab">False</property>
<property name="justification">GTK_JUSTIFY_LEFT</property>
<property name="wrap_mode">GTK_WRAP_WORD</property>
<property name="cursor_visible">True</property>

View File

@ -157,7 +157,7 @@ class Tabbed_chat_window(Chat):
conversation_textview = self.xmls[jid].get_widget('conversation_textview')
if event.hardware_keycode == 23: # TAB
if (event.state & gtk.gdk.CONTROL_MASK) and \
(event.state & gtk.gdk.SHIFT_MASK): # CTRL + TAB
(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)