From ccac5c58103a3b6b28e59a08ed42a9a9058d64fe Mon Sep 17 00:00:00 2001 From: Heddxh Date: Sat, 27 Apr 2024 22:13:15 +0800 Subject: [PATCH] Port notify plugin --- yin_yang/plugins/_plugin.py | 2 +- yin_yang/plugins/notify.py | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/yin_yang/plugins/_plugin.py b/yin_yang/plugins/_plugin.py index 1a0007e..a8b98d5 100644 --- a/yin_yang/plugins/_plugin.py +++ b/yin_yang/plugins/_plugin.py @@ -257,7 +257,7 @@ class DBusPlugin(Plugin): def __init__(self, message_data: List[str]): super().__init__() self.connection = QDBusConnection.sessionBus() - self.message = QDBusMessage() + self.message: QDBusMessage self.message_data: List[str] = message_data # Store DBusMessage data(destination, path, interface, method) def set_theme(self, theme: str): diff --git a/yin_yang/plugins/notify.py b/yin_yang/plugins/notify.py index 6184eeb..adaff67 100644 --- a/yin_yang/plugins/notify.py +++ b/yin_yang/plugins/notify.py @@ -1,14 +1,12 @@ -from PySide6.QtDBus import QDBusMessage - from ..NotificationHandler import create_dbus_message from ._plugin import DBusPlugin class Notification(DBusPlugin): def __init__(self): - super().__init__() - self.theme_light = 'Day' - self.theme_dark = 'Night' + super().__init__([]) # We do everything in [create_dbus_message] + self.theme_light = "Day" + self.theme_dark = "Night" - def create_message(self, theme: str) -> QDBusMessage: - return create_dbus_message('Theme changed', f'Set the theme to {theme}') + def create_message(self, theme: str): + self.message = create_dbus_message("Theme changed", f"Set the theme to {theme}")