ctrl+f4 works in chat but introduces STRANGE traceback on Escape
This commit is contained in:
parent
0e589ca341
commit
7ac46289b0
|
@ -270,15 +270,18 @@ class Chat:
|
||||||
self.show_title()
|
self.show_title()
|
||||||
|
|
||||||
def on_conversation_textview_key_press_event(self, widget, event):
|
def on_conversation_textview_key_press_event(self, widget, event):
|
||||||
"""Do not black these evnts and send them to the notebook"""
|
"""Do not block these events and send them to the notebook"""
|
||||||
if event.keyval == gtk.keysyms.Tab and \
|
'''
|
||||||
(event.state & gtk.gdk.CONTROL_MASK): # CTRL + TAB
|
if event.state & (gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK):
|
||||||
|
if event.keyval == gtk.keysyms.Tab: # CTRL + SHIFT + TAB
|
||||||
self.notebook.emit('key_press_event', event)
|
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
|
if event.state & gtk.gdk.CONTROL_MASK:
|
||||||
|
if event.keyval == gtk.keysyms.Tab: # CTRL + TAB
|
||||||
self.notebook.emit('key_press_event', event)
|
self.notebook.emit('key_press_event', event)
|
||||||
elif event.keyval == gtk.keysyms.Page_Up: # PAGE UP
|
elif event.keyval == gtk.keysyms.Page_Down: # CTRL + PAGE DOWN
|
||||||
if event.state & gtk.gdk.CONTROL_MASK: # CTRL + PAGE UP
|
self.notebook.emit('key_press_event', event)
|
||||||
|
elif event.keyval == gtk.keysyms.Page_Up: # CTRL + PAGE UP
|
||||||
self.notebook.emit('key_press_event', event)
|
self.notebook.emit('key_press_event', event)
|
||||||
|
|
||||||
def on_chat_notebook_key_press_event(self, widget, event):
|
def on_chat_notebook_key_press_event(self, widget, event):
|
||||||
|
@ -286,34 +289,55 @@ class Chat:
|
||||||
jid = self.get_active_jid()
|
jid = self.get_active_jid()
|
||||||
if event.keyval == gtk.keysyms.Escape: # ESCAPE
|
if event.keyval == gtk.keysyms.Escape: # ESCAPE
|
||||||
self.remove_tab(jid)
|
self.remove_tab(jid)
|
||||||
|
elif event.keyval == gtk.keysyms.F4 and \
|
||||||
|
(event.state & gtk.gdk.CONTROL_MASK): # CTRL + F4
|
||||||
|
self.remove_tab(jid)
|
||||||
elif event.string and event.string in st \
|
elif event.string and event.string in st \
|
||||||
and (event.state & gtk.gdk.MOD1_MASK): # alt + 1,2,3..
|
and (event.state & gtk.gdk.MOD1_MASK): # alt + 1,2,3..
|
||||||
self.notebook.set_current_page(st.index(event.string))
|
self.notebook.set_current_page(st.index(event.string))
|
||||||
elif event.keyval == gtk.keysyms.Page_Down: # PAGE DOWN
|
elif event.keyval == gtk.keysyms.Page_Down:
|
||||||
if event.state & gtk.gdk.CONTROL_MASK:
|
if event.state & gtk.gdk.CONTROL_MASK: # CTRL + PAGE DOWN
|
||||||
current = self.notebook.get_current_page()
|
current = self.notebook.get_current_page()
|
||||||
if current > 0:
|
if current > 0:
|
||||||
self.notebook.set_current_page(current-1)
|
self.notebook.set_current_page(current-1)
|
||||||
elif event.state & gtk.gdk.SHIFT_MASK:
|
elif event.state & gtk.gdk.SHIFT_MASK: # SHIFT + PAGE DOWN
|
||||||
conversation_textview = self.xmls[jid].\
|
conversation_textview = self.xmls[jid].\
|
||||||
get_widget('conversation_textview')
|
get_widget('conversation_textview')
|
||||||
rect = conversation_textview.get_visible_rect()
|
rect = conversation_textview.get_visible_rect()
|
||||||
iter = conversation_textview.get_iter_at_location(rect.x,\
|
iter = conversation_textview.get_iter_at_location(rect.x,\
|
||||||
rect.y + rect.height)
|
rect.y + rect.height)
|
||||||
conversation_textview.scroll_to_iter(iter, 0.1, True, 0, 0)
|
conversation_textview.scroll_to_iter(iter, 0.1, True, 0, 0)
|
||||||
elif event.keyval == gtk.keysyms.Page_Up: # PAGE UP
|
elif event.keyval == gtk.keysyms.Page_Up:
|
||||||
if event.state & gtk.gdk.CONTROL_MASK:
|
if event.state & gtk.gdk.CONTROL_MASK: # CTRL + PAGE UP
|
||||||
current = self.notebook.get_current_page()
|
current = self.notebook.get_current_page()
|
||||||
if current < (self.notebook.get_n_pages()-1):
|
if current < (self.notebook.get_n_pages()-1):
|
||||||
self.notebook.set_current_page(current+1)
|
self.notebook.set_current_page(current+1)
|
||||||
elif event.state & gtk.gdk.SHIFT_MASK:
|
elif event.state & gtk.gdk.SHIFT_MASK: # SHIFT + PAGE UP
|
||||||
conversation_textview = self.xmls[jid].\
|
conversation_textview = self.xmls[jid].\
|
||||||
get_widget('conversation_textview')
|
get_widget('conversation_textview')
|
||||||
rect = conversation_textview.get_visible_rect()
|
rect = conversation_textview.get_visible_rect()
|
||||||
iter = conversation_textview.get_iter_at_location(rect.x, rect.y)
|
iter = conversation_textview.get_iter_at_location(rect.x, rect.y)
|
||||||
conversation_textview.scroll_to_iter(iter, 0.1, True, 0, 1)
|
conversation_textview.scroll_to_iter(iter, 0.1, True, 0, 1)
|
||||||
elif event.keyval == gtk.keysyms.Tab and \
|
# or event.keyval == gtk.keysyms.KP_Up
|
||||||
(event.state & gtk.gdk.CONTROL_MASK): # CTRL + TAB
|
'''
|
||||||
|
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'
|
||||||
|
# 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
|
||||||
current = self.notebook.get_current_page()
|
current = self.notebook.get_current_page()
|
||||||
if current < (self.notebook.get_n_pages()-1):
|
if current < (self.notebook.get_n_pages()-1):
|
||||||
self.notebook.set_current_page(current+1)
|
self.notebook.set_current_page(current+1)
|
||||||
|
@ -321,8 +345,8 @@ class Chat:
|
||||||
self.notebook.set_current_page(0)
|
self.notebook.set_current_page(0)
|
||||||
elif (event.state & gtk.gdk.CONTROL_MASK) or (event.keyval ==\
|
elif (event.state & gtk.gdk.CONTROL_MASK) or (event.keyval ==\
|
||||||
gtk.keysyms.Control_L) or (event.keyval == gtk.keysyms.Control_R):
|
gtk.keysyms.Control_L) or (event.keyval == gtk.keysyms.Control_R):
|
||||||
# we pressed a control key or ctrl+sth : we don't block the event
|
# we pressed a control key or ctrl+sth: we don't block the event
|
||||||
# in order to let ctrl+c do its work
|
# in order to let ctrl+c (copy text) and others do their default work
|
||||||
pass
|
pass
|
||||||
else: # it's a normal key press make sure message_textview has focus
|
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')
|
||||||
|
@ -375,6 +399,7 @@ class Chat:
|
||||||
iter = widget.get_iter_at_location(x, y)
|
iter = widget.get_iter_at_location(x, y)
|
||||||
tags = iter.get_tags()
|
tags = iter.get_tags()
|
||||||
if tags:
|
if tags:
|
||||||
|
print tags
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def print_time_timeout(self, jid):
|
def print_time_timeout(self, jid):
|
||||||
|
|
|
@ -5902,12 +5902,12 @@ Custom</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkTable" id="table4">
|
<widget class="GtkTable" id="table4">
|
||||||
<property name="border_width">4</property>
|
<property name="border_width">5</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="n_rows">8</property>
|
<property name="n_rows">8</property>
|
||||||
<property name="n_columns">2</property>
|
<property name="n_columns">2</property>
|
||||||
<property name="homogeneous">False</property>
|
<property name="homogeneous">False</property>
|
||||||
<property name="row_spacing">5</property>
|
<property name="row_spacing">0</property>
|
||||||
<property name="column_spacing">5</property>
|
<property name="column_spacing">5</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
|
@ -6101,34 +6101,6 @@ Custom</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkLabel" id="resource_label">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="label" translatable="yes"></property>
|
|
||||||
<property name="use_underline">False</property>
|
|
||||||
<property name="use_markup">False</property>
|
|
||||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
|
||||||
<property name="wrap">False</property>
|
|
||||||
<property name="selectable">False</property>
|
|
||||||
<property name="xalign">0</property>
|
|
||||||
<property name="yalign">0.5</property>
|
|
||||||
<property name="xpad">5</property>
|
|
||||||
<property name="ypad">5</property>
|
|
||||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
|
||||||
<property name="width_chars">-1</property>
|
|
||||||
<property name="single_line_mode">False</property>
|
|
||||||
<property name="angle">0</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">1</property>
|
|
||||||
<property name="right_attach">2</property>
|
|
||||||
<property name="top_attach">1</property>
|
|
||||||
<property name="bottom_attach">2</property>
|
|
||||||
<property name="x_options">fill</property>
|
|
||||||
<property name="y_options"></property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="label66">
|
<widget class="GtkLabel" id="label66">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -6356,6 +6328,34 @@ Custom</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="resource_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes"></property>
|
||||||
|
<property name="use_underline">False</property>
|
||||||
|
<property name="use_markup">False</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
|
<property name="wrap">False</property>
|
||||||
|
<property name="selectable">False</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">5</property>
|
||||||
|
<property name="ypad">5</property>
|
||||||
|
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||||
|
<property name="width_chars">-1</property>
|
||||||
|
<property name="single_line_mode">False</property>
|
||||||
|
<property name="angle">0</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
<property name="bottom_attach">2</property>
|
||||||
|
<property name="x_options">fill</property>
|
||||||
|
<property name="y_options"></property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="client_name_version_label">
|
<widget class="GtkLabel" id="client_name_version_label">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -6380,6 +6380,7 @@ Custom</property>
|
||||||
<property name="right_attach">2</property>
|
<property name="right_attach">2</property>
|
||||||
<property name="top_attach">5</property>
|
<property name="top_attach">5</property>
|
||||||
<property name="bottom_attach">6</property>
|
<property name="bottom_attach">6</property>
|
||||||
|
<property name="x_options">fill</property>
|
||||||
<property name="y_options"></property>
|
<property name="y_options"></property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
@ -6415,7 +6416,7 @@ Custom</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkTable" id="table11">
|
<widget class="GtkTable" id="table11">
|
||||||
<property name="border_width">4</property>
|
<property name="border_width">5</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="n_rows">6</property>
|
<property name="n_rows">6</property>
|
||||||
<property name="n_columns">2</property>
|
<property name="n_columns">2</property>
|
||||||
|
|
|
@ -150,10 +150,11 @@ class Tabbed_chat_window(Chat):
|
||||||
self.print_time_timeout, user.jid)
|
self.print_time_timeout, user.jid)
|
||||||
|
|
||||||
def on_message_textview_key_press_event(self, widget, event):
|
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
|
if enter is pressed without the shit key, message (if not empty) is sent
|
||||||
and printed in the conversation"""
|
and printed in the conversation"""
|
||||||
jid = self.get_active_jid()
|
jid = self.get_active_jid()
|
||||||
|
print 'jid', jid
|
||||||
conversation_textview = self.xmls[jid].get_widget('conversation_textview')
|
conversation_textview = self.xmls[jid].get_widget('conversation_textview')
|
||||||
if event.keyval == gtk.keysyms.Tab and \
|
if event.keyval == gtk.keysyms.Tab and \
|
||||||
(event.state & gtk.gdk.CONTROL_MASK): # CTRL + TAB
|
(event.state & gtk.gdk.CONTROL_MASK): # CTRL + TAB
|
||||||
|
|
Loading…
Reference in New Issue