ui: fix tooltip description

The program's name is printed twice if AppIndicator is used and no receiver
is found because AppIndicator always adds the program's name as a title to
the tooltip.
This commit is contained in:
Thomas Uhle 2020-03-30 17:55:13 +02:00 committed by Peter F. Patel-Schneider
parent 2bdb844557
commit 5f8dbdeb6d
1 changed files with 10 additions and 2 deletions

View File

@ -196,8 +196,8 @@ try:
# there may be a receiver, but no peripherals
tray_icon_name = _icons.TRAY_OKAY if _devices_info else _icons.TRAY_INIT
tooltip_lines = _generate_tooltip_lines()
description = '\n'.join(tooltip_lines).rstrip('\n')
description_lines = _generate_description_lines()
description = '\n'.join(description_lines).rstrip('\n')
# icon_file = _icons.icon_file(icon_name, _TRAY_ICON_SIZE)
_icon.set_icon_full(_icon_file(tray_icon_name), description)
@ -287,6 +287,14 @@ def _generate_tooltip_lines():
yield '<b>%s</b>: ' % NAME + _("no receiver")
return
yield from _generate_description_lines()
def _generate_description_lines():
if not _devices_info:
yield _("no receiver")
return
for _ignore, number, name, status in _devices_info:
if number is None: # receiver
continue