Beispiel #1
0
def rustspinnertest(ui, loops):
    loops = int(loops)

    with rustprogress.spinner(ui, "progress spinner test") as prog:
        for i in range(loops + 1):
            progress.getengine().pump(_faketime.increment())
            prog.set_message("loop %d" % (i + 1))
Beispiel #2
0
def progresstest(ui, loops, total, **opts):
    loops = int(loops)
    total = int(total)
    if total == -1:
        total = None
    nested = opts.get("nested", None)
    useunicode = opts.get("unicode", False)
    if useunicode:
        topic = pycompat.ensurestr(u"\u3042\u3044\u3046\u3048")
    else:
        topic = "progress test"
    with progress.bar(ui, topic, "cycles", total) as prog:
        for i in range(loops + 1):
            if useunicode:
                prog.value = (i, unicodeloopitems[i % len(unicodeloopitems)])
            else:
                prog.value = (i, "loop %s" % i)
            progress.getengine().pump(_faketime.increment())
            if nested:
                nestedtotal = 5 if i % 6 == 5 else 2
                with progress.bar(ui, "nested progress",
                                  total=nestedtotal) as nestedprog:
                    for j in range(nestedtotal + 1):
                        nestedprog.value = (j, "nest %s" % j)
                        progress.getengine().pump(_faketime.increment())
Beispiel #3
0
    class syncengine(progress.getengine().__class__):
        def _activate(self, ui):
            pass

        def _deactivate(self):
            pass

        def pump(self, now):
            self._recalculatedisplay(now)
            self._updateestimation(now)
            self._show(now)
Beispiel #4
0
def rustbytesprogresstest(ui):
    values = [
        0,
        10,
        250,
        999,
        1000,
        1024,
        22000,
        1048576,
        1474560,
        123456789,
        555555555,
        1000000000,
        1111111111,
    ]
    with rustprogress.bar(ui, "bytes test", max(values), "bytes") as prog:
        for i, value in enumerate(values):
            prog.set(value)
            prog.set_message("loop %d" % (i + 1))
            progress.getengine().pump(_faketime.increment())
Beispiel #5
0
def rustprogresstest(ui, loops, total):
    loops = int(loops)
    total = int(total)

    if total == -1:
        total = None
        halfway = None
    else:
        # We will update the total halfway through.
        halfway = total / 2

    with rustprogress.bar(ui, "progress bar test", halfway, "cycles") as prog:
        for i in range(loops + 1):
            # Test updating the total.
            if prog.total() == i - 1:
                prog.set_total(total)

            progress.getengine().pump(_faketime.increment())

            prog.increment(1)
            pos = prog.position()
            prog.set_message("loop %d" % pos)
Beispiel #6
0
def bytesprogresstest(ui):
    values = [
        0,
        10,
        250,
        999,
        1000,
        1024,
        22000,
        1048576,
        1474560,
        123456789,
        555555555,
        1000000000,
        1111111111,
    ]
    with progress.bar(ui,
                      "bytes progress test",
                      "bytes",
                      max(values),
                      formatfunc=util.bytecount) as prog:
        for value in values:
            prog.value = (value, "%s bytes" % value)
            progress.getengine().pump(_faketime.increment())
Beispiel #7
0
def syncrender():
    progress.getengine().pump(_faketime.increment())
    bindings.progress.render.step()