From b07b4915733c7b762d95415ab77b941eab0ccaf0 Mon Sep 17 00:00:00 2001 From: Raphael Roberts Date: Fri, 6 Dec 2019 14:21:14 -0600 Subject: [PATCH] Notifications don't use monospace font so space_two doesn't work --- ctabus/__main__.py | 7 ++++--- ctabus/ui/util.py | 6 ------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/ctabus/__main__.py b/ctabus/__main__.py index 548461b..0896fc5 100644 --- a/ctabus/__main__.py +++ b/ctabus/__main__.py @@ -15,7 +15,6 @@ import lazy_import from ctabus import __version__ from ctabus.internal.config import log_dir, recent_list, CHICAGO_TZ -from ctabus.ui.util import space_two notification_module = lazy_import.lazy_module("ctabus.ui.notification") toast_module = lazy_import.lazy_module("ctabus.ui.toast") @@ -126,9 +125,11 @@ def show( text_to_show = text_config.format(**format_dict) if do_gui and enable_notifications: notification_module.nm.setup_exiter(EXIT) - mins = "{} min".format(delta.total_seconds() // 60) + mins = "{} min".format(int(delta.total_seconds()) // 60) bus_route = "{route} - {end}".format(**format_dict) - notification_module.nm.set_title(space_two(bus_route, mins, 42)) + notification_module.nm.set_title( + "{{ {} }}---{{ {} }}".format(bus_route, mins) + ) notification_module.nm.say(notification_config.format(**format_dict)) if do_gui and enable_toast: diff --git a/ctabus/ui/util.py b/ctabus/ui/util.py index 2b37ae7..069bb12 100644 --- a/ctabus/ui/util.py +++ b/ctabus/ui/util.py @@ -12,9 +12,3 @@ def numb_sort(text): (See Toothy's implementation in the comments) """ return [atoi(c) for c in re.split(r"(\d+)", text)] - - -def space_two(item_1, item_2, total_len): - string_1, string_2 = map(str, (item_1, item_2)) - n_spaces = max(1, total_len - sum(map(len, (string_1, string_2)))) - return "{}{}{}".format(string_1, " " * n_spaces, string_2)