Version 0.5.6
Version 0.5.6 - Loading changes & minor optimisations
Major Feature
............................
- Improved loading system - Pygame GUI now supports:
- Incremental loading - By passing in a loader you create yourself to the UIManager, you can get progress updates on how your GUI resources are loading. See
IncrementalThreadedResourceLoader
inpygame_gui.core
, or the new loading examples in the examples repository. - Loading resources from python packages - This is, probably, the wave of the future for python projects. Instead of putting your resources in plain old directories and using boring file paths you can now add an exciting empty dunder
__init__.py
file to your resource directories, transforming them into packages which can then be loaded with a similar style to how we import code. There is a newPackageResource
class at module scope to support this and some new ways to specify resources in theme files. See the examples for a few usages and the documentation. - Loading with threads - As always with anything parallel, this comes with an extra frisson of danger. But in theory you should be able to see some improvement in how fast your resources are loaded. On my hard drive I've seen something like a 10% loading speed increase in my tests, but that can increase to almost 2x faster if your drive access speed is slow - as I discovered loading from a network drive. Care should probably be taken not to try and use any of the resources while they are being loaded as heck know what pygame will make of that. Threaded loading is enabled by default, so let us know if any problems crop up and I'll implement a fall-back, sequential-loading-only loader.
- Incremental loading - By passing in a loader you create yourself to the UIManager, you can get progress updates on how your GUI resources are loading. See
Breaking interface change
.....................................................
If you have any code that looks like this:
background.fill(manager.ui_theme.get_colour(None, None, 'dark_bg'))
Or
background.fill(manager.ui_theme.get_colour([], [], 'dark_bg'))
Then you will now have to change it to:
background.fill(manager.ui_theme.get_colour('dark_bg'))
This actually resulted from general optimisation changes but I think it is a solid improvement to the interface for getting default colours from a theme so I am enforcing it.
- Custom UI elements - If you've made any custom UI element classes (inheriting from UIElement) with their own theming then the procedure for getting theming IDs and theming parameters has changed slightly. You can see an example of adapting to these changes in the pygame_paint repository here
Bug Fixes & Other Changes
.........................................................
- The speed of creating 100+ buttons in a single frame should now be slightly faster than the 0.4.0 era of Pygame GUI rather than 3x slower (fix for #91)
- Mildly improved exception handling internally - This is an ongoing project.
- Abstract interface classes now properly enforce their interface on inheriting classes. Oops.