Example #1
0
def init():
    global ip
    global address
    global weather

    sys.stdout.write("Initalizing")
    sys.stdout.flush()

    ip = info.getIp()
    if ip == -1:
        ip = "Error"
    sys.stdout.write("..")
    sys.stdout.flush()

    address = info.ipToAddress(ip)
    if address == -1:
        address = "Error"
    sys.stdout.write("..")
    sys.stdout.flush()

    weather = info.addressToWeather(address)
    if weather == -1 or weather == -2:
        weather = "Error"
    sys.stdout.write("..\n")
    sys.stdout.flush()
Example #2
0
def init():
    global ip
    global address
    global weather

    sys.stdout.write("Initalizing")
    sys.stdout.flush()

    ip = info.getIp()
    if (ip == -1):
        ip = "Error"
    sys.stdout.write("..")
    sys.stdout.flush()

    address = info.ipToAddress(ip)
    if (address == -1):
        address = "Error"
    sys.stdout.write("..")
    sys.stdout.flush()

    weather = info.addressToWeather(address)
    if (weather == -1 or weather == -2):
        weather = "Error"
    sys.stdout.write("..\n")
    sys.stdout.flush()
Example #3
0
    init()

    while command != "q":
        title = colored("Dream ", "blue")
        hand = colored("> ", "blue")
        sys.stdout.write(title)
        sys.stdout.write(hand)
        sys.stdout.flush()
        command = raw_input()

        # ip
        if command == "ip":
            if ip != "Error":
                ip = colored(ip, "green", "on_blue")
            else:
                ip = info.getIp()
                if ip != -1:
                    ip = colored(ip, "green", "on_blue")
                else:
                    ip = colored("Error", "red", "on_blue")
            print ip

        # address
        if command == "address":
            if address != "Error":
                address = colored(address, "green", "on_blue")
            else:
                address = info.ipToAddress(info.getIp())
                if address != -1:
                    address = colored(address, "green", "on_blue")
                else:
Example #4
0
    init()

    while (command != "q"):
        title = colored('Dream ', 'blue')
        hand = colored('> ', 'blue')
        sys.stdout.write(title)
        sys.stdout.write(hand)
        sys.stdout.flush()
        command = raw_input()

        #ip
        if (command == "ip"):
            if (ip != "Error"):
                ip = colored(ip, 'green', 'on_blue')
            else:
                ip = info.getIp()
                if (ip != -1):
                    ip = colored(ip, 'green', 'on_blue')
                else:
                    ip = colored("Error", 'red', 'on_blue')
            print ip

        #address
        if (command == "address"):
            if (address != "Error"):
                address = colored(address, 'green', 'on_blue')
            else:
                address = info.ipToAddress(info.getIp())
                if (address != -1):
                    address = colored(address, 'green', 'on_blue')
                else: