Make CanvasIcon use IconBuffer. Change the API to use
a separate property for icon_name and file_name.
This commit is contained in:
+12
-12
@@ -94,33 +94,33 @@ class AccessPointView(PulsingIcon):
|
||||
if self._model.props.state == accesspointmodel.STATE_CONNECTING:
|
||||
self.props.pulse_time = 1.0
|
||||
self.props.colors = [
|
||||
[ style.Color(self._device_stroke),
|
||||
style.Color(self._device_fill) ],
|
||||
[ style.Color(self._device_stroke),
|
||||
style.Color('#e2e2e2') ]
|
||||
[ style.Color(self._device_stroke).get_svg(),
|
||||
style.Color(self._device_fill).get_svg() ],
|
||||
[ style.Color(self._device_stroke).get_svg(),
|
||||
'#e2e2e2' ]
|
||||
]
|
||||
elif self._model.props.state == accesspointmodel.STATE_CONNECTED:
|
||||
self.props.pulse_time = 2.0
|
||||
self.props.colors = [
|
||||
[ style.Color(self._device_stroke),
|
||||
style.Color(self._device_fill) ],
|
||||
[ style.Color('#ffffff'),
|
||||
style.Color(self._device_fill) ]
|
||||
[ style.Color(self._device_stroke).get_svg(),
|
||||
style.Color(self._device_fill).get_svg() ],
|
||||
[ '#ffffff',
|
||||
style.Color(self._device_fill).get_svg() ]
|
||||
]
|
||||
elif self._model.props.state == accesspointmodel.STATE_NOTCONNECTED:
|
||||
self.props.pulse_time = 0.0
|
||||
self.props.colors = [
|
||||
[ style.Color(self._device_stroke),
|
||||
style.Color(self._device_fill) ]
|
||||
[ style.Color(self._device_stroke).get_svg(),
|
||||
style.Color(self._device_fill).get_svg() ]
|
||||
]
|
||||
|
||||
|
||||
_MESH_ICON_NAME = 'theme:network-mesh'
|
||||
_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)
|
||||
self._nm_device = nm_device
|
||||
self.set_tooltip(_("Mesh Network"))
|
||||
|
||||
|
||||
@@ -20,5 +20,5 @@ from sugar import profile
|
||||
class MyIcon(CanvasIcon):
|
||||
def __init__(self, size):
|
||||
CanvasIcon.__init__(self, size=size,
|
||||
icon_name='theme:computer-xo',
|
||||
icon_name='computer-xo',
|
||||
xo_color=profile.get_color())
|
||||
|
||||
@@ -73,8 +73,8 @@ class ActivityIcon(CanvasIcon):
|
||||
self._level = self._level_max
|
||||
color = self._icon_colors[self._level]
|
||||
|
||||
CanvasIcon.__init__(self, icon_name=icon_name, xo_color=color,
|
||||
size=style.MEDIUM_ICON_SIZE, cache=True)
|
||||
CanvasIcon.__init__(self, file_name=icon_name, xo_color=color,
|
||||
size=style.MEDIUM_ICON_SIZE)
|
||||
|
||||
self._activity = activity
|
||||
self._pulse_id = 0
|
||||
@@ -119,8 +119,6 @@ class ActivityIcon(CanvasIcon):
|
||||
if self._pulse_id:
|
||||
gobject.source_remove(self._pulse_id)
|
||||
self._pulse_id = 0
|
||||
# dispose of all rendered icons from launch feedback
|
||||
self._clear_buffers()
|
||||
|
||||
def _compute_icon_colors(self):
|
||||
_LEVEL_MAX = 1.6
|
||||
|
||||
Reference in New Issue
Block a user