I use PySide to control some equipment and perform some relatively simple operations depending on (for example) button presses in the interface. The code to run each of these components is in a different thread. For convenience, I have added a common invoke_methodsignal for all of these hardware drivers so that the user interface component can use
my_driver.invoke_method.emit('method_name', [arg, ...], {kwarg, ...})
Obviously this is accessing the signal attribute in this other thread directly .... but I'm not sure if this is all right in the GIL world.
If this is really too lazy a decision - are there any other great alternatives for calling arbitrary methods in arbitrary threads without having to have an operation-specific signal in the user interface connected to another signal in the driver?
I could assume that instead I used a signal in each bit of the user interface code that turned to another device - something like do_invocation_driver_1and do_invocation_driver_2, and connected them to the signal of the invoke_methodcorresponding driver.
source
share