Update the activity ring wedge sizes more often
(immediately before switching to the Home view, and on a timer after that)
This commit is contained in:
parent
723429fb80
commit
cf5c995585
@ -63,6 +63,11 @@ class HomeBox(hippo.CanvasBox, hippo.CanvasItem):
|
||||
devices_model.connect('device-disappeared',
|
||||
self._device_disappeared_cb)
|
||||
|
||||
self._redraw_id = None
|
||||
|
||||
def __del__(self):
|
||||
self.suspend()
|
||||
|
||||
def _add_device(self, device):
|
||||
view = deviceview.create(device)
|
||||
self.append(view, hippo.PACK_FIXED)
|
||||
@ -103,6 +108,23 @@ class HomeBox(hippo.CanvasBox, hippo.CanvasItem):
|
||||
|
||||
i += 1
|
||||
|
||||
_REDRAW_TIMEOUT = 5 * 60 * 1000 # 5 minutes
|
||||
|
||||
def resume(self):
|
||||
self._redraw_activity_ring()
|
||||
if self._redraw_id is None:
|
||||
self._redraw_id = gobject.timeout_add(self._REDRAW_TIMEOUT,
|
||||
self._redraw_activity_ring)
|
||||
|
||||
def suspend(self):
|
||||
if self._redraw_id is not None:
|
||||
gobject.source_remove(self._redraw_id)
|
||||
self._redraw_id = None
|
||||
|
||||
def _redraw_activity_ring(self):
|
||||
self._donut.emit_request_changed()
|
||||
return True
|
||||
|
||||
def has_activities(self):
|
||||
return self._donut.has_activities()
|
||||
|
||||
|
@ -64,6 +64,7 @@ class HomeWindow(gtk.Window):
|
||||
self._mesh_box = MeshBox(shell)
|
||||
self._transition_box = TransitionBox()
|
||||
|
||||
self._activate_view()
|
||||
self._canvas.set_root(self._home_box)
|
||||
|
||||
self._transition_box.connect('completed',
|
||||
@ -93,22 +94,28 @@ class HomeWindow(gtk.Window):
|
||||
if keyname == "Alt_L":
|
||||
self._home_box.release()
|
||||
|
||||
def _update_mesh_state(self):
|
||||
if self._active and self._level == ShellModel.ZOOM_MESH:
|
||||
self._mesh_box.resume()
|
||||
else:
|
||||
def _deactivate_view(self):
|
||||
if self._level == ShellModel.ZOOM_HOME:
|
||||
self._home_box.suspend()
|
||||
elif self._level == ShellModel.ZOOM_MESH:
|
||||
self._mesh_box.suspend()
|
||||
|
||||
def _activate_view(self):
|
||||
if self._level == ShellModel.ZOOM_HOME:
|
||||
self._home_box.resume()
|
||||
elif self._level == ShellModel.ZOOM_MESH:
|
||||
self._mesh_box.resume()
|
||||
|
||||
def _focus_in_cb(self, widget, event):
|
||||
self._active = True
|
||||
self._update_mesh_state()
|
||||
self._activate_view()
|
||||
|
||||
def _focus_out_cb(self, widget, event):
|
||||
self._active = False
|
||||
self._update_mesh_state()
|
||||
|
||||
self._deactivate_view()
|
||||
|
||||
def set_zoom_level(self, level):
|
||||
self._deactivate_view()
|
||||
self._level = level
|
||||
self._activate_view()
|
||||
|
||||
self._canvas.set_root(self._transition_box)
|
||||
|
||||
@ -129,7 +136,5 @@ class HomeWindow(gtk.Window):
|
||||
elif self._level == ShellModel.ZOOM_MESH:
|
||||
self._canvas.set_root(self._mesh_box)
|
||||
|
||||
self._update_mesh_state()
|
||||
|
||||
def get_home_box(self):
|
||||
return self._home_box
|
||||
|
Loading…
Reference in New Issue
Block a user