From 93222417473f2b3069dfb5dc116daad6ad34b601 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Thu, 24 Feb 2022 10:36:16 -0600 Subject: [PATCH] Remove more unneeded code --- src/notifier/__init__.py | 23 ----------------------- src/notifier/linux.py | 27 --------------------------- src/notifier/windows.py | 9 --------- src/run_tests.py | 18 ------------------ 4 files changed, 77 deletions(-) delete mode 100644 src/notifier/__init__.py delete mode 100644 src/notifier/linux.py delete mode 100644 src/notifier/windows.py delete mode 100644 src/run_tests.py diff --git a/src/notifier/__init__.py b/src/notifier/__init__.py deleted file mode 100644 index 381ca60a..00000000 --- a/src/notifier/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -""" A cross platform notification system. -Under Linux, the wx.NotificationMessage does not show a notification on the taskbar, so we decided to use dbus for showing notifications for linux and wx for Windows.""" -from __future__ import absolute_import -from __future__ import unicode_literals -import platform - -notify = None - -def setup(): - global notify - if platform.system() == "Windows": - from . import windows - notify = windows.notification() - elif platform.system() == "Linux": - from . import linux - notify = linux.notification() - -def send(title, text): - global notify - if not notify or notify is None: - setup() - notify.notify(title, text) diff --git a/src/notifier/linux.py b/src/notifier/linux.py deleted file mode 100644 index 91b2e217..00000000 --- a/src/notifier/linux.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals -from builtins import object -import dbus -import application - -class notifications(object): - """Supports notifications on Linux. - """ - - def __init__(self): - super(notifications, self).__init__() - self.item = "org.freedesktop.Notifications" - self.path = "/org/freedesktop/Notifications" - self.interface = "org.freedesktop.Notifications" - self.app_name = application.name - self.id_num_to_replace = 0 - self.icon = "/usr/share/icons/Tango/32x32/status/sunny.png" - - def notify(self, title="", text=""): - actions_list = '' - hint = '' - time = 5000 # Use seconds x 1000 - bus = dbus.SessionBus() - notif = bus.get_object(self.item, self.path) - notify = dbus.Interface(notif, self.interface) - notify.Notify(self.app_name, self.id_num_to_replace, self.icon, title, text, actions_list, hint, time) diff --git a/src/notifier/windows.py b/src/notifier/windows.py deleted file mode 100644 index a521c4a5..00000000 --- a/src/notifier/windows.py +++ /dev/null @@ -1,9 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals -from builtins import object -import wx - -class notification(object): - - def notify(self, title, text): - wx.NotificationMessage(title, text).Show() diff --git a/src/run_tests.py b/src/run_tests.py deleted file mode 100644 index 41842347..00000000 --- a/src/run_tests.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- -import unittest - -testmodules = ["test.test_cache"] - -suite = unittest.TestSuite() - -for t in testmodules: - try: - # If the module defines a suite() function, call it to get the suite. - mod = __import__(t, globals(), locals(), ['suite']) - suitefn = getattr(mod, 'suite') - suite.addTest(suitefn()) - except (ImportError, AttributeError): - # else, just load all the test cases from the module. - suite.addTest(unittest.defaultTestLoader.loadTestsFromName(t)) - -unittest.TextTestRunner(verbosity=2).run(suite) \ No newline at end of file