git ssb

1+

Zach! / kriya-helper



Tree: 85ac299f5e4fd1ab34c426ea9a93c6918536a160

Files: 85ac299f5e4fd1ab34c426ea9a93c6918536a160 / helper.py

2572 bytesRaw
1#! /usr/bin/env python3
2
3import time
4import os
5from sys import argv
6import configparser
7import collections
8
9from components import *
10from asanas import *
11import pyglet
12import menu_screen
13from transitions import *
14
15#Lists for Kriyas and where to find them
16kriya_dict = collections.OrderedDict()
17kriya_list = []
18routine = None
19
20def gather_kriyas():
21 global kriya_dict
22 global kriya_list
23 for file in os.listdir('kriyas'):
24 kriya = 'kriyas/{}'.format(file)
25 config = configparser.ConfigParser()
26 config.read(kriya)
27 for section in config.sections():
28 kriya_dict[section] = kriya
29 kriya_list.append(section)
30
31def kriya_choice(choice):
32 global routine
33 try:
34 option = int(choice)
35 key = kriya_list[option - 1]
36 routine = kriya_dict[key]
37 except:
38 routine = kriya_dict[choice]
39
40def menu():
41 ascii_art = """
42 _ _ _
43 | | | | (_)
44 ___| |__ ___ ___ ___ ___ _ _ ___ _ _ _ __ | | ___ __ _ _ _ __ _
45 / __| '_ \ / _ \ / _ \/ __|/ _ \ | | | |/ _ \| | | | '__| | |/ / '__| | | | |/ _` |
46 | (__| | | | (_) | (_) \__ \ __/ | |_| | (_) | |_| | | | <| | | | |_| | (_| |
47 \___|_| |_|\___/ \___/|___/\___| \__, |\___/ \__,_|_| |_|\_\_| |_|\__, |\__,_|
48 __/ | __/ |
49 |___/ |___/
50 """
51 intertwingled.clear()
52 print(ascii_art)
53 for number, kriya in enumerate(kriya_list, start=1):
54 print("{}) {}".format(number, kriya))
55 print("\n"+"="*30)
56 choice = input("Choose your Kriya! Either type in the number or write out the kriya!\n> ").title()
57 kriya_choice(choice)
58
59
60# Opening Screen, then move through the kriya
61def main():
62 gather_kriyas()
63 splashpage.main()
64 menu()
65 intention.main(routine)
66 settle.main()
67 kriya(routine)
68 closing_remark.main()
69
70def kriya(ini):
71 """Run through poses and duration from ini file"""
72 config = configparser.ConfigParser()
73 config.read(ini)
74 for section in config.sections():
75 kriya = str(section)
76 for pose, time in config.items(kriya):
77 if pose != 'summary':
78 func = pose.replace(" ","")
79 func_to_run = getattr(Components, func)
80 func_to_run(int(time))
81if __name__ == "__main__":
82 main()
83

Built with git-ssb-web