2006-06-18 20:44:08 +02:00
|
|
|
import pygtk
|
|
|
|
pygtk.require('2.0')
|
|
|
|
import gtk
|
|
|
|
|
|
|
|
from sugar.chat.Chat import Chat
|
|
|
|
|
|
|
|
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:
|
|
|
|
self.remove(self._chat)
|
|
|
|
|
|
|
|
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:
|
2006-06-20 15:39:36 +02:00
|
|
|
self._chat.set_mode(Chat.TEXT_MODE)
|
2006-06-18 20:44:08 +02:00
|
|
|
elif self._chat.get_mode() == Chat.TEXT_MODE:
|
2006-06-20 15:39:36 +02:00
|
|
|
self._chat.set_mode(Chat.SKETCH_MODE)
|
2006-06-18 20:44:08 +02:00
|
|
|
|