Bunch of fixes

This commit is contained in:
Marco Pesenti Gritti 2007-03-12 22:29:11 +01:00
parent bf80cb55b9
commit 3bfd94899a
3 changed files with 28 additions and 7 deletions

View File

@ -40,10 +40,13 @@ class Shell(gobject.GObject):
self._key_handler = KeyHandler(self) self._key_handler = KeyHandler(self)
self._popup_context = PopupContext() self._popup_context = PopupContext()
self._frame = Frame(self) self._frame = Frame(self)
self._frame.show()
self._home_window = HomeWindow(self) self._home_window = HomeWindow(self)
self._home_window.show() self._home_window.show()
self._zoom_level = sugar.ZOOM_HOME self._zoom_level = sugar.ZOOM_HOME
home_model = self._model.get_home() home_model = self._model.get_home()
@ -58,6 +61,8 @@ class Shell(gobject.GObject):
activity_host = ActivityHost(home_activity) activity_host = ActivityHost(home_activity)
self._hosts[activity_host.get_xid()] = activity_host self._hosts[activity_host.get_xid()] = activity_host
self._frame.hide()
def _activity_removed_cb(self, home_model, home_activity): def _activity_removed_cb(self, home_model, home_activity):
if not home_activity.get_launched(): if not home_activity.get_launched():
return return
@ -80,6 +85,8 @@ class Shell(gobject.GObject):
if self._current_host: if self._current_host:
self._current_host.set_active(True) self._current_host.set_active(True)
self._zoom_level = sugar.ZOOM_ACTIVITY
def get_model(self): def get_model(self):
return self._model return self._model
@ -135,15 +142,25 @@ class Shell(gobject.GObject):
self.set_zoom_level(sugar.ZOOM_HOME) self.set_zoom_level(sugar.ZOOM_HOME)
def set_zoom_level(self, level): def set_zoom_level(self, level):
self._zoom_level = level if self._zoom_level == level:
self._update_zoom_level() return
if len(self._hosts) == 0 and level == sugar.ZOOM_ACTIVITY:
return
def _update_zoom_level(self): if self._zoom_level == sugar.ZOOM_HOME:
if level == sugar.ZOOM_ACTIVITY: self._frame.restore_state()
self._zoom_level = level
if self._zoom_level == sugar.ZOOM_ACTIVITY:
self._screen.toggle_showing_desktop(False) self._screen.toggle_showing_desktop(False)
else: else:
self._screen.toggle_showing_desktop(True) self._screen.toggle_showing_desktop(True)
self._home_window.set_zoom_level(level) self._home_window.set_zoom_level(self._zoom_level)
if self._zoom_level == sugar.ZOOM_HOME:
self._frame.save_state()
self._frame.show()
def get_current_activity(self): def get_current_activity(self):
return self._current_host return self._current_host

View File

@ -76,7 +76,6 @@ class ActivitiesBox(hippo.CanvasBox):
self._invites.connect('invite-removed', self._invite_removed_cb) self._invites.connect('invite-removed', self._invite_removed_cb)
def _activity_clicked_cb(self, icon): def _activity_clicked_cb(self, icon):
self._shell.get_frame().hide()
self._shell.start_activity(icon.get_bundle_id()) self._shell.start_activity(icon.get_bundle_id())
def _invite_clicked_cb(self, icon): def _invite_clicked_cb(self, icon):

View File

@ -155,11 +155,16 @@ class Frame(object):
self._key_listener = _KeyListener(self) self._key_listener = _KeyListener(self)
self._mouse_listener = _MouseListener(self) self._mouse_listener = _MouseListener(self)
self.save_state()
def save_state(self): def save_state(self):
self._saved_state = _FrameState(self.visible, self.mode) self._saved_state = _FrameState(self.visible, self.mode)
def restore_state(self): def restore_state(self):
if self.saved_state.visible: if self._saved_state == None:
return
if self._saved_state.visible:
self.show() self.show()
else: else:
self.hide() self.hide()