I need to create a method in a foreign PyQt5 window class at runtime (that will be called later from a different thread with QMetaObject.invokeMethod()). Therefore I cannot use the decorator style. Is there a way to write this around with function calls?
I've learned that this is easy with simple decorators, but the pyqtSlot() has arguments of it's own.
I've come so far:
class win(QMainWindow):
def __init__(): ...
def fn(self, op): ...
a = win()
a.fn = types.MethodType(fn, a)
a.decofn = pyqtSlot(list)
Now I'm looking for the correct way to pass the original function a.fn to a.decofn, which at this point doesn't yet know about it, right?
def fn
function should be indentation the class instance module.