aegirhall / console-menu

A simple Python menu system for building terminal user interfaces.
MIT License
365 stars 58 forks source link

handle text wrapping within all sections of the menu #62

Closed MoralCode closed 2 years ago

MoralCode commented 2 years ago

Screenshot_20211106_215409

fixes #29

see the linked issue for some of the discussion on how this is accomplished. TL;DR if a list is returned by MenuItem.show(), it will be handles by an override of row in MenuItemsSection to generate one line of output for each item in the list.

MoralCode commented 2 years ago

Still needs:

MoralCode commented 2 years ago

i think this is nearly ready. its a little closer to a hack than a production grade solution so id like to get feedback from a maintainer about whether this fits with the console-menu architecture and what testing/documentation/linting standards are needed to merge to the main branch

MoralCode commented 2 years ago

made some updates including:

MoralCode commented 2 years ago

Screenshot_20211110_141111

heres a new screenshot to demo some of the new functionality, particularly the handling of user-provided newlines in any part of the menu (shown here in the prologue and menu items)

MoralCode commented 2 years ago

here is the gist used to test the newer features: https://gist.github.com/MoralCode/51859f5b7fc9aeebcb8f0b64d012fb24

MoralCode commented 2 years ago

@aegirhall I saw that #45 got merged.do you want me to take a crack at resolving these merge conflicts?

aegirhall commented 2 years ago

@MoralCode sure that would be great, thanks! -Aegir

MoralCode commented 2 years ago

wow that was easier than i thought. pretty much just a swap-in of ansiwrap instead of textwrap. my gist with sample code has been updated to demo the colors (i think, @mon may need to check that im using it right).

MoralCode commented 2 years ago

that 0 of 12 checks passed is mildly concerning...

aegirhall commented 2 years ago

It's fine... it was from some simple pycodestyle errors. I merged your PR and fixed the errors. All builds are passing now. Thanks!

gene1wood commented 2 years ago

Thanks @MoralCode !