Skip to content

Releases: bczsalba/pytermgui

v3.0.0: Pixels, links & colors!

22 Feb 17:16
Compare
Choose a tag to compare

This version mostly focused on improving already built features, but there is a lot of important additions as well.

The most notable new change would probably be the PixelMatrixclasses. These allow you to display an arbitrary matrix of pixels as a widget. DensePixelMatrix scales the entire widget down by a factor of 4 (in normal PixelMatrix, every pixel is made up of 2 block characters. In DensePixelMatrix all pixels make up only half a block.

This would normally not constitute for a major release, however the Slider refactor forced our hand. Some parts of its API have changed, though mostly for the better.

Items marked in bold are API breaking changes.

Refactors

  • Refactor Slider widget (788a709, #9)
  • Update Button default chars (f370dea)
  • Change WindowManager.framerate 120 -> 60 (320d65c)

Additions

  • Add MarkupLanguage.prettify_markup (d6733f5)
  • Add WindowManager.nullify_cache & Window.nullify_cache (814d205)
  • Add !link markup macro (0c05080)
  • Add StyledText class (be2f5de)
  • Add ColorPicker widget, CLI app (5a09f43, 45b6d02)
  • Add PixelMatrix & LargePixelMatrix widgets (84312c1)

Bugfixes

  • Fix selection lingering after mouse event (2a0b79b)
  • Fix Right-click release events being misdetected (1b7b69a)
  • Fix Window._auto_min_width disregarding sidelength (8b51ff0)
  • Fix incorrect behaviour in Container._update_width (363093a)

Screen.Recording.2022-02-22.at.14.14.54.mov

v2.2.0: Animations!

14 Feb 12:46
Compare
Choose a tag to compare

Version 2.2.0

This version brings an implementation of animations to the library. The new Animator class is tasked with controlling & updating a list of Animation instances. Animations work using time-elapsed since instantiation, and animate an integer field going from one value to another.

Refactors

  • Make Container._centered_axis public (0304aca)
    • Note: This is not deemed API breaking, as this attribute was never meant to be user facing.

Fixes

  • Fix Overflow.HIDE only hiding entire widgets (4289a5c)
  • Fix getch application growing in height indefinitely (ea5b721)

Additions

Showcase

Here is a showcase of the already-implemented animations in WindowManager, using the ptg CLI environment.

Screen.Recording.2022-02-14.at.13.38.09.mov

v2.1.1: Windows-related bug smashing

11 Feb 18:13
Compare
Choose a tag to compare

Version 2.1.1

This release fixes various issues related to Windows systems. It also brought about a more logical
refactor for WindowManager.process_input.

As this is a minor release, not much has changed. To see the bigger changes that have recently happened, see the previous release.

Items marked in bold are API breaking changes.

Fixes

  • Fix CTRL_C not being captured on Windows machines (0113963)
  • Fix widgets/interactive.py not being packaged (ea78b12)
  • Silence keys attribute errors (75cebf7)

v2.1.0: Improvements for Windows, new boxes & helpers!

11 Feb 08:50
Compare
Choose a tag to compare

Version 2.1.0

This update is mostly focused on bug fixes, but also has some additions. The
library should now actually install on Windows machines, which is pretty dapper.

Items marked in bold are API breaking changes.

Removals

  • Remove broken SIGWINCH monitor (#25, #19)

Additions

  • Add Container.scroll and Container.scroll_end helpers (0119e31)
  • Add SINGLE box type, rename old SINGLE box to ROUNDED (5dda727)

Fixes

  • Fix some issues with InputField (0920ffc)
  • Improve how terminal resize events are handled (7143aff)
  • Fix 1 char offset in non-Container widget widths (e3ac8d7)

Showcase

Here is an image of my first major project with the library, Pagoda.
Screenshot 2022-02-11 at 9 48 03

v2.0.0: Better mouse API, scrollable Containers & more!

25 Jan 20:32
Compare
Choose a tag to compare

Version 2.0.0

This version contains a whole lot of nice Quality of Life changes, as well as some major additions. The highlights would probably go to Container-s now having native support for scrolling their contents, a brand-spanking new and hugely improve mouse input API, and improved documentation.

Items marked in bold are API breaking changes.

🔧 Fixes

  • Fix widget height not following its destiny sometimes
  • Fix Splitter inner widget positioning

🔃 Refactors

  • Restructure widgets module
  • Change to Google docformat
  • Rewrite Container.get_lines for brevity, efficiency and more features

➕ Additions

➖ Removals

  • Remove redundant _SYS_HAS_FRAME in ansi_interface

Showcase

Here is a quick clip showcasing some of the new features.

showcase.mov

v1.1.0: Improve Windows support & improve QOL

09 Jan 18:04
Compare
Choose a tag to compare

Fixes

  • Fix SIGWINCH on Windows (#6)
  • Fix an error with empty markup tags

New additions

  • Add InputField expect attribute
  • Add overline capability (#7, thanks to @rbanffy)
  • Add --version flag to CLI
  • Add context management to MarkupLanguage

v1.0.1: Fix README links

02 Jan 23:08
Compare
Choose a tag to compare

This is quite embarrassing. Guess who forgot to change relative image links to be accessible on other sites?

Well, it's been fixed now.

Ok, bye 🚀

v1.0.0: Documentation & stability

02 Jan 20:10
Compare
Choose a tag to compare

The day has finally come

With 1.0.0, the library has hit its first stable release.

Other than the obvious changes, like minor bug fixes and stability improvements, here is a rundown of the coolest new capabilities:

file_loaders.py:

A whole new way to create interfaces

Using either of the loaders provided by the module, one can now turn hand-written markup into fully functional interfaces, bar callbacks and such. Those can be added manually using the id system.

The currently supported file formats are JSON and YAML, though implementing new ones is trivial. (see the docs for more info).

You can even interpret your YAML files into a WindowManager from the command line using the new -f flag.

A new widget width system

Your widgets will actually follow their dimensions now

Widgets can now follow one of two width "policies", as outlined in the docs. The way these are handled internally makes the whole system a lot more stable, and LineLengthError-s occur much less commonly now.

Full screen support for Container and Window

For those not into pool floaters

Outer Container-s now automatically resize to the current terminal size. Window now has a new flag, allow_fullscreen, which causes its manager to resize it to fit the terminal dimensions before every print call. These are useful if you want non-floating interfaces, and may be a decent start for the tiling layout later on.

Screenshot 2022-01-02 at 21 01 40

Documentation and a much better README!

Maybe we look a bit more professional now

The previous README was a remnant from a time when the end goal of the library was much different. A lot of things happened since then, so it felt appropriate to give it a new coat of paint.

I have figured out a much nicer way of inserting images (using a plain white desktop background behind a terminal on MacOS, giving it a nice, soft shadow), but my current methodology only works in light mode. If anyone knows a way to get around that, please contact me. I am desperate.

There is also documentation now! Most of it was already written, but had to be touched up or reworked for the doc generator. I decided on using pdoc (not pdoc3) as my documentation "backend", since Sphinx was being a hassle to set up and I prefer Markdown over Rst. For now, this documentation lives on https://bczsalba.github.io/pytermgui/pytermgui.html, but at some point in the future it will get its own domain. Most of the things on there should be correct & working, but if you find something that isn't don't hesitate to let me know.

Screenshot 2022-01-02 at 21 07 42

With that being said, I wish everyone reading a Happy New Year! Thank you to everyone that has followed this journey so far, and sorry for the amount of time it took to get here.

Ok, bye 🚀

v0.4.1: Granular key & mouse handling

12 Sep 11:09
Compare
Choose a tag to compare

This release brings some more granularity to input handling for the Widget class.

Overview

  • New Widget.handle_mouse
  • New Widget.handle_key
  • New Slider widget
  • Rethink Widget selection system

Details

Widget.handle_mouse(MouseEvent, MouseTarget) -> bool, Widget.handle_key(str) -> bool

  • These method should be called by the higher level implementation (HLI) after bindings are handled.
  • A return of True means the event has been handled, and the HLI should move onto the next one.

Widget selection system

  • The old system was based on a static dict of "selectable" items, which was messy and hard to understand
  • This dict exists in a new form, a list[tuple[Widget, i]] which is generated every time it is required, allowing for variable selectables_length values
  • This is mostly a backend change, but it allows for a lot more customization.

End result

slider demo

ok, bye 🚀

v0.4.0: Better managed WindowManager

05 Sep 20:25
Compare
Choose a tag to compare

Overview

This version focuses on the window_manager submodule, and aims to be the final release before v1.0.0.

  • Improve mouse event API

    • Regex based mouse-code parsing
    • Decouple mouse clicking from finding mouse target
  • Rewrite window_manager

    • Frame-based, lazy renderer
    • Inactive window caching
    • Multi-threading

Details

New mouse event API

  • Instead of Widget.click(), a MouseTarget can be acquired using Widget.get_target()
  • This allows finding a Widget target without implicitly calling its click() method

New window_manager

  • The old version was a weekend-project with not much thoughtful structure behind it
  • This version aims to be a fully integrated part of pytermgui, and the easiest starting point for usage of the module
  • The frame-based rendering currently defaults to 300 fps, the inaccuracy of time.sleep() messes with low framerates
  • The main thread handles input, while the secondary thread does all the printing:
    • Main thread: WindowManager.process_input()
    • Side thread: WindowManager._start_display_loop/_loop()
  • Windows can tell the WM to print by returning True in their bind() callbacks
  • For now, all input is handled globally by WindowManager. This is likely to change in the future.

End result

Nothing visual has changed in this patch, so have this nice screenshot of me testing ptg:

ptg test

ok, bye 🚀