From 01139a7c004de48b073dbf31d7fcd0562a3f3420 Mon Sep 17 00:00:00 2001 From: Raphael Roberts Date: Sat, 12 Oct 2019 19:06:50 -0500 Subject: [PATCH] Added something to share the EXIT Event from __main__ to nm --- ctabus/__main__.py | 1 + ctabus/ui/notification.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ctabus/__main__.py b/ctabus/__main__.py index 40cf163..47ee919 100644 --- a/ctabus/__main__.py +++ b/ctabus/__main__.py @@ -119,6 +119,7 @@ def show( } text_to_show = config.format(**format_dict) if do_gui and enable_notifications: + notification_module.nm.setup_exiter(EXIT) notification_module.nm.set_title("Bustimes") notification_module.nm.say(text_to_show) diff --git a/ctabus/ui/notification.py b/ctabus/ui/notification.py index 2aa4b92..9f7427e 100644 --- a/ctabus/ui/notification.py +++ b/ctabus/ui/notification.py @@ -1,9 +1,18 @@ +from ctabus.internal.config import state_dir from ctabus.internal.notification import NotificationManager, HAS_NOTIFICATION class CTABUSNotifictaionManager(NotificationManager): + def __init__(self, workdir=state_dir): + super().__init__(workdir) + self.exiter = None + + def setup_exiter(self, exiter): + if self.exiter is None: + self.exiter = exiter + def on_done(self): - EXIT.set() + self.exiter.set() if HAS_NOTIFICATION: