You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed that asyncslot and modal might not work correctly all the time. Particularly, when modal is used in the eagerly executed part of an asyncslot.
Environment: Python 3.10.12 (Linux), PySide6 6.5.1.1, qtinter 0.11.0.
I use qtinter.using_asyncio_from_qt().
For example:
# slot is connected via asyncslotasyncdefon_settings_btn_clicked(self):
dialog_coro=qtinter.modal(settings_dialog.exec)
# this call will result in an exceptionresult=awaitdialog_coro()
The exception:
Traceback (most recent call last):
File "...", line 233, in on_settings_btn_clicked
result = await dialog_coro()
File ".../site-packages/qtinter/_modal.py", line 29, in modal_wrapper
loop.exec_modal(modal_fn)
File ".../site-packages/qtinter/_base_events.py", line 232, in exec_modal
raise RuntimeError('QiBaseEventLoop.exec_modal() must be called '
RuntimeError: QiBaseEventLoop.exec_modal() must be called from a coroutine or callback
If I add await asyncio.sleep(0) just before the await of a modal, then everything works fine. Like that:
# slot is connected via asyncslotasyncdefon_settings_btn_clicked(self):
dialog_coro=qtinter.modal(settings_dialog.exec)
awaitasyncio.sleep(0)
result=awaitdialog_coro()
Am I doing something wrong here? What is the best practice for something like this?
The text was updated successfully, but these errors were encountered:
Hi!
Firstly, thanks for the awesome library!
I've noticed that
asyncslot
andmodal
might not work correctly all the time. Particularly, whenmodal
is used in the eagerly executed part of anasyncslot
.Environment: Python 3.10.12 (Linux), PySide6 6.5.1.1, qtinter 0.11.0.
I use
qtinter.using_asyncio_from_qt()
.For example:
The exception:
If I add
await asyncio.sleep(0)
just before the await of a modal, then everything works fine. Like that:Am I doing something wrong here? What is the best practice for something like this?
The text was updated successfully, but these errors were encountered: