From 5f8dbdeb6d1d0ce232940b35759c1b94c740036f Mon Sep 17 00:00:00 2001 From: Thomas Uhle Date: Mon, 30 Mar 2020 17:55:13 +0200 Subject: [PATCH] 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. --- lib/solaar/ui/tray.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/solaar/ui/tray.py b/lib/solaar/ui/tray.py index 2270a08d..a7a28f4c 100644 --- a/lib/solaar/ui/tray.py +++ b/lib/solaar/ui/tray.py @@ -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 '%s: ' % 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