Closed corranwebster closed 1 year ago
One thought on the general idea: I think I've occasionally used an import pyface.api
in the past to deliberately force toolkit selection to occur. (Usually to avoid weird interactions when the toolkit selection happens at a time out of my control.) With this PR, what would be the recommended way to explicitly force toolkit selection?
With this PR, what would be the recommended way to explicitly force toolkit selection?
I've added find_toolkit
to api.py
so I think a reasonable way of doing this would be
from pyface.api import find_toolkit
find_toolkit()
This is idempotent, so the same toolkit object will be found no matter what.
This is uses module
__getattr__
and__dir__
based on PEP 562 which is available now we are dropping Python 3.6 support.Basic strategy is to handle two classes of imports - those which come directly via the toolkit object, and those which are via an import relative to the api module. This allows us to eventually deprecate and remove stub modules which do nothing more than import using the toolkit, but we don't do that in this PR.
We test by checking that every public attribute returned by
dir()
can be accessed.Includes a few drive-by fixes to avoid toolkit selection where where possible. The most significant is adding formal
Interface
classes forActionManager
and its subclasses (and using those onApplicationWindow
). It also cleans up a deprecated trait onApplicationWindow
.