Example #1
0
from Recipe import Recipe


while True:
    tc.create_header("RocketFuelManager ver 1.0", clearterm=True)
    calcorread = input(" What can I help you with? [C]alculate a new recipe or [L]oad an old one?: ")
    if calcorread.capitalize() == "C":
        # Calculate a new recipe
        newrecipe = Recipe()
        newrecipe.cooktodict()
        newrecipe.createprettyprint(excludenotes=True)
        newrecipe.prettyprintrecipe(indent=28, newlines=2)
        saveornot = input("\n\n               Want to save? [Y]es or [N]o?: ")
        if saveornot[0].capitalize() == "Y":
            # Save data
            newrecipe.createsavedata()
            cookbookorsingle = input("\n     [A]dd to Cookbook, [e]xport or [b]oth?: ")
            if cookbookorsingle.capitalize() == "A":
                newrecipe.writetofile(singlefile=False)
            elif cookbookorsingle.capitalize() == "E":
                newrecipe.writetofile(singlefile=True)
            elif cookbookorsingle.capitalize() == "B":
                newrecipe.writetofile(singlefile=False)
                newrecipe.writetofile(singlefile=True)

    elif calcorread.capitalize() == "L":
        singleorcookbook = input("\n   Load a [s]ingle file or from [C]ookbook?: ")
        if singleorcookbook.capitalize() == "S":
            # Load from single file
            name = input("\n        Enter the name of your .recipe file: ")
            loadrecipe = Recipe(loadfromfile=True, singlefile=True, identifier=name, searchbydate=False)