Improved icon caching logic
This commit is contained in:
@@ -38,7 +38,7 @@ class FriendsBox(hippo.CanvasBox):
|
||||
self._layout = SpreadLayout()
|
||||
self.set_layout(self._layout)
|
||||
|
||||
self._owner_icon = CanvasIcon(icon_name='computer-xo',
|
||||
self._owner_icon = CanvasIcon(icon_name='computer-xo', cache=True,
|
||||
xo_color=profile.get_color())
|
||||
self._owner_icon.props.size = style.LARGE_ICON_SIZE
|
||||
palette = Palette(profile.get_nick_name())
|
||||
|
||||
@@ -41,7 +41,7 @@ class HomeBox(hippo.CanvasBox, hippo.CanvasItem):
|
||||
def __init__(self, shell):
|
||||
hippo.CanvasBox.__init__(self, background_color=0xe2e2e2ff, yalign=2)
|
||||
|
||||
self._donut = ActivitiesDonut(shell,box_width=style.zoom(450),
|
||||
self._donut = ActivitiesDonut(shell, box_width=style.zoom(450),
|
||||
box_height=style.zoom(450))
|
||||
self.append(self._donut)
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ _ICON_NAME = 'network-wireless'
|
||||
|
||||
class AccessPointView(PulsingIcon):
|
||||
def __init__(self, model):
|
||||
PulsingIcon.__init__(self, size=style.MEDIUM_ICON_SIZE)
|
||||
PulsingIcon.__init__(self, size=style.MEDIUM_ICON_SIZE, cache=True)
|
||||
self._model = model
|
||||
|
||||
self.connect('activated', self._activate_cb)
|
||||
@@ -124,7 +124,7 @@ _MESH_ICON_NAME = 'network-mesh'
|
||||
class MeshDeviceView(PulsingIcon):
|
||||
def __init__(self, nm_device):
|
||||
PulsingIcon.__init__(self, size=style.MEDIUM_ICON_SIZE,
|
||||
icon_name=_MESH_ICON_NAME)
|
||||
icon_name=_MESH_ICON_NAME, cache=True)
|
||||
self._nm_device = nm_device
|
||||
self.set_tooltip(_("Mesh Network"))
|
||||
|
||||
@@ -180,7 +180,7 @@ class ActivityView(hippo.CanvasBox):
|
||||
self._layout = SnowflakeLayout()
|
||||
self.set_layout(self._layout)
|
||||
|
||||
self._icon = CanvasIcon(file_name=model.get_icon_name(),
|
||||
self._icon = CanvasIcon(file_name=model.get_icon_name(), cache=True,
|
||||
xo_color=model.get_color(), box_width=80)
|
||||
self._icon.connect('activated', self._clicked_cb)
|
||||
self._icon.set_tooltip(self._model.activity.props.name)
|
||||
|
||||
@@ -73,8 +73,8 @@ class ActivityIcon(CanvasIcon):
|
||||
self._level = self._level_max
|
||||
color = self._icon_colors[self._level]
|
||||
|
||||
CanvasIcon.__init__(self, file_name=icon_name, xo_color=color,
|
||||
size=style.MEDIUM_ICON_SIZE)
|
||||
CanvasIcon.__init__(self, file_name=icon_name, xo_color=color,
|
||||
size=style.MEDIUM_ICON_SIZE, cache=True)
|
||||
|
||||
self._activity = activity
|
||||
self._pulse_id = 0
|
||||
@@ -159,7 +159,6 @@ class ActivityIcon(CanvasIcon):
|
||||
if self._pulse_id:
|
||||
return
|
||||
|
||||
self.props.cache_size = self._level_max
|
||||
self._pulse_id = gobject.timeout_add(self._INTERVAL, self._pulse_cb)
|
||||
|
||||
def _stop_pulsing(self):
|
||||
@@ -168,7 +167,6 @@ class ActivityIcon(CanvasIcon):
|
||||
|
||||
self._cleanup()
|
||||
self._level = 100.0
|
||||
self.props.cache_size = 1
|
||||
self.props.xo_color = self._orig_color
|
||||
|
||||
def _resume_activate_cb(self, menuitem):
|
||||
|
||||
Reference in New Issue
Block a user