when escape key is pressed in chat window, it is closed

This commit is contained in:
Yann Leboulanger 2005-01-06 13:01:22 +00:00
parent 43e32524d3
commit df1d8e7450
2 changed files with 7 additions and 0 deletions

View File

@ -286,6 +286,7 @@
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<signal name="destroy" handler="gtk_widget_destroy" last_modification_time="Sun, 12 Oct 2003 18:17:05 GMT"/>
<signal name="focus_in_event" handler="on_focus" last_modification_time="Fri, 11 Jun 2004 03:14:21 GMT"/>
<signal name="key_press_event" handler="on_chat_key_press_event" last_modification_time="Thu, 06 Jan 2005 12:53:45 GMT"/>
<child>
<widget class="GtkVBox" id="vbox2">

View File

@ -255,6 +255,10 @@ class message_Window:
if len(self.plugin.roster.contacts[self.account][self.user.jid]) == 1:
self.plugin.roster.remove_user(self.user, self.account)
def on_chat_key_press_event(self, widget, event):
if event.keyval == gtk.keysyms.Escape:
widget.get_toplevel().destroy()
def on_msg_key_press_event(self, widget, event):
"""When a key is pressed :
if enter is pressed without the shit key, message (if not empty) is sent
@ -328,6 +332,8 @@ class message_Window:
self.xml.signal_connect('on_history_clicked', self.on_history)
self.xml.signal_connect('on_msg_key_press_event', \
self.on_msg_key_press_event)
self.xml.signal_connect('on_chat_key_press_event', \
self.on_chat_key_press_event)
self.tagIn = buffer.create_tag("incoming")
color = self.plugin.config['inmsgcolor']
self.tagIn.set_property("foreground", color)