Esempio n. 1
0
def setup():
    '''
    master setup function

    * editor selection
    * publishing toggle
    * publish/unpublish as needed
    * directory selection

    TODO: break this out better?
    '''

    global SETTINGS

    print("\n\ttext editor:\t" + SETTINGS.get("editor"))
    if core.publishing():
        print("\tpublish dir:\t" +
              os.path.join(PUBLIC, str(SETTINGS.get("publish dir"))))
    print("\tpubishing:\t" + str(SETTINGS.get("publishing")) + "\n")

    # editor selection
    SETTINGS.update({"editor": select_editor()})
    redraw("text editor set to: " + SETTINGS["editor"])

    # publishing selection
    SETTINGS.update({"publishing": select_publishing()})
    core.reload_ttbprc(SETTINGS)
    update_publishing()
    redraw("blog publishing: " + str(core.publishing()))

    if core.publishing():
        print("publish directory: ~" + USER + "/public_html/" +
              SETTINGS.get("publish dir"))

    # save settings
    ttbprc = open(TTBPRC, "w")
    ttbprc.write(
        json.dumps(SETTINGS, sort_keys=True, indent=2, separators=(',', ':')))
    ttbprc.close()

    raw_input("\nyou're all good to go, " + chatter.say("friend") +
              "! hit <enter> to continue.\n\n")
    redraw()

    return SETTINGS
Esempio n. 2
0
def setup():
    '''
    master setup function

    * editor selection
    * publishing toggle
    * publish/unpublish as needed
    * directory selection

    TODO: break this out better?
    '''

    global SETTINGS

    print("\n\ttext editor:\t" +SETTINGS.get("editor"))
    if core.publishing():
        print("\tpublish dir:\t" +os.path.join(PUBLIC, str(SETTINGS.get("publish dir"))))
    print("\tpubishing:\t"+str(SETTINGS.get("publishing"))+"\n")

    # editor selection
    SETTINGS.update({"editor": select_editor()})
    redraw("text editor set to: "+SETTINGS["editor"])

    # publishing selection
    SETTINGS.update({"publishing":select_publishing()})
    core.reload_ttbprc(SETTINGS)
    update_publishing()
    redraw("blog publishing: "+str(core.publishing()))

    if core.publishing():
        print("publish directory: ~"+USER+"/public_html/"+SETTINGS.get("publish dir"))

    # save settings
    ttbprc = open(TTBPRC, "w")
    ttbprc.write(json.dumps(SETTINGS, sort_keys=True, indent=2, separators=(',',':')))
    ttbprc.close()

    raw_input("\nyou're all good to go, "+chatter.say("friend")+"! hit <enter> to continue.\n\n")
    redraw()

    return SETTINGS