oskarsh / Yin-Yang

Auto Nightmode for KDE, Gnome, Budgie, VSCode, Atom and more
MIT License
638 stars 52 forks source link

`PySide6.QtDBus.QDBusMessage` is not deepcopyable #277

Open w568w opened 8 months ago

w568w commented 8 months ago

What happened?

When a DBusPlugin (e.g. _Budgie, _Kde) calls DBusPlugin.create_message, an error occurs at:

https://github.com/oskarsh/Yin-Yang/blob/f72bfff78a964bd6c63e7c3d5f800bd551c4e4a5/yin_yang/plugins/_plugin.py#L271-L274


QDBusMessage does implement __copy__. But as the documentation says,

QDBusMessage objects are shared. Modifications made to the copy will affect the original one as well.

So it might be better to change base_message to base_message_factory (or base_message_creator)?

Version

Build from master (f72bfff78a964bd6c63e7c3d5f800bd551c4e4a5)

How did you install Yin & Yang?

AUR

What desktop environments are you seeing the problem on?

KDE

Which plugin causes the issue?

GTK

What software version do you use?

n/a

Relevant log output

Exception in thread GTK:
Traceback (most recent call last):
  File "/usr/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.11/threading.py", line 982, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/yin-yang/yin_yang/plugins/_plugin.py", line 56, in set_mode
    self.set_theme(theme)
  File "/opt/yin-yang/yin_yang/plugins/_plugin.py", line 208, in set_theme
    self.strategy.set_theme(theme)
  File "/opt/yin-yang/yin_yang/plugins/gtk.py", line 96, in set_theme
    response = self.call(self.create_message(theme))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/yin-yang/yin_yang/plugins/_plugin.py", line 272, in create_message
    message = copy.deepcopy(self.base_message)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/copy.py", line 161, in deepcopy
    rv = reductor(4)
         ^^^^^^^^^^^
TypeError: cannot pickle 'PySide6.QtDBus.QDBusMessage' object
cheanus commented 8 months ago

Same log output and error on Arch, KDE 6