Give up on the save/restore logic, it seem too unpredictable to be clear to the user.

Try a simpler logic where the frame state is reset when switching zoom levels.
This commit is contained in:
Marco Pesenti Gritti 2007-03-13 00:19:21 +01:00
parent 2c468110ba
commit d041eadf92
2 changed files with 3 additions and 28 deletions

View File

@ -61,8 +61,6 @@ 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
@ -84,7 +82,7 @@ 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 self.set_zoom_level(sugar.ZOOM_ACTIVITY)
else: else:
self.set_zoom_level(sugar.ZOOM_HOME) self.set_zoom_level(sugar.ZOOM_HOME)
@ -148,9 +146,6 @@ class Shell(gobject.GObject):
if len(self._hosts) == 0 and level == sugar.ZOOM_ACTIVITY: if len(self._hosts) == 0 and level == sugar.ZOOM_ACTIVITY:
return return
if self._zoom_level == sugar.ZOOM_HOME:
self._frame.restore_state()
self._zoom_level = level self._zoom_level = level
if self._zoom_level == sugar.ZOOM_ACTIVITY: if self._zoom_level == sugar.ZOOM_ACTIVITY:
@ -160,8 +155,9 @@ class Shell(gobject.GObject):
self._home_window.set_zoom_level(self._zoom_level) self._home_window.set_zoom_level(self._zoom_level)
if self._zoom_level == sugar.ZOOM_HOME: if self._zoom_level == sugar.ZOOM_HOME:
self._frame.save_state()
self._frame.show() self._frame.show()
else:
self._frame.hide()
def get_current_activity(self): def get_current_activity(self):
return self._current_host return self._current_host

View File

@ -110,11 +110,6 @@ class _KeyListener(object):
self._hide_sid = gobject.timeout_add( self._hide_sid = gobject.timeout_add(
100, self._hide_frame_timeout_cb) 100, self._hide_frame_timeout_cb)
class _FrameState(object):
def __init__(self, visible, mode):
self.visible = visible
self.mode = mode
class Frame(object): class Frame(object):
def __init__(self, shell): def __init__(self, shell):
self.mode = MODE_NONE self.mode = MODE_NONE
@ -129,7 +124,6 @@ class Frame(object):
self._current_position = 0.0 self._current_position = 0.0
self._animator = None self._animator = None
self._hover = False self._hover = False
self._saved_state = None
self._event_frame = EventFrame() self._event_frame = EventFrame()
self._event_frame.connect('enter-corner', self._enter_corner_cb) self._event_frame.connect('enter-corner', self._enter_corner_cb)
@ -155,21 +149,6 @@ 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):
self._saved_state = _FrameState(self.visible, self.mode)
def restore_state(self):
if self._saved_state == None:
return
if self._saved_state.visible:
self.show()
else:
self.hide()
self.mode = self._saved_state.mode
def hide(self, force=False): def hide(self, force=False):
if not self.visible: if not self.visible:
return return