Closed mdickinson closed 2 months ago
@flongford Do you have bandwidth for review? This is part of a longer-term goal of insulating Traits from changes in Qt / PySide, and eventually decoupling Traits and TraitsUI entirely.
@flongford I've responded to comments above and made one minor update, for better exception handling.
Since #1788, we have only one test module that makes use of the Qt event loop. That test module contains tests for the behaviour of handlers that use
dispatch='ui'
mechanism to redispatch off-thread notifications to the ui thread.This PR reworks that test module, with some significant collateral damage along the way.
In detail:
test_ui_notifiers
) to avoid the need for the Qt event loop; instead, it tests against aui_handler
based on asyncio, which redispatches to the running asyncio event loopget_ui_handler
counterpart toset_ui_handler
, and exposes both functions intraits.api
get_ui_handler
andset_ui_handler
trait_notifiers
:ui_handler
has been made private, whileui_thread
is removed altogetherthreading.local()
being a dict (which it hasn't been in living memory), and tidying up some uses of thread identity.