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:
parent
2c468110ba
commit
d041eadf92
@ -61,8 +61,6 @@ class Shell(gobject.GObject):
|
||||
activity_host = ActivityHost(home_activity)
|
||||
self._hosts[activity_host.get_xid()] = activity_host
|
||||
|
||||
self._frame.hide()
|
||||
|
||||
def _activity_removed_cb(self, home_model, home_activity):
|
||||
if not home_activity.get_launched():
|
||||
return
|
||||
@ -84,7 +82,7 @@ class Shell(gobject.GObject):
|
||||
|
||||
if self._current_host:
|
||||
self._current_host.set_active(True)
|
||||
self._zoom_level = sugar.ZOOM_ACTIVITY
|
||||
self.set_zoom_level(sugar.ZOOM_ACTIVITY)
|
||||
else:
|
||||
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:
|
||||
return
|
||||
|
||||
if self._zoom_level == sugar.ZOOM_HOME:
|
||||
self._frame.restore_state()
|
||||
|
||||
self._zoom_level = level
|
||||
|
||||
if self._zoom_level == sugar.ZOOM_ACTIVITY:
|
||||
@ -160,8 +155,9 @@ class Shell(gobject.GObject):
|
||||
self._home_window.set_zoom_level(self._zoom_level)
|
||||
|
||||
if self._zoom_level == sugar.ZOOM_HOME:
|
||||
self._frame.save_state()
|
||||
self._frame.show()
|
||||
else:
|
||||
self._frame.hide()
|
||||
|
||||
def get_current_activity(self):
|
||||
return self._current_host
|
||||
|
@ -110,11 +110,6 @@ class _KeyListener(object):
|
||||
self._hide_sid = gobject.timeout_add(
|
||||
100, self._hide_frame_timeout_cb)
|
||||
|
||||
class _FrameState(object):
|
||||
def __init__(self, visible, mode):
|
||||
self.visible = visible
|
||||
self.mode = mode
|
||||
|
||||
class Frame(object):
|
||||
def __init__(self, shell):
|
||||
self.mode = MODE_NONE
|
||||
@ -129,7 +124,6 @@ class Frame(object):
|
||||
self._current_position = 0.0
|
||||
self._animator = None
|
||||
self._hover = False
|
||||
self._saved_state = None
|
||||
|
||||
self._event_frame = EventFrame()
|
||||
self._event_frame.connect('enter-corner', self._enter_corner_cb)
|
||||
@ -155,21 +149,6 @@ class Frame(object):
|
||||
self._key_listener = _KeyListener(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):
|
||||
if not self.visible:
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user