From fe36b87c57c18f195fbf7b02d1d2e7bb030f75ad Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Tue, 4 Feb 2020 14:18:20 -0600 Subject: [PATCH] fix notifier formatting --- src/notifier/__init__.py | 35 +++++++++++++++++++---------------- tests/runtime-result.txt | 2 +- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/notifier/__init__.py b/src/notifier/__init__.py index bc131ff1..c316370f 100644 --- a/src/notifier/__init__.py +++ b/src/notifier/__init__.py @@ -1,9 +1,17 @@ -''' - Onionr - Private P2P Communication +"""Onionr - Private P2P Communication. - Desktop notification wrapper -''' -''' +Desktop notification wrapper +""" +try: + import simplenotifications as simplenotify +except ImportError: + notifications_enabled = False +else: + notifications_enabled = True + +import config + +""" This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or @@ -16,19 +24,14 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -''' -try: - import simplenotifications as simplenotify -except ImportError: +""" + +if not config.get('general.show_notifications', True): notifications_enabled = False -else: - notifications_enabled = True -import config - -if not config.get('general.show_notifications', True): notifications_enabled = False def notify(title: str = "Onionr", message: str = ""): - """cross platform method to show a notification""" - if not notifications_enabled: return + """Cross platform method to show a notification.""" + if not notifications_enabled: + return simplenotify.notify(title, message) diff --git a/tests/runtime-result.txt b/tests/runtime-result.txt index 81b2d82f..4593c7ed 100644 --- a/tests/runtime-result.txt +++ b/tests/runtime-result.txt @@ -1 +1 @@ -1580787293 \ No newline at end of file +1580847482 \ No newline at end of file