diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-09-09 09:08:47 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-09-09 09:08:47 +0200 |
commit | 9c2e691744f96ae7ace8b82385b080ee9d858906 (patch) | |
tree | 2092c3707c23052c33de52c523e492c900951b13 /gui | |
parent | 716b3d84adaaa36c9dd8652ec43fc88e760da611 (diff) | |
download | dabmux-9c2e691744f96ae7ace8b82385b080ee9d858906.tar.gz dabmux-9c2e691744f96ae7ace8b82385b080ee9d858906.tar.bz2 dabmux-9c2e691744f96ae7ace8b82385b080ee9d858906.zip |
GUI: fix RC interface that uses json now
Diffstat (limited to 'gui')
-rw-r--r-- | gui/muxrc.py | 19 | ||||
-rw-r--r-- | gui/views/rcparam.tpl | 6 |
2 files changed, 14 insertions, 11 deletions
diff --git a/gui/muxrc.py b/gui/muxrc.py index 3bda046..7f28f54 100644 --- a/gui/muxrc.py +++ b/gui/muxrc.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (C) 2016 +# Copyright (C) 2019 # Matthias P. Braendli, matthias.braendli@mpb.li # # http://www.opendigitalradio.org @@ -56,7 +56,7 @@ class MuxRemoteControl(object): f = zmq.SNDMORE print("Send {} {}".format(i, part)) - sock.send(part, flags=f) + sock.send(part.encode(), flags=f) print("Poll") @@ -73,16 +73,19 @@ class MuxRemoteControl(object): def load(self): """Load the list of RC modules""" - module_names = self.zRead([b'list']) + module_jsons = self.zRead(['list']) self.module_list = [] - for name in module_names: + for module_json in module_jsons: + module = json.loads(module_json) + name = module['name'] mod = RCModule(name) - module_params = self.zRead([b'show', name]) + module_params = self.zRead(['show', name]) + print("m_p", module_params) for param in module_params: - p, v = param.split(': ') + p, v = param.split(b': ') mod.parameters.append(RCParameter(p, v)) self.module_list.append(mod) @@ -91,14 +94,14 @@ class MuxRemoteControl(object): return self.module_list def get_param_value(self, module, param): - value = self.zRead([b'get', module, param]) + value = self.zRead(['get', module, param]) if value[0] == b'fail': raise ValueError("Error getting param: {}".format(value[1])) else: return value[0] def set_param_value(self, module, param, value): - ret = self.zRead([b'set', module, param, value]) + ret = self.zRead(['set', module, param, value]) if ret[0] == b'fail': raise ValueError("Error getting param: {}".format(ret[1])) diff --git a/gui/views/rcparam.tpl b/gui/views/rcparam.tpl index 955086b..5ae0e9e 100644 --- a/gui/views/rcparam.tpl +++ b/gui/views/rcparam.tpl @@ -1,15 +1,15 @@ <!DOCTYPE html> <html><head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>ODR-DabMux Configuration</title> - <link rel="stylesheet" href="/static/style.css" type="text/css" media="screen" charset="utf-8"/> + <link rel="stylesheet" href="/static/style.css" type="text/css" media="screen" charset="utf-8"/> <script type="text/javascript" src="/static/jquery-1.10.2.min.js"></script> <script type="text/javascript" src="/static/intercooler-1.0.1.min.js"></script> </head> <body> <h1>Remote-Control of module {{module}}</h1> - <form ic-post-to="/rc/{{module}}/{{param}}"> + <form ic-on-error="alert(str)" ic-post-to="/rc/{{module}}/{{param}}"> <div class="form-group"> <label>Parameter <i>{{param}}</i> value: </label> <input class="form-control" name="newvalue" type="text" value="{{value}}"> |