Browse Source

Added something to share the EXIT Event from __main__ to nm

atexit
Raphael Roberts 6 years ago
parent
commit
01139a7c00
  1. 1
      ctabus/__main__.py
  2. 11
      ctabus/ui/notification.py

1
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)

11
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:

Loading…
Cancel
Save