Make the mesh icon pulse when activated and activating
This commit is contained in:
parent
d5826d1934
commit
40f4c81d06
@ -111,13 +111,20 @@ class AccessPointView(PulsingIcon):
|
|||||||
color.HTMLColor(self._device_fill) ]
|
color.HTMLColor(self._device_fill) ]
|
||||||
]
|
]
|
||||||
|
|
||||||
class MeshDeviceView(CanvasIcon):
|
|
||||||
|
_MESH_ICON_NAME = 'theme:device-network-mesh'
|
||||||
|
|
||||||
|
class MeshDeviceView(PulsingIcon):
|
||||||
def __init__(self, nm_device):
|
def __init__(self, nm_device):
|
||||||
CanvasIcon.__init__(self, scale=units.MEDIUM_ICON_SCALE,
|
PulsingIcon.__init__(self, scale=units.MEDIUM_ICON_SCALE,
|
||||||
icon_name='theme:device-network-mesh')
|
icon_name=_MESH_ICON_NAME)
|
||||||
self._nm_device = nm_device
|
self._nm_device = nm_device
|
||||||
self.props.tooltip = _("Mesh Network")
|
self.props.tooltip = _("Mesh Network")
|
||||||
|
|
||||||
|
mycolor = profile.get_color()
|
||||||
|
self._device_fill = mycolor.get_fill_color()
|
||||||
|
self._device_stroke = mycolor.get_stroke_color()
|
||||||
|
|
||||||
self.connect('activated', self._activate_cb)
|
self.connect('activated', self._activate_cb)
|
||||||
|
|
||||||
self._nm_device.connect('state-changed', self._state_changed_cb)
|
self._nm_device.connect('state-changed', self._state_changed_cb)
|
||||||
@ -131,18 +138,29 @@ class MeshDeviceView(CanvasIcon):
|
|||||||
self._update_state()
|
self._update_state()
|
||||||
|
|
||||||
def _update_state(self):
|
def _update_state(self):
|
||||||
# FIXME Change icon colors once we have real icons
|
|
||||||
state = self._nm_device.get_state()
|
state = self._nm_device.get_state()
|
||||||
if state == nmclient.DEVICE_STATE_ACTIVATING:
|
if state == nmclient.DEVICE_STATE_ACTIVATING:
|
||||||
self.props.fill_color = color.ICON_FILL_INACTIVE
|
self.props.pulse_time = 0.75
|
||||||
self.props.stroke_color = color.ICON_STROKE_INACTIVE
|
self.props.colors = [
|
||||||
|
[ color.HTMLColor(self._device_stroke),
|
||||||
|
color.HTMLColor(self._device_fill) ],
|
||||||
|
[ color.HTMLColor(self._device_stroke),
|
||||||
|
color.HTMLColor('#e2e2e2') ]
|
||||||
|
]
|
||||||
elif state == nmclient.DEVICE_STATE_ACTIVATED:
|
elif state == nmclient.DEVICE_STATE_ACTIVATED:
|
||||||
mycolor = profile.get_color()
|
self.props.pulse_time = 1.5
|
||||||
self.props.fill_color = color.HTMLColor(mycolor.get_fill_color())
|
self.props.colors = [
|
||||||
self.props.stroke_color = color.HTMLColor(mycolor.get_stroke_color())
|
[ color.HTMLColor(self._device_stroke),
|
||||||
|
color.HTMLColor(self._device_fill) ],
|
||||||
|
[ color.HTMLColor('#ffffff'),
|
||||||
|
color.HTMLColor(self._device_fill) ]
|
||||||
|
]
|
||||||
elif state == nmclient.DEVICE_STATE_INACTIVE:
|
elif state == nmclient.DEVICE_STATE_INACTIVE:
|
||||||
self.props.fill_color = color.ICON_FILL_INACTIVE
|
self.props.pulse_time = 0.0
|
||||||
self.props.stroke_color = color.ICON_STROKE_INACTIVE
|
self.props.colors = [
|
||||||
|
[ color.HTMLColor(self._device_stroke),
|
||||||
|
color.HTMLColor(self._device_fill) ]
|
||||||
|
]
|
||||||
|
|
||||||
class ActivityView(SnowflakeBox):
|
class ActivityView(SnowflakeBox):
|
||||||
def __init__(self, shell, menu_shell, model):
|
def __init__(self, shell, menu_shell, model):
|
||||||
|
Loading…
Reference in New Issue
Block a user