Skip to content

v5.0.0: Compositing a better future!

Compare
Choose a tag to compare
@bczsalba bczsalba released this 19 Apr 17:00
· 447 commits to master since this release

Pretentious title, I know.

This version is essentially a rewrite of the window_manager module. There is now better task distribution, things are cleaner, and there is one less 1000+ line module in the library.

The biggest change was moving all printing logic into a new module compositor. At the moment this does basically the same thing as WindowManager used to, albeit a slight bit more optimized, but in the future implementing a difference-only drawer should be relatively simple.

The animation system also got completely rewritten. I'm still not fully satisfied with some aspects, but this should be the last API-breaking set of changes done to it for the foreseeable future. The TL;DR of this would be something like:

  • A single Animation base class
  • Looping animations
  • An exposed FloatAnimation that simply transitions its state from 0.0 to 1.0 over the given duration
  • Better logic, usage of elapsed time instead of independent measurements & framerate calculations

Overall, this release provides much better internal structure and stability, plus some extra features and additions. The upcoming couple of releases will focus more on the feature side of things, but there is at least one similar refactor planned (for the ansi_interface module), though likely involving less API changes.


Items marked in bold are API breaking changes.

Refactors

  • Refactor window_manager.py into 3 files under window_manager submodule
  • Refactor the entire animation system (71cf261)
  • Move scrolling behaviour into new ScrollableWidget class (37f8ffa)
  • Improve Terminal API (d0209fb)
  • Rename widgets/layoutswidgets/containers (e06608d)

Additions

  • Add StyleManager.__call__ method that sets the given **kwargs keys and values (2e69cbf)
  • Add (currently unused) Widget.get_change helper (48d3e5c)

Showcase

As this is an internal refactor based update, there isn't much to showcase. Toggling fullscreen on a Window is now animated, and some other animations are improved.

Here is a random SVG screenshot.

screenshot

Unrelated note on browser rendering oddities HTML engines seem to render `foreignObject` SVG-s just slightly differently to eachother. Here is what the above looks like on Chrome for my machine:

_Users_lapis_Code_Projects_pytermgui_screenshot svg

In comparison, my phone's GitHub app tends to render text off the "terminal" panel for some reason, and even the browser tends to render the colored unicode blocks incorrectly, often adding a border around them. Odd!