device: use status attribute for link_encrypted
This commit is contained in:
parent
9121169f91
commit
6b3f09aa5d
|
@ -265,7 +265,7 @@ def _process_hidpp10_notification(device, status, n):
|
|||
link_established,
|
||||
bool(flags & 0x80),
|
||||
)
|
||||
status[_K.LINK_ENCRYPTED] = link_encrypted
|
||||
status.link_encrypted = link_encrypted
|
||||
status.changed(active=link_established)
|
||||
return True
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ _hidpp10 = hidpp10.Hidpp10()
|
|||
|
||||
ALERT = NamedInts(NONE=0x00, NOTIFICATION=0x01, SHOW_WINDOW=0x02, ATTENTION=0x04, ALL=0xFF)
|
||||
|
||||
KEYS = NamedInts(LINK_ENCRYPTED=5, NOTIFICATION_FLAGS=6, ERROR=7)
|
||||
KEYS = NamedInts(NOTIFICATION_FLAGS=6, ERROR=7)
|
||||
|
||||
|
||||
def attach_to(device, changed_callback):
|
||||
|
@ -87,7 +87,7 @@ class ReceiverStatus(dict):
|
|||
|
||||
class DeviceStatus(dict):
|
||||
"""Holds the 'runtime' status of a peripheral
|
||||
Currently _active, battery -- dict entries are being moved to attributs
|
||||
Currently _active, battery, link_encrypted -- dict entries are being moved to attributs
|
||||
Updates mostly come from incoming notification events from the device itself.
|
||||
"""
|
||||
|
||||
|
@ -98,6 +98,7 @@ class DeviceStatus(dict):
|
|||
self._changed_callback = changed_callback
|
||||
self._active = None # is the device active?
|
||||
self.battery = None
|
||||
self.link_encrypted = None
|
||||
|
||||
def to_string(self):
|
||||
return self.battery.to_str() if self.battery is not None else ""
|
||||
|
|
|
@ -232,7 +232,7 @@ def _pairing_succeeded(assistant, receiver, device):
|
|||
|
||||
def _check_encrypted(dev):
|
||||
if assistant.is_drawable():
|
||||
if device.status.get(_K.LINK_ENCRYPTED) is False:
|
||||
if device.status.link_encrypted is False:
|
||||
hbox.pack_start(Gtk.Image.new_from_icon_name("security-low", Gtk.IconSize.MENU), False, False, 0)
|
||||
hbox.pack_start(Gtk.Label(_("The wireless link is not encrypted") + "!"), False, False, 0)
|
||||
hbox.show_all()
|
||||
|
|
|
@ -727,12 +727,12 @@ def _update_device_panel(device, panel, buttons, full=False):
|
|||
panel._battery._text.set_markup(text)
|
||||
panel._battery.set_tooltip_text(tooltip_text)
|
||||
|
||||
if device.status.get(_K.LINK_ENCRYPTED) is None:
|
||||
if device.status.link_encrypted is None:
|
||||
panel._secure.set_visible(False)
|
||||
elif is_online:
|
||||
panel._secure.set_visible(True)
|
||||
panel._secure._icon.set_visible(True)
|
||||
if device.status.get(_K.LINK_ENCRYPTED) is True:
|
||||
if device.status.link_encrypted is True:
|
||||
panel._secure._text.set_text(_("encrypted"))
|
||||
panel._secure._icon.set_from_icon_name("security-high", _INFO_ICON_SIZE)
|
||||
panel._secure.set_tooltip_text(_("The wireless link between this device and its receiver is encrypted."))
|
||||
|
|
Loading…
Reference in New Issue