diff --git a/sugar/shell/PresenceWindow.py b/sugar/shell/PresenceWindow.py index 29687cf4..a216073b 100644 --- a/sugar/shell/PresenceWindow.py +++ b/sugar/shell/PresenceWindow.py @@ -12,7 +12,7 @@ class PresenceWindow(gtk.Window): _MODEL_COL_VISIBLE = 3 def __init__(self, activity_container): - gtk.Window.__init__(self, gtk.WINDOW_POPUP) + gtk.Window.__init__(self) self._activity_container = activity_container self._activity = None diff --git a/sugar/shell/WindowManager.py b/sugar/shell/WindowManager.py index c4a5804d..199dacc9 100644 --- a/sugar/shell/WindowManager.py +++ b/sugar/shell/WindowManager.py @@ -15,49 +15,13 @@ class WindowManager: ABSOLUTE = 0 SCREEN_RELATIVE = 1 - VISIBLE = 0 - SLIDED_IN = 1 - HIDDEN = 2 - def __init__(self, window): self._window = window - self._visibility = WindowManager.HIDDEN WindowManager.__managers_list.append(self) window.connect("key-press-event", self.__key_press_event_cb) - window.connect("focus-in-event", self.__focus_in_event_cb) - window.connect_after("focus-out-event", self.__focus_out_event_cb) - def has_focus(self): - return self._window.has_toplevel_focus() - - def _update_visibility(self): - visible = False - - if self._visibility is WindowManager.VISIBLE: - visible = True - elif self._visibility is WindowManager.HIDDEN: - visible = False - elif self._visibility is WindowManager.SLIDED_IN: - for manager in WindowManager.__managers_list: - if manager.has_focus(): - visible = True - - if self._window.get_property('visible') != visible: - self._window.set_property('visible', visible) - - def __focus_change_idle(self): - for manager in WindowManager.__managers_list: - manager._update_visibility() - return False - - def __focus_in_event_cb(self, window, event): - gobject.idle_add(self.__focus_change_idle) - - def __focus_out_event_cb(self, window, event): - gobject.idle_add(self.__focus_change_idle) - def __key_press_event_cb(self, window, event): manager = None @@ -117,16 +81,16 @@ class WindowManager: self._window.resize(width, height) def slide_window_in(self): - self._visibility = WindowManager.SLIDED_IN - self._update_visibility() - + self._window.show() + def slide_window_out(self): - self._visibility = WindowManager.HIDDEN - self._update_visibility() - + self._window.hide() + def show(self): - self._visibility = WindowManager.VISIBLE + self._window.show() + + def update(self): + self._update_size_and_position() def manage(self): self._update_size_and_position() - self._update_visibility() diff --git a/sugar/shell/shell.py b/sugar/shell/shell.py index 630bde5c..57ca70c3 100755 --- a/sugar/shell/shell.py +++ b/sugar/shell/shell.py @@ -72,13 +72,13 @@ class ActivityHost(dbus.service.Object): self.label_hbox.show() hbox.show() - + + self._create_chat() + notebook = self.activity_container.notebook index = notebook.append_page(self.socket, hbox) notebook.set_current_page(index) - self._create_chat() - def _create_chat(self): self._group_chat = GroupChat(self) @@ -297,6 +297,8 @@ class ActivityContainer(dbus.service.Object): self._presence_window = PresenceWindow(self) self._presence_window.set_transient_for(self.window) + self._presence_window.set_decorated(False) + self._presence_window.set_skip_taskbar_hint(True) wm = WindowManager(self._presence_window) @@ -305,17 +307,17 @@ class ActivityContainer(dbus.service.Object): wm.set_position(WindowManager.LEFT) wm.manage() - self._chat_window = gtk.Window(gtk.WINDOW_POPUP) + self._chat_window = gtk.Window() 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) + self._chat_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() + self._chat_wm.set_width(0.5, WindowManager.SCREEN_RELATIVE) + self._chat_wm.set_height(0.5, WindowManager.SCREEN_RELATIVE) + self._chat_wm.set_position(WindowManager.TOP) + self._chat_wm.manage() def show(self): self.window.show() @@ -327,32 +329,30 @@ class ActivityContainer(dbus.service.Object): pass def set_current_activity(self, activity): - print 'current activity' - self.current_activity = activity self._presence_window.set_activity(activity) host_chat = self._chat_window.get_child() if host_chat: - host_chat.unparent() + self._chat_window.remove(host_chat) - host_chat = activity.get_chat() - self._chat_window.add(host_chat) - host_chat.show() + if activity: + host_chat = activity.get_chat() + self._chat_window.add(host_chat) + host_chat.show() + + # For some reason the substitution screw up window position + self._chat_wm.update() def notebook_tab_changed(self, notebook, page, page_number): - #print "in notebook_tab_changed" - #print notebook.get_nth_page(page_number) new_activity = notebook.get_nth_page(page_number).get_data("sugar-activity") - #print " Current activity: ", self.current_activity - #print " New activity: ", new_activity if self.current_activity != None: if self.has_activity(self.current_activity): self.current_activity.peer_service.lost_focus(reply_handler = self.__focus_reply_cb, error_handler = self.__focus_error_cb) - if self.has_activity(new_activity): - self.set_current_activity(new_activity) + #if self.has_activity(new_activity): + self.set_current_activity(new_activity) if self.current_activity != None: if self.has_activity(self.current_activity):