-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathConfiguration.py
34 lines (28 loc) · 1.06 KB
/
Configuration.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import yaml
def get():
with open(r"config.yaml") as file:
configuration = yaml.load(file, Loader=yaml.FullLoader)
if configuration == None:
configuration = {}
configuration["reconnect_bt_addr"] = configuration.get("reconnect_bt_addr")
configuration["button_mapping"] = configuration.get(
"button_mapping",
{
"w": {"stick": "left", "input": "up"},
"a": {"stick": "left", "input": "left"},
"s": {"stick": "left", "input": "down"},
"d": {"stick": "left", "input": "right"},
"8": {"stick": "right", "input": "up"},
"4": {"stick": "right", "input": "left"},
"2": {"stick": "right", "input": "down"},
"6": {"stick": "right", "input": "right"},
"space": {"input": "a"},
"enter": {"input": "a"},
"backspace": {"input": "b"},
"n": {"input": "nfc"},
},
)
return configuration
def save(configuration):
with open(r"config.yaml", "w") as file:
yaml.dump(configuration, file)