Make sketches work in one-to-one chat

This commit is contained in:
Marco Pesenti Gritti 2006-06-23 14:11:26 -04:00
parent a8c9f4301b
commit 92a4708244
2 changed files with 10 additions and 10 deletions

View File

@ -64,6 +64,16 @@ class Chat(gtk.VBox):
self.pack_start(self._editor, False)
self._editor.show()
self.connect("key-press-event", self.__key_press_event_cb)
def __key_press_event_cb(self, window, event):
if event.keyval == gtk.keysyms.s and \
event.state & gtk.gdk.CONTROL_MASK:
if self.get_mode() == Chat.SKETCH_MODE:
self.set_mode(Chat.TEXT_MODE)
elif self.get_mode() == Chat.TEXT_MODE:
self.set_mode(Chat.SKETCH_MODE)
def get_mode(self):
return self._mode

View File

@ -8,7 +8,6 @@ class ChatWindow(gtk.Window):
def __init__(self):
gtk.Window.__init__(self)
self._chat = None
self.connect("key-press-event", self.__key_press_event_cb)
def set_chat(self, chat):
if self._chat != None:
@ -17,12 +16,3 @@ class ChatWindow(gtk.Window):
self._chat = chat
self.add(self._chat)
self._chat.show()
def __key_press_event_cb(self, window, event):
if event.keyval == gtk.keysyms.s and \
event.state & gtk.gdk.CONTROL_MASK:
if self._chat.get_mode() == Chat.SKETCH_MODE:
self._chat.set_mode(Chat.TEXT_MODE)
elif self._chat.get_mode() == Chat.TEXT_MODE:
self._chat.set_mode(Chat.SKETCH_MODE)