Пример #1
0
def exec_menu(menu, choice):
    global printer_running

    os.system('cls')
    ch = choice.lower()
    if printer_running:
        stop_print_data()
        while printer_running:
            time.sleep(.1)
        os.system('cls')
    else:
        if ch == '':
            lputils.loge(TAG, "Invalid selection, please try again.")
        else:
            try:
                menu[ch]()
            except KeyError:
                lputils.loge(TAG, "Invalid selection, please try again.")
        return
Пример #2
0
def main():
    quit = False
    lputils.logd(TAG, "Connecting sensor")
    if not lpmsSensor.connect():
        lputils.loge(TAG, "Error connecting to sensor, terminating..")
        return

    lputils.logd(TAG, "Connected")
    print_data()

    while not quit:
        choice = raw_input(" >>  ")
        quit = True
    stop_print_data()

    lputils.logd(TAG, "Disconnecting sensor")
    lpmsSensor.disconnect()
    lputils.logd(TAG, "Disconnected")
    lputils.logd(TAG, "bye")