ui: don't show wireless link or battery information when unknown or not present
This commit is contained in:
parent
dcbf547195
commit
57c0c5d4b3
|
@ -293,13 +293,14 @@ class DeviceStatus(dict):
|
||||||
_settings.apply_all_settings(d)
|
_settings.apply_all_settings(d)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if was_active:
|
if was_active: # don't clear status when devices go inactive
|
||||||
battery = self.get(KEYS.BATTERY_LEVEL)
|
## battery = self.get(KEYS.BATTERY_LEVEL)
|
||||||
self.clear()
|
## self.clear()
|
||||||
# If we had a known battery level before, assume it's not going
|
## # If we had a known battery level before, assume it's not going
|
||||||
# to change much while the device is offline.
|
## # to change much while the device is offline.
|
||||||
if battery is not None:
|
## if battery is not None:
|
||||||
self[KEYS.BATTERY_LEVEL] = battery
|
## self[KEYS.BATTERY_LEVEL] = battery
|
||||||
|
pass
|
||||||
|
|
||||||
# A device that is not active on the first status notification
|
# A device that is not active on the first status notification
|
||||||
# but becomes active afterwards does not produce a pop-up notification
|
# but becomes active afterwards does not produce a pop-up notification
|
||||||
|
|
|
@ -141,7 +141,7 @@ def _create_device_panel():
|
||||||
p._lux = _status_line(_('Lighting'))
|
p._lux = _status_line(_('Lighting'))
|
||||||
p.pack_start(p._lux, False, False, 0)
|
p.pack_start(p._lux, False, False, 0)
|
||||||
|
|
||||||
p.pack_start(Gtk.Separator.new(Gtk.Orientation.HORIZONTAL), False, False, 0) # spacer
|
# p.pack_start(Gtk.Separator.new(Gtk.Orientation.HORIZONTAL), False, False, 0) # spacer
|
||||||
|
|
||||||
p._config = _config_panel.create()
|
p._config = _config_panel.create()
|
||||||
p.pack_end(p._config, True, True, 4)
|
p.pack_end(p._config, True, True, 4)
|
||||||
|
@ -683,14 +683,9 @@ def _update_device_panel(device, panel, buttons, full=False):
|
||||||
battery_level = device.status.get(_K.BATTERY_LEVEL)
|
battery_level = device.status.get(_K.BATTERY_LEVEL)
|
||||||
battery_voltage = device.status.get(_K.BATTERY_VOLTAGE)
|
battery_voltage = device.status.get(_K.BATTERY_VOLTAGE)
|
||||||
if battery_level is None and battery_voltage is None:
|
if battery_level is None and battery_voltage is None:
|
||||||
icon_name = _icons.battery()
|
panel._battery.set_visible(False)
|
||||||
panel._battery._icon.set_from_icon_name(icon_name, _INFO_ICON_SIZE)
|
|
||||||
panel._battery._icon.set_sensitive(False)
|
|
||||||
panel._battery._text.set_sensitive(is_online)
|
|
||||||
panel._battery._label.set_text(_('Battery'))
|
|
||||||
panel._battery._text.set_markup('<small>%s</small>' % (_('none') if is_online else _('unknown')))
|
|
||||||
panel._battery.set_tooltip_text(_('Battery not found.') if is_online else _('Battery information unknown.'))
|
|
||||||
else:
|
else:
|
||||||
|
panel._battery.set_visible(True)
|
||||||
battery_next_level = device.status.get(_K.BATTERY_NEXT_LEVEL)
|
battery_next_level = device.status.get(_K.BATTERY_NEXT_LEVEL)
|
||||||
charging = device.status.get(_K.BATTERY_CHARGING)
|
charging = device.status.get(_K.BATTERY_CHARGING)
|
||||||
icon_name = _icons.battery(battery_level, charging)
|
icon_name = _icons.battery(battery_level, charging)
|
||||||
|
@ -725,9 +720,16 @@ 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 is_online:
|
if device.status.get(_K.LINK_ENCRYPTED) is None:
|
||||||
not_secure = device.status.get(_K.LINK_ENCRYPTED) is False
|
panel._secure.set_visible(False)
|
||||||
if not_secure:
|
elif is_online:
|
||||||
|
panel._secure.set_visible(True)
|
||||||
|
panel._secure._icon.set_visible(True)
|
||||||
|
if device.status.get(_K.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.'))
|
||||||
|
else:
|
||||||
panel._secure._text.set_text(_('not encrypted'))
|
panel._secure._text.set_text(_('not encrypted'))
|
||||||
panel._secure._icon.set_from_icon_name('security-low', _INFO_ICON_SIZE)
|
panel._secure._icon.set_from_icon_name('security-low', _INFO_ICON_SIZE)
|
||||||
panel._secure.set_tooltip_text(
|
panel._secure.set_tooltip_text(
|
||||||
|
@ -736,14 +738,10 @@ def _update_device_panel(device, panel, buttons, full=False):
|
||||||
'This is a security issue for pointing devices, and a major security issue for text-input devices.'
|
'This is a security issue for pointing devices, and a major security issue for text-input devices.'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
|
||||||
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.'))
|
|
||||||
panel._secure._icon.set_visible(True)
|
|
||||||
else:
|
else:
|
||||||
panel._secure._text.set_markup('<small>%s</small>' % _('offline'))
|
panel._secure.set_visible(True)
|
||||||
panel._secure._icon.set_visible(False)
|
panel._secure._icon.set_visible(False)
|
||||||
|
panel._secure._text.set_markup('<small>%s</small>' % _('offline'))
|
||||||
panel._secure.set_tooltip_text('')
|
panel._secure.set_tooltip_text('')
|
||||||
|
|
||||||
if is_online:
|
if is_online:
|
||||||
|
|
Loading…
Reference in New Issue