[x] Expected Behavior
When using progress bar and 'show_time_remaining':True, console lines not matching the progress_regex should be ignored and not affect the time remaining display based on last matching progress update.
[x] Actual Behavior
Console lines not matching the progress_regex cause the time remaining to disappear until the next matching line.
[x] A minimal code example
[x] Screenshot (if visual quirk)
[x] Anything else you may think will be helpful
Minimal code example
from time import sleep
from gooey import Gooey, GooeyParser
from itertools import cycle
@Gooey(
terminal_font_family='Courier New',
progress_regex=r"^progress: (?P<current>-?\d+)/(?P<total>\d+)$",
progress_expr="current / total * 100",
timing_options={
'show_time_remaining':True,
'hide_time_remaining_on_complete':False
})
def parse_args():
parser = GooeyParser(prog="example_progress_bar_5")
parser.add_argument("alpha", type=float, help="Seconds per 10% progress", default=1)
parser.add_argument("beta", type=int, help="Extra messages between progress updates",default=3)
parser.add_argument("gamma", type=str, nargs='+', help="List of your messages",
default=["info ...", "message ...", "warning ..."])
args = parser.parse_args()
return args.alpha, args.beta, args.gamma
def main():
alpha, beta, gamma = parse_args()
myprocess = cycle(gamma)
print("Step 1")
for i in range(0, 51, 10):
sleep(alpha)
print("progress: {}/{}".format(i,100),flush=True)
print("Step 2")
for i in range(50, 101, 10):
sleep(alpha / (beta+1))
for j in range(beta):
# some extra text before progress
print(next(myprocess),flush=True)
sleep(alpha / (beta+1))
print("progress: {}/{}".format(i,100),flush=True)
if __name__ == "__main__":
main()
Screenshots
What
Screenshot
Console
Progress bar during step 1 (progress messages only)
Progress bar during step 2 (progress messages and other messages)
'show_time_remaining':True
, console lines not matching theprogress_regex
should be ignored and not affect the time remaining display based on last matching progress update.progress_regex
cause the time remaining to disappear until the next matching line.Minimal code example
Screenshots
Relevant excerpts
ProcessController
https://github.com/chriskiehl/Gooey/blob/be4b11b8f27f500e7326711641755ad44576d408/gooey/gui/processor.py#L114-L129
https://github.com/chriskiehl/Gooey/blob/a451f5265a405951be367217ef8363bf88a46176/gooey/gui/processor.py#L152-L162
Timing
https://github.com/chriskiehl/Gooey/blob/a451f5265a405951be367217ef8363bf88a46176/gooey/gui/util/time.py#L19-L25
Suggested fix
Update gooey/gui/util/time.py: