device: move link_encrypted from status to Device
This commit is contained in:
parent
15d425c365
commit
1fe2eab1a4
|
@ -94,6 +94,7 @@ class Device:
|
||||||
self._profiles = self._backlight = self._registers = self._settings = None
|
self._profiles = self._backlight = self._registers = self._settings = None
|
||||||
self.notification_flags = None
|
self.notification_flags = None
|
||||||
self.battery_info = None
|
self.battery_info = None
|
||||||
|
self.link_encrypted = None
|
||||||
|
|
||||||
self._feature_settings_checked = False
|
self._feature_settings_checked = False
|
||||||
self._gestures_lock = _threading.Lock()
|
self._gestures_lock = _threading.Lock()
|
||||||
|
@ -361,7 +362,6 @@ class Device:
|
||||||
info.level = self.battery_info.level
|
info.level = self.battery_info.level
|
||||||
|
|
||||||
changed = self.battery_info != info
|
changed = self.battery_info != info
|
||||||
print("SBI", changed, info, self.battery_info)
|
|
||||||
self.battery_info, old_info = info, self.battery_info
|
self.battery_info, old_info = info, self.battery_info
|
||||||
|
|
||||||
alert, reason = ALERT.NONE, None
|
alert, reason = ALERT.NONE, None
|
||||||
|
|
|
@ -266,7 +266,7 @@ def _process_hidpp10_notification(device, status, n):
|
||||||
link_established,
|
link_established,
|
||||||
bool(flags & 0x80),
|
bool(flags & 0x80),
|
||||||
)
|
)
|
||||||
status.link_encrypted = link_encrypted
|
device.link_encrypted = link_encrypted
|
||||||
status.changed(active=link_established)
|
status.changed(active=link_established)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,6 @@ class DeviceStatus:
|
||||||
assert changed_callback
|
assert changed_callback
|
||||||
self._changed_callback = changed_callback
|
self._changed_callback = changed_callback
|
||||||
self._active = None # is the device active?
|
self._active = None # is the device active?
|
||||||
self.link_encrypted = None
|
|
||||||
|
|
||||||
def __bool__(self):
|
def __bool__(self):
|
||||||
return bool(self._active)
|
return bool(self._active)
|
||||||
|
|
|
@ -232,7 +232,7 @@ def _pairing_succeeded(assistant, receiver, device):
|
||||||
|
|
||||||
def _check_encrypted(dev):
|
def _check_encrypted(dev):
|
||||||
if assistant.is_drawable():
|
if assistant.is_drawable():
|
||||||
if device.status.link_encrypted is False:
|
if device.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.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.pack_start(Gtk.Label(_("The wireless link is not encrypted") + "!"), False, False, 0)
|
||||||
hbox.show_all()
|
hbox.show_all()
|
||||||
|
|
|
@ -725,12 +725,12 @@ def _update_device_panel(device, panel, buttons, full=False):
|
||||||
panel._battery._text.set_markup(text)
|
panel._battery._text.set_markup(text)
|
||||||
panel._battery.set_tooltip_text(tooltip_text)
|
panel._battery.set_tooltip_text(tooltip_text)
|
||||||
|
|
||||||
if device.status.link_encrypted is None:
|
if device.link_encrypted is None:
|
||||||
panel._secure.set_visible(False)
|
panel._secure.set_visible(False)
|
||||||
elif is_online:
|
elif is_online:
|
||||||
panel._secure.set_visible(True)
|
panel._secure.set_visible(True)
|
||||||
panel._secure._icon.set_visible(True)
|
panel._secure._icon.set_visible(True)
|
||||||
if device.status.link_encrypted is True:
|
if device.link_encrypted is True:
|
||||||
panel._secure._text.set_text(_("encrypted"))
|
panel._secure._text.set_text(_("encrypted"))
|
||||||
panel._secure._icon.set_from_icon_name("security-high", _INFO_ICON_SIZE)
|
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."))
|
panel._secure.set_tooltip_text(_("The wireless link between this device and its receiver is encrypted."))
|
||||||
|
|
Loading…
Reference in New Issue