summaryrefslogtreecommitdiff
path: root/asciifarm/client/gameclient.py
diff options
context:
space:
mode:
authortroido <troido@hotmail.com>2018-01-01 16:55:58 +0100
committertroido <troido@hotmail.com>2018-01-01 16:55:58 +0100
commit123edfd17cd9aa38d6d5e511a8c686d5d71ab140 (patch)
tree0272a145ad0200d1405c345947d0a80559f5d269 /asciifarm/client/gameclient.py
parent38f3a3807373a19cacc0171dd7d5fd11f44dbd35 (diff)
made keybindings readable from an actual file
Diffstat (limited to 'asciifarm/client/gameclient.py')
-rw-r--r--asciifarm/client/gameclient.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/asciifarm/client/gameclient.py b/asciifarm/client/gameclient.py
index 914d90c..0ab5fb5 100644
--- a/asciifarm/client/gameclient.py
+++ b/asciifarm/client/gameclient.py
@@ -13,12 +13,15 @@ import string
from .display.display import Display
import hy
-from . import keybindings as defaultkeybindings
-import importlib
+
+hywrapper = """\
+(do
+ (require [asciifarm.client.keymacros [*]])
+ {{ {} }})"""
class Client:
- def __init__(self, stdscr, display, name, connection, keybindings=None, logFile=None):
+ def __init__(self, stdscr, display, name, connection, keybindings, logFile=None):
self.stdscr = stdscr
self.display = display
self.name = name
@@ -26,11 +29,8 @@ class Client:
self.connection = connection
self.logFile = logFile
- keymodule = defaultkeybindings
- if keybindings:
- keymodule = importlib.import_module(keybindings)
- self.commands = keymodule.commands
- self.controlsString = keymodule.docs
+ self.commands = hy.eval(hy.read_str(hywrapper.format(keybindings)))
+ self.controlsString = self.commands.get("help", "")
self.display.showInfo(self.controlsString)