Better layout strategy for the home. Should fix positioning
of the devices.
This commit is contained in:
parent
54ffaaa7f9
commit
2df96b9af7
@ -48,14 +48,23 @@ class HomeBox(hippo.CanvasBox, hippo.CanvasItem):
|
|||||||
|
|
||||||
shell_model = shell.get_model()
|
shell_model = shell.get_model()
|
||||||
|
|
||||||
|
top_box = hippo.CanvasBox(box_height=style.GRID_CELL_SIZE * 2.5)
|
||||||
|
self.append(top_box)
|
||||||
|
|
||||||
|
center_box = hippo.CanvasBox(yalign=hippo.ALIGNMENT_CENTER)
|
||||||
|
self.append(center_box, hippo.PACK_EXPAND)
|
||||||
|
|
||||||
|
bottom_box = hippo.CanvasBox(box_height=style.GRID_CELL_SIZE * 2.5)
|
||||||
|
self.append(bottom_box)
|
||||||
|
|
||||||
self._donut = ActivitiesDonut(shell)
|
self._donut = ActivitiesDonut(shell)
|
||||||
self.append(self._donut, hippo.PACK_FIXED)
|
center_box.append(self._donut)
|
||||||
|
|
||||||
self._my_icon = _MyIcon(shell, style.XLARGE_ICON_SIZE)
|
self._my_icon = _MyIcon(shell, style.XLARGE_ICON_SIZE)
|
||||||
self.append(self._my_icon, hippo.PACK_FIXED)
|
self.append(self._my_icon, hippo.PACK_FIXED)
|
||||||
|
|
||||||
self._devices_box = _DevicesBox(shell_model.get_devices())
|
self._devices_box = _DevicesBox(shell_model.get_devices())
|
||||||
self.append(self._devices_box, hippo.PACK_FIXED)
|
bottom_box.append(self._devices_box)
|
||||||
|
|
||||||
shell_model.connect('notify::state',
|
shell_model.connect('notify::state',
|
||||||
self._shell_state_changed_cb)
|
self._shell_state_changed_cb)
|
||||||
@ -68,18 +77,10 @@ class HomeBox(hippo.CanvasBox, hippo.CanvasItem):
|
|||||||
def do_allocate(self, width, height, origin_changed):
|
def do_allocate(self, width, height, origin_changed):
|
||||||
hippo.CanvasBox.do_allocate(self, width, height, origin_changed)
|
hippo.CanvasBox.do_allocate(self, width, height, origin_changed)
|
||||||
|
|
||||||
[donut_width, donut_height] = self._donut.get_allocation()
|
|
||||||
self.set_position(self._donut, (width - donut_width) / 2,
|
|
||||||
(height - donut_height) / 2)
|
|
||||||
|
|
||||||
[icon_width, icon_height] = self._my_icon.get_allocation()
|
[icon_width, icon_height] = self._my_icon.get_allocation()
|
||||||
self.set_position(self._my_icon, (width - icon_width) / 2,
|
self.set_position(self._my_icon, (width - icon_width) / 2,
|
||||||
(height - icon_height) / 2)
|
(height - icon_height) / 2)
|
||||||
|
|
||||||
[box_width, box_height] = self._devices_box.get_allocation()
|
|
||||||
self.set_position(self._devices_box, (width - icon_width) / 2,
|
|
||||||
height - style.GRID_CELL_SIZE * 2.5)
|
|
||||||
|
|
||||||
_REDRAW_TIMEOUT = 5 * 60 * 1000 # 5 minutes
|
_REDRAW_TIMEOUT = 5 * 60 * 1000 # 5 minutes
|
||||||
|
|
||||||
def resume(self):
|
def resume(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user