")
+ return header
+
def setup_handler():
print("\nyour ttbp configuration doesn't look right. let's make you a fresh copy.\n\n")
try:
@@ -125,23 +149,25 @@ def setup():
choice = raw_input("\nplease pick a number from the list: ")
SETTINGS["editor"] = EDITORS[int(choice)]
- print("\ntext editor set to >"+SETTINGS["editor"])
+ redraw("text editor set to: "+SETTINGS["editor"])
# publish directory selection
- choice = raw_input("\n\nwhere do you want your blog published? (leave blank to use default \"blog\") ")
+ if SETTINGS["publish dir"]:
+ print("\tcurrent publish dir:\t"+os.path.join(PUBLIC, SETTINGS["publish dir"])+"\n\n")
+ choice = raw_input("\nwhere do you want your blog published? (leave blank to use default \"blog\") ")
if not choice:
choice = "blog"
- publishing = os.path.join("/home", USER, "public_html", choice)
+ publishing = os.path.join(PUBLIC, choice)
while os.path.exists(publishing):
second = raw_input("\n"+publishing+" already exists!\nif you're sure you want to use it, hit to confirm. otherwise, pick another location: ")
if second == "":
break
choice = second
- publishing = os.path.join("/home", USER, "public_html", choice)
+ publishing = os.path.join(PUBLIC, choice)
SETTINGS["publish dir"] = choice
-
+
# set up publish directory
if not os.path.exists(publishing):
subprocess.call(["mkdir", publishing])
@@ -152,15 +178,13 @@ def setup():
if os.path.exists(WWW):
subprocess.call(["rm", WWW])
subprocess.call(["ln", "-s", publishing, WWW])
- print("\npublishing to "+LIVE+USER+"/"+SETTINGS["publish dir"]+"/\n\n")
+ print("\n\tpublishing to "+LIVE+USER+"/"+SETTINGS["publish dir"]+"/\n\n")
# 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 to continue.")
-
return SETTINGS
## menus
@@ -181,11 +205,11 @@ def main_menu():
#print(BANNER)
#redraw()
menuOptions = [
- "record feelings",
- "check out neighbors",
+ "record feelings",
+ "(wip) check out neighbors",
"change settings",
"send feedback",
- "see credits"]
+ "(wip) see credits"]
#print(SPACER)
print("you're at ttbp home. remember, you can always press to come back here.\n\n")
print_menu(menuOptions)
@@ -204,7 +228,13 @@ def main_menu():
elif choice == '1':
redraw(DUST)
elif choice == '2':
- redraw(DUST)
+ pretty_settings = "\n\ttext editor:\t" +SETTINGS["editor"]
+ pretty_settings += "\n\tpublish dir:\t" +os.path.join(PUBLIC, SETTINGS["publish dir"])
+
+ redraw("now changing your settings. press if you didn't mean to do this.\n\ncurrent settings "+pretty_settings+"\n")
+ setup()
+ raw_input("\nyou're all good to go, "+chatter.say("friend")+"! hit to continue.\n\n")
+ redraw()
elif choice == '3':
redraw()
feedback_menu()
@@ -238,7 +268,7 @@ def feedback_menu():
def write_entry(entry=os.path.join(DATA, "test.txt")):
- raw_input("\nfeelings will be recorded for today, "+time.strftime("%d %B %Y")+".\n\nif you've already started recording feelings for this day, you \ncan pick up where you left off.\n\npress to begin recording your feelings.\n\n")
+ raw_input("\nfeelings will be recorded for today, "+time.strftime("%d %B %Y")+".\n\nif you've already started recording feelings for this day, you \ncan pick up where you left off.\n\npress to begin recording your feelings.\n\n")
subprocess.call([SETTINGS["editor"], entry])
core.load_files()
core.write("index.html")
@@ -255,7 +285,8 @@ def send_feedback(subject="none", mailbox=os.path.join(FEEDBACK, USER+"-"+str(in
outfile = open(mailbox, 'w')
outfile.write("from:\t\t~"+USER+"\n")
- outfile.write("subject:\t"+subject+"\n\n")
+ outfile.write("subject:\t"+subject+"\n")
+ outfile.write("date:\t"+time.stfrtime("%d %B %y")+"\n")
outfile.write(mail)
outfile.close()