(arr)
return choice
Main menu printer
        @param arr is the menu array to print.  Fetches input,
        parses and built-in command keywords, and returns the selected idx.
Main menu printer
Main menu printer
def print_menu(arr):
    global buffered
    """ Main menu printer
        @param arr is the menu array to print.  Fetches input,
        parses and built-in command keywords, and returns the selected idx.
    """

    if not buffered is None:
        # buffered input, return
        if len(buffered) > 0:
            return buffered.pop(0)
        else:
            buffered = None

    tmp = Cmd()
    arr = ['\t%s[%s%d%s] %s%s%s' % (color.B_GREEN, color.B_YELLOW, x + 1, color.B_GREEN,
                                    color.B_WHITE, arr[x], color.END) for x in xrange(len(arr))]
    tmp.columnize(arr, 100)
    print '\n' + color.B_YELLOW + '0' + color.B_GREEN + ')' + color.B_WHITE + ' Back' + color.END
    try:
        choice = raw_input(color.B_WHITE + '> ' + color.END)
        choice = check_opts(choice)

        # buffered input
        if choice > 1:
            choice = choice.split(' ')
            buffered = []
            for entry in choice[1:]:
                buffered.append(int(entry))
            choice = int(choice[0])
    except KeyboardInterrupt:
        choice = -1
    except Exception, e:
        debug(e)
        os.system('clear')
        choice = -1
    return choice
def print_menu ( arr ) : global buffered if not buffered is None : # buffered input, return if len ( buffered ) > 0 : return buffered . pop ( 0 ) else : buffered = None tmp = Cmd ( ) arr = [ '\t%s[%s%d%s] %s%s%s' % ( color . B_GREEN , color . B_YELLOW , x + 1 , color . B_GREEN , color . B_WHITE , arr [ x ] , color . END ) for x in xrange ( len ( arr ) ) ] tmp . columnize ( arr , 100 ) print '\n' + color . B_YELLOW + '0' + color . B_GREEN + ')' + color . B_WHITE + ' Back' + color . END try : choice = raw_input ( color . B_WHITE + '> ' + color . END ) choice = check_opts ( choice ) # buffered input if choice > 1 : choice = choice . split ( ' ' ) buffered = [ ] for entry in choice [ 1 : ] : buffered . append ( int ( entry ) ) choice = int ( choice [ 0 ] ) except KeyboardInterrupt : choice = - 1 except Exception , e : debug ( e ) os . system ( 'clear' ) choice = - 1 return choice