Example #1
0
def _run():
    if len(sys.argv) == 1:
        options = ["google.com"]
        host = options[0]
    else:
        options = sys.argv[1:]
        host = ""

    system = platform.system()
    if system == "Windows":
        it = windows_ping
    elif system == "Darwin":
        it = darwin_ping
    else:
        it = linux_ping

    width, height = get_terminal_size()
    for i in range(height):
        print(" ")

    for line in it(options):
        buff.appendleft(line)

        width, height = get_terminal_size()

        plotted = plot(width, height, buff, host)

        if winterm and system == "Windows":
            winterm.set_cursor_position((1, 1))
        if system == "Darwin":
            print("\033[%sA" % height)
        else:
            print(chr(27) + "[2J")

        print("\n".join(plotted.lines))
Example #2
0
def _run():
    if len(sys.argv) == 1:
        options = ["google.com"]
        host = options[0]
    else:
        options = sys.argv[1:]
        host = ""

    system = platform.system()
    if system == "Windows":
        it = windows_ping
    elif system == "Darwin":
        it = darwin_ping
    else:
        it = linux_ping

    for line in it(options):
        buff.appendleft(line)

        width, height = get_terminal_size()

        plotted = plot(width, height, buff, host)

        if winterm and system == "Windows":
            winterm.set_cursor_position((1, 1))
        else:
            print(chr(27) + "[2J")

        print("\n".join(plotted.lines))
Example #3
0
def _run():
    try:
        url = sys.argv[1]
    except IndexError:
        url = "google.com"

    if url == "--sim":
        it = _simulate
    else:
        system = platform.system()
        if system == "Windows":
            it = _windows
        elif system == "Darwin":
            it = _darwin
        else:
            it = _linux

    for ping in it(url):
        buff.appendleft(ping)
        if winterm:
            winterm.set_cursor_position((1, 1))
        else:
            os.system("cls" if platform.system() == "Windows" else "clear")
        width, height = get_terminal_size()
        c = plot(url, buff, width - 2, height - 2)
        print("\n".join(c.process_colors()))
Example #4
0
def _run():
    try:
        url = sys.argv[1]
    except IndexError:
        url = "google.com"

    if url == "--sim":
        it = _simulate
    else:
        system = platform.system()
        if system == "Windows":
            it = _windows
        elif system == "Darwin":
            it = _darwin
        else:
            it = _linux

    for ping in it(url):
        buff.appendleft(ping)
        if winterm:
            winterm.set_cursor_position((1, 1))
        else:
            os.system("cls" if platform.system() == "Windows" else "clear")
        width, height = get_terminal_size()
        c = plot(url, buff, width - 2, height - 2)
        print("\n".join(c.process_colors()))
Example #5
0
def draw(system, host):
    width, height = get_terminal_size()

    plotted = plot(width, height, buff, host)

    if winterm and system == "Windows":
        winterm.set_cursor_position((1, 1))
    if system == "Darwin":
        print("\033[%sA" % height)
    else:
        print(chr(27) + "[2J")

    print("\n".join(plotted.lines))
Example #6
0
def clear():
    width, height = get_terminal_size()
    for i in range(height):
        print(" ")