ttbp/bin/ttbp.py

59 lines
1.1 KiB
Python
Raw Normal View History

2016-04-30 03:17:06 +00:00
#!/usr/bin/python
2016-04-30 03:48:01 +00:00
#import core
2016-04-30 03:17:06 +00:00
import os
2016-04-30 03:48:01 +00:00
PATH = os.path.join("/home", "endorphant", "projects", "ttbp", "bin")
WWW = os.path.join(PATH, "..","www")
CONFIG = os.path.join(PATH, "config")
DATA = os.path.join(PATH, "..", "data")
2016-04-30 03:17:06 +00:00
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:48:01 +00:00
ans = raw_input("your feels (enter 'none' to quit): ")
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()
2016-04-30 03:48:01 +00:00
#####
start()