Skip to content

Commit

Permalink
ui: fix bug in determining tray icon
Browse files Browse the repository at this point in the history
  • Loading branch information
pfps committed Mar 11, 2024
1 parent 24223e7 commit 569f829
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/solaar/ui/tray.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ def _update_tray_icon():
battery_level = device.battery_info.level if device.battery_info is not None else None
battery_charging = device.battery_info.charging() if device.battery_info is not None else None
tray_icon_name = _icons.battery(battery_level, battery_charging)

description = "%s: %s" % (name, device.status_string())
else:
# there may be a receiver, but no peripherals
Expand Down Expand Up @@ -330,8 +329,7 @@ def _pick_device_with_lowest_battery():
for info in _devices_info:
if info[1] is None: # is receiver
continue
level = info[-1].battery_info.level if hasattr(info[-1], "status") and info[-1].battery_info is not None else None
# print ("checking %s -> %s", info, level)
level = info[-1].battery_info.level if info[-1].battery_info is not None else None
if level is not None and picked_level > level:
picked = info
picked_level = level or 0
Expand Down Expand Up @@ -446,7 +444,7 @@ def _update_menu_item(index, device):
_picked_device = None

# cached list of devices and some of their properties
# contains tuples of (receiver path, device number, name, status)
# contains tuples of (receiver path, device number, name, device)
_devices_info = []

_menu = None
Expand Down

0 comments on commit 569f829

Please sign in to comment.