Mention ctrl+s
This commit is contained in:
parent
3553882352
commit
be051b2726
3
README
3
README
@ -42,7 +42,8 @@ Key bindings
|
||||
|
||||
ctrl+Up Toggle chat window visibility
|
||||
ctrl+Left Toggle presence window visibility
|
||||
F11 Toggle activities window fullscreen
|
||||
F11 Toggle activities window fullscreen
|
||||
ctrl+S Switch between sketch and text mode
|
||||
|
||||
Logging
|
||||
=======
|
||||
|
@ -22,6 +22,9 @@ class Chat(gtk.VBox):
|
||||
SERVICE_TYPE = "_olpc_chat._tcp"
|
||||
SERVICE_PORT = 6100
|
||||
|
||||
TEXT_MODE = 0
|
||||
SKETCH_MODE = 1
|
||||
|
||||
def __init__(self):
|
||||
gtk.VBox.__init__(self, False, 6)
|
||||
|
||||
@ -48,7 +51,8 @@ class Chat(gtk.VBox):
|
||||
self.pack_start(chat_vbox)
|
||||
chat_vbox.show()
|
||||
|
||||
self._editor = ChatEditor(self)
|
||||
self._mode = Chat.TEXT_MODE
|
||||
self._editor = ChatEditor(self, ChatEditor.TEXT_MODE)
|
||||
|
||||
toolbar = ChatToolbar(self._editor.get_buffer())
|
||||
self.pack_start(toolbar, False)
|
||||
@ -57,6 +61,16 @@ class Chat(gtk.VBox):
|
||||
self.pack_start(self._editor, False)
|
||||
self._editor.show()
|
||||
|
||||
def get_mode(self):
|
||||
return self._mode
|
||||
|
||||
def set_mode(self, mode):
|
||||
self._mode = mode
|
||||
if self._mode == Chat.TEXT_MODE:
|
||||
self._editor.set_mode(ChatEditor.TEXT_MODE)
|
||||
elif self._mode == Chat.SKETCH_MODE:
|
||||
self._editor.set_mode(ChatEditor.SKETCH_MODE)
|
||||
|
||||
def __get_browser_shell(self):
|
||||
bus = dbus.SessionBus()
|
||||
proxy_obj = bus.get_object('com.redhat.Sugar.Browser', '/com/redhat/Sugar/Browser')
|
||||
@ -202,7 +216,7 @@ class Chat(gtk.VBox):
|
||||
def send_sketch(self, svgdata):
|
||||
if not svgdata or not len(svgdata):
|
||||
return
|
||||
self._stream_writer.write(svgdata)
|
||||
self._stream_writer.write(self.serialize_message(svgdata))
|
||||
owner = PresenceService.get_instance().get_owner()
|
||||
self._insert_sketch(owner.get_nick_name(), svgdata)
|
||||
|
||||
|
@ -6,11 +6,14 @@ from sugar.chat.sketchpad.SketchPad import SketchPad
|
||||
import richtext
|
||||
|
||||
class ChatEditor(gtk.Notebook):
|
||||
def __init__(self, chat):
|
||||
TEXT_MODE = 0
|
||||
SKETCH_MODE = 1
|
||||
|
||||
def __init__(self, chat, mode):
|
||||
gtk.Notebook.__init__(self)
|
||||
|
||||
self._chat = chat
|
||||
|
||||
|
||||
self.set_show_tabs(False)
|
||||
self.set_show_border(False)
|
||||
self.set_size_request(-1, 70)
|
||||
@ -30,8 +33,15 @@ class ChatEditor(gtk.Notebook):
|
||||
self.append_page(self._sketchpad)
|
||||
self._sketchpad.show()
|
||||
|
||||
self.set_current_page(0)
|
||||
self.set_mode(mode)
|
||||
|
||||
def set_mode(self, mode):
|
||||
self._mode = mode
|
||||
if self._mode == ChatEditor.SKETCH_MODE:
|
||||
self.set_current_page(1)
|
||||
elif self._mode == ChatEditor.TEXT_MODE:
|
||||
self.set_current_page(0)
|
||||
|
||||
def get_buffer(self):
|
||||
return self._text_view.get_buffer()
|
||||
|
||||
|
@ -11,6 +11,7 @@ import gobject
|
||||
import sugar.util
|
||||
from sugar.session.LogWriter import LogWriter
|
||||
from sugar.shell.PresenceWindow import PresenceWindow
|
||||
from sugar.chat.ChatWindow import ChatWindow
|
||||
from sugar.shell.Owner import ShellOwner
|
||||
from sugar.shell.StartPage import StartPage
|
||||
from sugar.shell.WindowManager import WindowManager
|
||||
@ -307,7 +308,7 @@ class ActivityContainer(dbus.service.Object):
|
||||
wm.set_position(WindowManager.LEFT)
|
||||
wm.manage()
|
||||
|
||||
self._chat_window = gtk.Window()
|
||||
self._chat_window = ChatWindow()
|
||||
self._chat_window.set_transient_for(self.window)
|
||||
self._chat_window.set_decorated(False)
|
||||
self._chat_window.set_skip_taskbar_hint(True)
|
||||
@ -332,14 +333,9 @@ class ActivityContainer(dbus.service.Object):
|
||||
self.current_activity = activity
|
||||
self._presence_window.set_activity(activity)
|
||||
|
||||
host_chat = self._chat_window.get_child()
|
||||
if host_chat:
|
||||
self._chat_window.remove(host_chat)
|
||||
|
||||
if activity:
|
||||
host_chat = activity.get_chat()
|
||||
self._chat_window.add(host_chat)
|
||||
host_chat.show()
|
||||
self._chat_window.set_chat(host_chat)
|
||||
|
||||
# For some reason the substitution screw up window position
|
||||
self._chat_wm.update()
|
||||
|
Loading…
Reference in New Issue
Block a user