diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-06-18 18:44:08 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-06-18 18:44:08 (GMT) |
commit | 35538823524ee227097660ae90f1a8b688ef841e (patch) | |
tree | 493e73e1b061916941f4cc30ce9eb45d7ee2027e /sugar | |
parent | 9d7a7f80504f3154cbd61d3e8c98bbebcbce4eb4 (diff) |
Factor out window logic to ChatWindow.
Hook the sketchpad to ctrl+s combination
Diffstat (limited to 'sugar')
-rw-r--r-- | sugar/chat/ChatWindow.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/sugar/chat/ChatWindow.py b/sugar/chat/ChatWindow.py new file mode 100644 index 0000000..c7b100b --- /dev/null +++ b/sugar/chat/ChatWindow.py @@ -0,0 +1,28 @@ +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: + self._chat.set_mode(Chat.TEXT_MODE) + elif self._chat.get_mode() == Chat.TEXT_MODE: + self._chat.set_mode(Chat.SKETCH_MODE) + |