From b1c89d4a6a2ac7436c0f5e59c55d6ca448776e26 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Fri, 8 Apr 2005 21:51:09 +0000 Subject: [PATCH] Ctrl+Shift+Tab now works --- plugins/gtkgui/chat.py | 29 +++++++++++++--------------- plugins/gtkgui/tabbed_chat_window.py | 10 ++++++---- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/plugins/gtkgui/chat.py b/plugins/gtkgui/chat.py index d4d086058..e20fadb44 100644 --- a/plugins/gtkgui/chat.py +++ b/plugins/gtkgui/chat.py @@ -271,12 +271,11 @@ class Chat: def on_conversation_textview_key_press_event(self, widget, event): """Do not block these events and send them to the notebook""" - ''' - if event.state & (gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK): - if event.keyval == gtk.keysyms.Tab: # CTRL + SHIFT + TAB + if (event.state & gtk.gdk.CONTROL_MASK) and \ + (event.state & gtk.gdk.SHIFT_MASK): + if event.hardware_keycode == 23: # CTRL + SHIFT + TAB self.notebook.emit('key_press_event', event) - ''' - if event.state & gtk.gdk.CONTROL_MASK: + elif event.state & gtk.gdk.CONTROL_MASK: if event.keyval == gtk.keysyms.Tab: # CTRL + TAB self.notebook.emit('key_press_event', event) elif event.keyval == gtk.keysyms.Page_Down: # CTRL + PAGE DOWN @@ -319,25 +318,23 @@ class Chat: iter = conversation_textview.get_iter_at_location(rect.x, rect.y) conversation_textview.scroll_to_iter(iter, 0.1, True, 0, 1) # or event.keyval == gtk.keysyms.KP_Up - ''' elif event.keyval == gtk.keysyms.Up: if event.state & gtk.gdk.SHIFT_MASK: # SHIFT + UP print 'be' # FIXME: find a way to to keyUP in scrolledwindow - conversation_scrolledwindow = self.xml.get_widget('conversation_scrolledwindow') - conversation_scrolledwindow.emit('scroll-child', gtk.SCROLL_PAGE_BACKWARD, False) - ''' - if event.keyval == gtk.keysyms.Tab: - ''' - if event.state & (gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK): - print '^shift+tab' + conversation_scrolledwindow = self.xml.get_widget\ + ('conversation_scrolledwindow') + conversation_scrolledwindow.emit('scroll-child', \ + gtk.SCROLL_PAGE_BACKWARD, False) + elif event.hardware_keycode == 23: # TAB + if (event.state & gtk.gdk.CONTROL_MASK) and \ + (event.state & gtk.gdk.SHIFT_MASK): # CTRL + SHIFT + TAB current = self.notebook.get_current_page() if current > 0: self.notebook.set_current_page(current-1) else: - self.notebook.set_current_page(0) - ''' - if event.state & gtk.gdk.CONTROL_MASK: # CTRL + TAB + self.notebook.set_current_page(self.notebook.get_n_pages()-1) + elif event.state & gtk.gdk.CONTROL_MASK: # CTRL + TAB current = self.notebook.get_current_page() if current < (self.notebook.get_n_pages()-1): self.notebook.set_current_page(current+1) diff --git a/plugins/gtkgui/tabbed_chat_window.py b/plugins/gtkgui/tabbed_chat_window.py index b9477b4c9..043f50c30 100644 --- a/plugins/gtkgui/tabbed_chat_window.py +++ b/plugins/gtkgui/tabbed_chat_window.py @@ -154,11 +154,13 @@ class Tabbed_chat_window(Chat): if enter is pressed without the shit key, message (if not empty) is sent and printed in the conversation""" jid = self.get_active_jid() - print 'jid', 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 + 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)