ttbp/bin/ttbp.py

54 lines
1006 B
Python
Raw Normal View History

2016-04-30 03:17:06 +00:00
#!/usr/bin/python
import core
import os
WWW = os.path.join("..","www")
CONFIG = os.path.join("config")
DATA = os.path.join("..", "data")
BANNER = open(os.path.join(CONFIG, "banner.txt")).read()
CLOSER = "\n\tsee you later, space cowboy..."
2016-04-30 03:34:43 +00:00
SPACER = "\n\n\n\n"
2016-04-30 03:17:06 +00:00
def start():
print(BANNER)
2016-04-30 03:34:43 +00:00
print(SPACER)
print(check_init())
2016-04-30 03:17:06 +00:00
try:
print(main_menu())
except ValueError or SyntaxError:
2016-04-30 03:34:43 +00:00
print("\n\noh no i didn't understand that")
2016-04-30 03:17:06 +00:00
print(main_menu())
except KeyboardInterrupt:
2016-04-30 03:34:43 +00:00
print("\n\neject button fired")
2016-04-30 03:17:06 +00:00
print(main_menu())
2016-04-30 03:34:43 +00:00
def stop():
return CLOSER
def check_init():
if os.path.exists(os.path.join(os.path.expanduser("~"),".ttbp")):
return "welcome back, friend"
else:
return init()
def init():
print(SPACER)
return "i don't recognize you, stranger. let's make friends."
2016-04-30 03:17:06 +00:00
def main_menu():
2016-04-30 03:34:43 +00:00
print(SPACER)
2016-04-30 03:17:06 +00:00
print("how are you feeling today? ")
2016-04-30 03:34:43 +00:00
ans = raw_input("your feels: ")
2016-04-30 03:17:06 +00:00
2016-04-30 03:34:43 +00:00
if ans == "none":
return stop()
else:
return main_menu()