More work on chats

This commit is contained in:
Marco Pesenti Gritti 2006-06-16 16:29:51 -04:00
parent 99d26223e5
commit 0363ed5457
2 changed files with 29 additions and 23 deletions

View File

@ -17,17 +17,15 @@ import richtext
PANGO_SCALE = 1024 # Where is this defined?
class Chat(gtk.Window):
class Chat(gtk.VBox):
SERVICE_TYPE = "_olpc_chat._tcp"
SERVICE_PORT = 6100
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)
vbox.set_border_width(12)
self.set_border_width(12)
chat_vbox = gtk.VBox()
chat_vbox.set_spacing(6)
@ -46,21 +44,18 @@ class Chat(gtk.Window):
chat_vbox.pack_start(self._chat_sw)
self._chat_sw.show()
vbox.pack_start(chat_vbox)
self.pack_start(chat_vbox)
chat_vbox.show()
self._editor = ChatEditor()
toolbar = ChatToolbar(self._editor.get_buffer())
vbox.pack_start(toolbar, False)
self.pack_start(toolbar, False)
toolbar.show()
vbox.pack_start(self._editor, False)
self.pack_start(self._editor, False)
self._editor.show()
self.add(vbox)
vbox.show()
def __get_browser_shell(self):
bus = dbus.SessionBus()
proxy_obj = bus.get_object('com.redhat.Sugar.Browser', '/com/redhat/Sugar/Browser')

View File

@ -76,18 +76,12 @@ class ActivityHost(dbus.service.Object):
self._create_chat()
def _create_chat():
group_chat = GroupChat()
group_chat.set_transient_for(self.activity_container.window)
group_chat.set_decorated(False)
group_chat.set_skip_taskbar_hint(True)
def _create_chat(self):
self._group_chat = GroupChat()
self._group_chat.ref()
wm = WindowManager(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 get_group_chat(self):
return self._group_chat
def __close_button_clicked_reply_cb(self):
pass
@ -275,6 +269,18 @@ class ActivityContainer(dbus.service.Object):
wm.set_position(WindowManager.LEFT)
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):
self.window.show()
@ -287,6 +293,11 @@ class ActivityContainer(dbus.service.Object):
def set_current_activity(self, activity):
self.current_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):
#print "in notebook_tab_changed"