Skip to content

Add ability to supply custom start_time #232

@mueslo

Description

@mueslo

Description

When hooking onto an existing "real" progress after it starts, e.g. one already running for a while in a thread, some of the displayed widget values are wildly wrong. AdaptiveETA() seems to deal with this quickly and well, however, Timer() erroneously starts from 0, and therefore also FileTransferSpeed() is very wrong.

Expected functionality

This is would be the interface that would make sense.

t = Thread(target=worker_thread,args=(path, progress, result, abort), daemon=True)
start_time = datetime.now()
t.start()

yield/time.sleep(10)  # pause this function for a while

with pb.ProgressBar(max_value=fsize, max_error=False,
                    widgets=widgets, start_time=start_time) as bar:
    while t.is_alive():
        bar.update(progress.value)

Proposed fix

I'm not familiar with the codebase, but #233 seems to work, but I have not done any in-depth testing.

Versions

  • Python version: 3.8.3
  • Package version: 3.51.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions