pyout / pyout

Terminal styling for structured data
MIT License
3 stars 4 forks source link

summary line is not drawn/updated if last records aren't "complete"? #82

Open yarikoptic opened 5 years ago

yarikoptic commented 5 years ago

see http://www.onerussian.com/tmp/screencast-pyout-blinging-summary.webm

datalad as of 0.11.3-110-ge536b2cc (from https://github.com/datalad/datalad/pull/2126) and pyout 0.4.0. When dataset is not installed I am not providing a full record (I believe), and then summary line is not (re)drawn at all.

Also in general summary line "blinks". I guess it gets first removed on the way "up", instead of just a line being removed when a new line is are about to be printed. This could make the whole display less "blinking" (or was that that Ukrainian pepper vodka effect?)

kyleam commented 5 years ago

summary line is not drawn/updated if last records aren't "complete"?

My guess is that the summary is redrawn, but the next row comes in too quick to see the summary. I can at least say that the summary lines for incomplete rows are not consistently not drawn, and I can't think of a situation that would prevent drawing them for incomplete rows. See minimal example at end.

Also in general summary line "blinks". I guess it gets first removed on the way "up", instead of just a line being removed when a new line is are about to be printed.

I think you're right that it gets removed before going up, and visually it'd probably be better to do it after. Off hand, I'm not sure if it removes the summary before because it made the logic simpler or just because I didn't think about it. I'll have to look into it.

This situation should also be improved by waiting for callbacks before going offscreen: #74.

example ```python import itertools import random import string import time from pyout import Tabular def delayed(x, value): def fn(): time.sleep(x) return value return fn rows = [{"name": "".join(xs), "status": delayed(random.randint(1, 3), "ok")} for xs in itertools.combinations(string.ascii_lowercase, 2)] out = Tabular(["name", "status"], style={"status": {"aggregate": lambda xs: "Total: {:d}".format(len(xs))}}) with out: for row in rows: if row["name"] == "az": time.sleep(3) out(row) ```
yarikoptic commented 3 years ago

I wonder if I am experiencing the same issue -- summary line is barely ever visible since seems there is always some new "incomplete" record appearing: http://www.onerussian.com/tmp/Screencast_from_03-25-2021_03_57_46_PM.webm with pyout 0.7.0 (currently latest release)