-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: issue with callbacks that also call proxy methods: #4
Comments
https://pyro5.readthedocs.io/en/latest/clientcode.html#proxy-sharing-between-threads and https://github.com/irmen/Pyro5/blob/master/examples/threadproxysharing/client.py#L14 however... if I use |
it's going to be extremely hard to support the use case as posed in the original post here. if I try to use One solution is to have the callback itself create an independent proxy to the same URI... but if we want the end-user (e.g. napari-micromanager or other users of pymmcore-remote) to be able to call core methods within callbacks as if they weren't using the proxy at all (which we kind of do), then the only solution I can currently think of is some rather dark magic of mucking with the |
this works: def test_cb_with_core_method(proxy: CMMCorePlus) -> None:
mock = Mock()
from psygnal import emit_queued
@proxy.events.imageSnapped.connect(thread="main")
def callback() -> None:
d = proxy.getLoadedDevices() # test fails unless you comment out this line
mock()
proxy.snapImage()
emit_queued()
mock.assert_called_once() see psygnal docs: https://psygnal.readthedocs.io/en/latest/usage/#connecting-across-threads |
something is broken when a signal callback connected to a proxy event itself calls proxy methods:
The text was updated successfully, but these errors were encountered: