def example29(): widgets = ['Test: ', Percentage(), ' | ', ETA(), ' | ', AbsoluteETA()] pbar = ProgressBar(widgets=widgets, maxval=500).start() for i in range(500): time.sleep(0.01) pbar.update(i + 1) pbar.finish()
def progressbar(value, isFinish=False): # global PBAR MAXVAL=100 EVENT="UPDATE REPO 1" WIDGETS = ['%s: '%(EVENT), Percentage(), ' | ', ETA(), ' | ', AbsoluteETA()] PBAR = ProgressBar(widgets=WIDGETS, maxval=MAXVAL).start() n_progress = 1 while 1: if not SCAN_FINISHED: if not n_progress == 100: PBAR.update(n_progress) n_progress+=1 else: PBAR.update(0) n_progress = 0 else: PBAR.finish() break
next_button.click() except NoSuchElementException: sys.stderr.write("Next button not found (are we done?)\n") fails += 1 if fails == 3: sys.stdout.write("Stopping here... 🏁") sys.exit() pass # Wait time between next image. We may multiple that time # every 'n' image. if i % WAIT_EXTRALONG_EACH_IMAGE == 0: wait = choice(range(*WAIT_RANGE_EXTRALONG)) sys.stdout.write(f"Waiting {wait}s (extra long)\n") else: wait = choice(range(*WAIT_RANGE)) sys.stdout.write(f"Waiting {wait}s\n") # Split wait time by 100 and display its progress for j in progressbar(range(100), widgets=[Bar(), AbsoluteETA()]): sleep(wait / 100) sys.stdout.write("\n") except Exception as e: import ipdb, os os.system("stty sane") ipdb.set_trace()
from debug2 import debug import traceback import configset import pm import vping import socket import sendgrowl from multiprocessing.pool import ThreadPool from progressbar import AnimatedMarker, Bar, BouncingBar, Counter, ETA, \ FileTransferSpeed, FormatLabel, Percentage, \ ProgressBar, ReverseBar, RotatingMarker, \ SimpleProgress, Timer, AdaptiveETA, AbsoluteETA, AdaptiveTransferSpeed MAXVAL=100 EVENT="UPDATE REPO" WIDGETS = ['%s: '%(EVENT), Percentage(), ' | ', ETA(), ' | ', AbsoluteETA()] PBAR = ProgressBar(widgets=WIDGETS, maxval=MAXVAL) PID = os.getpid() PACKAGES = '' PACKAGE_LOCALSTORAGE = '' SCAN_FINISHED = False config = configset.configset() config.configname = 'lfd.ini' class_pm = pm.pm() class ThreadedHTTPServer(ThreadingMixIn, HTTPServer): pass class S(BaseHTTPRequestHandler):