community
community copied to clipboard
Core providers: allow granular selection of implementation to use for each instance
"You don't need to worry about the implementation to use, Kivy will take care of it for you."
We already provide an environment variable to restrict the core providers (e.g. os.environ["KIVY_IMAGE"] = "imageio,sdl2"), but that applies to the whole app and not to a specific instance.
But, what if the user wants to specify an implementation to use as is more performant for that specific case, or maybe just have a preference?
Kivy should allow a granular selection of the implementation to use for each instance.
A use case example:
Consider two text providers:
sdl2pil
The sdl2 provider is more efficient than the pil provider; however, the pil provider has some features that sdl2 does not.
Therefore, suppose an app uses 500 text widgets, and 50 of them require a feature that only exists in pil. Currently, there are only 3 alternatives:
- Use
sdl2without the feature required for the 50 widgets. - Use
pilto access the feature at the cost of lower performance for the other 450 widgets. - Use an alternative solution to enable using
pilfor the 50 widgets that require the specific feature and keepsdlfor the others for better performance.
In summary, this issue aims to allow this granular selection (as in option 3) natively, without the need for workarounds or hacks.
Yes, that's a nice example!