sjmikler / progress-table

Display progress as a pretty table in the command line.
MIT License
98 stars 3 forks source link

[FEATURE] Allow for progress character customization #10

Closed naddeoa closed 8 months ago

naddeoa commented 10 months ago

I'm currently using monkey patching to customize the appearance of the embedded progress bar

SymbolsUnicodeBare.embedded_pbar_filled = "-" 

It looks like there is a dataclass that defines Symbol, which could potentially just be accepted by the table constructor and used as an override for all of the symbols that are used.

There might be a little x-y problem here too. I was content using the default progress bar but I want my current row to be visible and that option is tangled up in the embedded progress bar atm. I would be content with the default embedded progress bar style but it's the same color as my tmux toolbar and it rubs right up against it which makes it barely visible. Having an empty line at the bottom of the table to separate the embedded progress bar wold probably also fix my issue.

Since I'm monkey patching anyway, I was going to use some cool symbols like , but that doesn't really work unless we can also specify separate symbols for the past progress vs the current head of the progress line, which would let you make nice progress bars like this

──────────╼
sjmikler commented 8 months ago

Starting at 1.0 symbols have been renamed to styles. You have the option now to customize them. Moreover, embedded_pbar_head was added.

See example:

from progress_table import ProgressTable

class CustomStyle:
    pbar_filled = "#"
    pbar_empty = "."
    embedded_pbar_filled = "-"
    embedded_pbar_head = ">"
    cell_overflow = "_"
    horizontal = "-"
    vertical = "|"
    all = "+"
    up_left = "+"
    up_right = "+"
    down_left = "+"
    down_right = "+"
    no_left = "+"
    no_right = "+"
    no_up = "+"
    no_down = "+"

table = ProgressTable(table_style=CustomStyle)

for i in range(10):
  table["aaa"] = 1
  table["bbb"] = 2
  table.next_row()
table.close()