Skip to content

Commit

Permalink
Revert change on create_message method in dbus plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
heddxh committed May 24, 2024
1 parent b6bdd4e commit 828a1ab
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
4 changes: 2 additions & 2 deletions yin_yang/plugins/_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,11 @@ def set_theme(self, theme: str):
if not theme:
raise ValueError(f'Theme \"{theme}\" is invalid')

self.create_message(theme)
self.message = self.create_message(theme)
self.call()

@abstractmethod
def create_message(self, theme: str) -> None:
def create_message(self, theme: str) -> QDBusMessage:
raise NotImplementedError(f'Plugin {self.name} did not implement create_message()')

def call(self) -> QDBusMessage:
Expand Down
7 changes: 4 additions & 3 deletions yin_yang/plugins/gtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ def __init__(self):
self.theme_light = 'Breeze'
self.theme_dark = 'Breeze'

def create_message(self, theme: str):
self.message = QDBusMessage.createMethodCall(*self.message_data)
self.message.setArguments([theme])
def create_message(self, theme: str) -> QDBusMessage:
message = QDBusMessage.createMethodCall(*self.message_data)
message.setArguments([theme])
return message

def set_theme(self, theme: str):
"""Call DBus interface of kde-gtk-config if installed.
Expand Down
3 changes: 2 additions & 1 deletion yin_yang/plugins/konsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ def theme_dark(self, value):
self.update_profile(True, value)
self._theme_dark = value

def create_message(self, theme: str):
def create_message(self, theme: str) -> QDBusMessage:
message = QDBusMessage.createMethodCall(*self.message_data)
message.setArguments([theme])
return message

def set_mode(self, dark: bool) -> bool:
# run checks
Expand Down
6 changes: 4 additions & 2 deletions yin_yang/plugins/notify.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from PySide6.QtDBus import QDBusMessage

from ..NotificationHandler import create_dbus_message
from ._plugin import DBusPlugin

Expand All @@ -8,5 +10,5 @@ def __init__(self):
self.theme_light = "Day"
self.theme_dark = "Night"

def create_message(self, theme: str):
self.message = create_dbus_message("Theme changed", f"Set the theme to {theme}")
def create_message(self, theme: str) -> QDBusMessage:
return create_dbus_message("Theme changed", f"Set the theme to {theme}")
3 changes: 2 additions & 1 deletion yin_yang/plugins/wallpaper.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def theme_dark(self, value: str):
def available(self) -> bool:
return True

def create_message(self, theme: str):
def create_message(self, theme: str) -> QDBusMessage:
message = QDBusMessage.createMethodCall(*self.message_data)
message.setArguments([
'string:'
Expand All @@ -130,6 +130,7 @@ def create_message(self, theme: str):
f' d.writeConfig("Image", "file:{theme}");'
'}'
])
return message


class _Xfce(PluginCommandline):
Expand Down

0 comments on commit 828a1ab

Please sign in to comment.