More work on chats
This commit is contained in:
parent
99d26223e5
commit
0363ed5457
@ -17,17 +17,15 @@ import richtext
|
|||||||
|
|
||||||
PANGO_SCALE = 1024 # Where is this defined?
|
PANGO_SCALE = 1024 # Where is this defined?
|
||||||
|
|
||||||
class Chat(gtk.Window):
|
class Chat(gtk.VBox):
|
||||||
SERVICE_TYPE = "_olpc_chat._tcp"
|
SERVICE_TYPE = "_olpc_chat._tcp"
|
||||||
SERVICE_PORT = 6100
|
SERVICE_PORT = 6100
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
gtk.Window.__init__(self, gtk.WINDOW_POPUP)
|
gtk.VBox.__init__(self, False, 6)
|
||||||
|
|
||||||
self._stream_writer = None
|
|
||||||
|
|
||||||
vbox = gtk.VBox(False, 6)
|
self._stream_writer = None
|
||||||
vbox.set_border_width(12)
|
self.set_border_width(12)
|
||||||
|
|
||||||
chat_vbox = gtk.VBox()
|
chat_vbox = gtk.VBox()
|
||||||
chat_vbox.set_spacing(6)
|
chat_vbox.set_spacing(6)
|
||||||
@ -46,21 +44,18 @@ class Chat(gtk.Window):
|
|||||||
chat_vbox.pack_start(self._chat_sw)
|
chat_vbox.pack_start(self._chat_sw)
|
||||||
self._chat_sw.show()
|
self._chat_sw.show()
|
||||||
|
|
||||||
vbox.pack_start(chat_vbox)
|
self.pack_start(chat_vbox)
|
||||||
chat_vbox.show()
|
chat_vbox.show()
|
||||||
|
|
||||||
self._editor = ChatEditor()
|
self._editor = ChatEditor()
|
||||||
|
|
||||||
toolbar = ChatToolbar(self._editor.get_buffer())
|
toolbar = ChatToolbar(self._editor.get_buffer())
|
||||||
vbox.pack_start(toolbar, False)
|
self.pack_start(toolbar, False)
|
||||||
toolbar.show()
|
toolbar.show()
|
||||||
|
|
||||||
vbox.pack_start(self._editor, False)
|
self.pack_start(self._editor, False)
|
||||||
self._editor.show()
|
self._editor.show()
|
||||||
|
|
||||||
self.add(vbox)
|
|
||||||
vbox.show()
|
|
||||||
|
|
||||||
def __get_browser_shell(self):
|
def __get_browser_shell(self):
|
||||||
bus = dbus.SessionBus()
|
bus = dbus.SessionBus()
|
||||||
proxy_obj = bus.get_object('com.redhat.Sugar.Browser', '/com/redhat/Sugar/Browser')
|
proxy_obj = bus.get_object('com.redhat.Sugar.Browser', '/com/redhat/Sugar/Browser')
|
||||||
|
@ -76,18 +76,12 @@ class ActivityHost(dbus.service.Object):
|
|||||||
|
|
||||||
self._create_chat()
|
self._create_chat()
|
||||||
|
|
||||||
def _create_chat():
|
def _create_chat(self):
|
||||||
group_chat = GroupChat()
|
self._group_chat = GroupChat()
|
||||||
group_chat.set_transient_for(self.activity_container.window)
|
self._group_chat.ref()
|
||||||
group_chat.set_decorated(False)
|
|
||||||
group_chat.set_skip_taskbar_hint(True)
|
|
||||||
|
|
||||||
wm = WindowManager(group_chat)
|
def get_group_chat(self):
|
||||||
|
return self._group_chat
|
||||||
wm.set_width(0.5, WindowManager.SCREEN_RELATIVE)
|
|
||||||
wm.set_height(0.5, WindowManager.SCREEN_RELATIVE)
|
|
||||||
wm.set_position(WindowManager.TOP)
|
|
||||||
wm.manage()
|
|
||||||
|
|
||||||
def __close_button_clicked_reply_cb(self):
|
def __close_button_clicked_reply_cb(self):
|
||||||
pass
|
pass
|
||||||
@ -274,6 +268,18 @@ class ActivityContainer(dbus.service.Object):
|
|||||||
wm.set_height(1.0, WindowManager.SCREEN_RELATIVE)
|
wm.set_height(1.0, WindowManager.SCREEN_RELATIVE)
|
||||||
wm.set_position(WindowManager.LEFT)
|
wm.set_position(WindowManager.LEFT)
|
||||||
wm.manage()
|
wm.manage()
|
||||||
|
|
||||||
|
self._chat_window = gtk.Window(gtk.WINDOW_POPUP)
|
||||||
|
self._chat_window.set_transient_for(self.window)
|
||||||
|
self._chat_window.set_decorated(False)
|
||||||
|
self._chat_window.set_skip_taskbar_hint(True)
|
||||||
|
|
||||||
|
wm = WindowManager(self._chat_window)
|
||||||
|
|
||||||
|
wm.set_width(0.5, WindowManager.SCREEN_RELATIVE)
|
||||||
|
wm.set_height(0.5, WindowManager.SCREEN_RELATIVE)
|
||||||
|
wm.set_position(WindowManager.TOP)
|
||||||
|
wm.manage()
|
||||||
|
|
||||||
def show(self):
|
def show(self):
|
||||||
self.window.show()
|
self.window.show()
|
||||||
@ -287,6 +293,11 @@ class ActivityContainer(dbus.service.Object):
|
|||||||
def set_current_activity(self, activity):
|
def set_current_activity(self, activity):
|
||||||
self.current_activity = activity
|
self.current_activity = activity
|
||||||
self._presence_window.set_activity(activity)
|
self._presence_window.set_activity(activity)
|
||||||
|
self._chat_window.remove(self._chat_window.get_child())
|
||||||
|
|
||||||
|
host_chat = activity.get_chat()
|
||||||
|
self._chat_window.add()
|
||||||
|
host_chat.show()
|
||||||
|
|
||||||
def notebook_tab_changed(self, notebook, page, page_number):
|
def notebook_tab_changed(self, notebook, page, page_number):
|
||||||
#print "in notebook_tab_changed"
|
#print "in notebook_tab_changed"
|
||||||
|
Loading…
Reference in New Issue
Block a user