import sys import configparser from asanas import intertwingled from components import * config = configparser.ConfigParser() kriya_title = None def summon_kriya(routine): config.read(routine) for section in config.sections(): global kriya_title kriya_title = str(section) def heading(): print("\n"+kriya_title) print("="*len(kriya_title)+"\n") def poses(routine): intertwingled.clear() heading() for component, energy in config.items(kriya_title): if component == 'summary': print(energy) print("\nIn this kriya you will do:\n") for component, energy in config.items(kriya_title): if component != 'summary': if component in ('sun salutation', 'second sun salutation'): name = component.title() if str(energy) != '1': print(" "*8 + "{} for {} reps.".format(name, energy)) else: print(" " * 8 + "{} for {} rep.".format(name, energy)) else: name = component.title() if str(energy) != '1': print(" "*8 + "{} for {} minutes.".format(name, energy)) else: print(" "*8 + "{} for {} minute.".format(name, energy)) print('\n'*10+'='*len(kriya_title)) cont = input("Start your Kriya? [y/N] Or type 'help' to learn more\n> ").lower() if cont == 'n': sys.exit() elif cont in ('help','h','halp'): help(routine) else: pass def help(routine): intertwingled.clear() heading() for option in config.options(kriya_title): if option != 'summary': func = option.replace(" ","") func_to_run = getattr(Components, func) description = func_to_run.__doc__ if description != None: print(description) else: print("{}:\n No description available now.\n".format(option.title())) print("\n" + "="*len(kriya_title) + "\n") back_to_menu = input("Hit Enter to Return.") if back_to_menu == "": poses(routine) def main(routine): summon_kriya(routine) poses(routine) if __name__ == "__main__": main(routine)