Пример #1
0
def view_feed():
    '''
    generate and display list of most recent global entries
    '''

    feedList = []

    for townie in core.find_ttbps():
        entryDir = os.path.join("/home", townie, ".ttbp", "entries")
        filenames = os.listdir(entryDir)

        for entry in filenames:
            if core.valid(entry):
                feedList.append(os.path.join(entryDir, entry))

    metas = core.meta(feedList)
    metas.sort(key = lambda entry:entry[3])
    metas.reverse()

    entries = []
    for entry in metas[0:10]:
        pad = ""
        if len(entry[5]) < 8:
            pad = "\t"

        entries.append("~"+entry[5]+pad+"\ton "+entry[3]+" ("+p.no("word", entry[2])+") ")

    list_entries(metas, entries, "most recent global entries: \n\n")

    redraw()

    return
Пример #2
0
def view_feed():
    '''
    generate and display list of most recent global entries
    '''

    feedList = []

    for townie in core.find_ttbps():
        entryDir = os.path.join("/home", townie, ".ttbp", "entries")
        filenames = os.listdir(entryDir)

        for entry in filenames:
            if core.valid(entry):
                feedList.append(os.path.join(entryDir, entry))

    metas = core.meta(feedList)
    metas.sort(key = lambda entry:entry[3])
    metas.reverse()

    entries = []
    for entry in metas[0:10]:
        pad = ""
        if len(entry[5]) < 8:
            pad = "\t"

        entries.append("~"+entry[5]+pad+"\ton "+entry[3]+" ("+p.no("word", entry[2])+") ")

    list_entries(metas, entries, "most recent global entries:")

    redraw()

    return
Пример #3
0
def main_menu():
    '''
    main navigation menu
    '''

    menuOptions = [
            "record your feels",
            "review your feels",
            "check out your neighbors",
            "browse global feels",
            "scribble some graffiti\t(new!)",
            "change your settings",
            "send some feedback",
            "see credits",
            "read documentation"]

    print("you're at ttbp home. remember, you can always press <ctrl-c> to come back here.\n\n")
    util.print_menu(menuOptions, RAINBOW)

    try:
        choice = raw_input("\ntell me about your feels (or 'quit' to exit): ")
    except KeyboardInterrupt:
        redraw(EJECT)
        return main_menu()

    if choice == '0':
        redraw()
        today = time.strftime("%Y%m%d")
        write_entry(os.path.join(DATA, today+".txt"))
        core.www_neighbors()
    elif choice == '1':
        redraw("your recorded feels, listed by date:\n")
        view_feels(USER)
    elif choice == '2':
        users = core.find_ttbps()
        redraw("the following "+p.no("user", len(users))+" "+p.plural("is", len(users))+" recording feels on ttbp:\n")
        view_neighbors(users)
    elif choice == '3':
        redraw("most recent global entries\n")
        view_feed()
    elif choice == '4':
        graffiti_handler()
    elif choice == '5':
        redraw("now changing your settings. press <ctrl-c> if you didn't mean to do this.")
        try:
            core.load(setup()) # reload settings to core
        except KeyboardInterrupt():
            redraw(EJECT)
        redraw()
    elif choice == '6':
        redraw("you're about to send mail to ~endorphant about ttbp\n")
        feedback_menu()
    elif choice == '7':
        redraw()
        show_credits()
    elif choice == '8':
        subprocess.call(["lynx", os.path.join(SOURCE, "..", "README.html")])
        redraw()
    elif choice in QUITS:
        return stop()
    else:
        redraw(INVALID)

    return main_menu()
Пример #4
0
def main_menu():
    '''
    main navigation menu
    '''

    menuOptions = [
            "record your feels",
            "review your feels",
            "check out your neighbors",
            "browse global feels",
            "scribble some graffiti\t(new!)",
            "change your settings",
            "send some feedback",
            "see credits",
            "read documentation"]

    print("you're at ttbp home. remember, you can always press <ctrl-c> to come back here.\n")
    util.print_menu(menuOptions, RAINBOW)

    try:
        choice = raw_input("\ntell me about your feels (or 'quit' to exit): ")
    except KeyboardInterrupt:
        redraw(EJECT)
        return main_menu()

    if choice == '0':
        redraw()
        today = time.strftime("%Y%m%d")
        write_entry(os.path.join(DATA, today+".txt"))
        core.www_neighbors()
    elif choice == '1':
        if core.publishing():
            intro = "here are some options for reviewing your feels:"
            redraw(intro)
            review_menu(intro)
            core.load_files()
            core.write("index.html")
        else:
            redraw("your recorded feels, listed by date:")
            view_feels(USER)
    elif choice == '2':
        users = core.find_ttbps()
        redraw("the following "+p.no("user", len(users))+" "+p.plural("is", len(users))+" recording feels on ttbp:")
        view_neighbors(users)
    elif choice == '3':
        redraw("most recent global entries")
        view_feed()
    elif choice == '4':
        graffiti_handler()
    elif choice == '5':
        redraw("now changing your settings. press <ctrl-c> if you didn't mean to do this.")
        try:
            core.load(setup()) # reload settings to core
        except KeyboardInterrupt():
            redraw(EJECT)
        redraw()
    elif choice == '6':
        redraw("you're about to send mail to ~endorphant about ttbp")
        feedback_menu()
    elif choice == '7':
        redraw()
        show_credits()
    elif choice == '8':
        subprocess.call(["lynx", os.path.join(SOURCE, "..", "README.html")])
        redraw()
    elif choice in QUITS:
        return stop()
    else:
        redraw(INVALID)

    return main_menu()