Add keybindings configuration in JSON and YAML formats; remove obsolete YAML file
This commit is contained in:
+10
-4
@@ -2,12 +2,18 @@
|
||||
# The key_pressed method is called when a key is pressed, and it contains the logic for handling different key presses.
|
||||
|
||||
import random
|
||||
import yaml
|
||||
import os
|
||||
import json
|
||||
|
||||
# read yaml config file
|
||||
bindings = {}
|
||||
with open("conf/keybindings.yaml", "r") as f:
|
||||
bindings = yaml.safe_load(f)
|
||||
if os.path.exists("conf/keybindings.json"):
|
||||
with open("conf/keybindings.json", "r") as f:
|
||||
bindings = json.load(f)
|
||||
else:
|
||||
import yaml
|
||||
# read yaml config file
|
||||
with open("conf/keybindings.yaml", "r") as f:
|
||||
bindings = yaml.safe_load(f)
|
||||
|
||||
class KeyBindings:
|
||||
def trigger(self, action):
|
||||
|
||||
Reference in New Issue
Block a user