Files: d40d4eb7917990aa2e886b6827155eef378f567d / asanas / intention.py
2254 bytesRaw
1 | import sys |
2 | import configparser |
3 | from asanas import intertwingled |
4 | from components import * |
5 | |
6 | config = configparser.ConfigParser() |
7 | kriya_title = None |
8 | |
9 | def summon_kriya(routine): |
10 | config.read(routine) |
11 | for section in config.sections(): |
12 | global kriya_title |
13 | kriya_title = str(section) |
14 | |
15 | def heading(): |
16 | print("\n"+kriya_title) |
17 | print("="*len(kriya_title)+"\n") |
18 | |
19 | def poses(routine): |
20 | intertwingled.clear() |
21 | heading() |
22 | for component, energy in config.items(kriya_title): |
23 | if component == 'summary': |
24 | print(energy) |
25 | print("\nIn this kriya you will do:\n") |
26 | for component, energy in config.items(kriya_title): |
27 | if component != 'summary': |
28 | if component in ('sun salutation', 'second sun salutation'): |
29 | name = component.title() |
30 | if str(energy) != '1': |
31 | print(" "*8 + "{} for {} reps.".format(name, energy)) |
32 | else: |
33 | print(" " * 8 + "{} for {} rep.".format(name, energy)) |
34 | else: |
35 | name = component.title() |
36 | if str(energy) != '1': |
37 | print(" "*8 + "{} for {} minutes.".format(name, energy)) |
38 | else: |
39 | print(" "*8 + "{} for {} minute.".format(name, energy)) |
40 | print('\n'*10+'='*len(kriya_title)) |
41 | cont = input("Start your Kriya? [y/N] Or type 'help' to learn more\n> ").lower() |
42 | |
43 | if cont == 'n': |
44 | sys.exit() |
45 | elif cont in ('help','h','halp'): |
46 | help(routine) |
47 | else: |
48 | pass |
49 | |
50 | def help(routine): |
51 | intertwingled.clear() |
52 | heading() |
53 | for option in config.options(kriya_title): |
54 | if option != 'summary': |
55 | func = option.replace(" ","") |
56 | func_to_run = getattr(Components, func) |
57 | description = func_to_run.__doc__ |
58 | if description != None: |
59 | print(description) |
60 | else: |
61 | print("{}:\n No description available now.\n".format(option.title())) |
62 | print("\n" + "="*len(kriya_title) + "\n") |
63 | back_to_menu = input("Hit Enter to Return.") |
64 | if back_to_menu == "": |
65 | poses(routine) |
66 | |
67 | def main(routine): |
68 | summon_kriya(routine) |
69 | poses(routine) |
70 | |
71 | if __name__ == "__main__": |
72 | main(routine) |
73 |
Built with git-ssb-web