diff options
Diffstat (limited to 'gui')
-rwxr-xr-x | gui/odr-dabmux-gui.py | 19 | ||||
-rw-r--r-- | gui/rcparam.json | 48 | ||||
-rw-r--r-- | gui/views/rcparam.tpl | 28 |
3 files changed, 85 insertions, 10 deletions
diff --git a/gui/odr-dabmux-gui.py b/gui/odr-dabmux-gui.py index 31f9588..df6b81f 100755 --- a/gui/odr-dabmux-gui.py +++ b/gui/odr-dabmux-gui.py @@ -29,7 +29,7 @@ from muxconfig import * from muxrc import * -from bottle import route, run, template, static_file, request +from bottle import * import json import argparse @@ -84,10 +84,19 @@ def rc_get(module, param): value = rc.get_param_value(module, param) + if param in paramObj: + paramList = paramObj[param] + label = paramObj["labels"][param] + else: + paramList = [] + label = "" + return template('rcparam', module = module, param = param, - value = value) + value = value, + label = label, + list = paramList) @route('/rc/<module>/<param>', method="POST") def rc_post(module, param): @@ -153,5 +162,9 @@ if __name__ == '__main__': rc = MuxRemoteControl(cli_args.mhost, cli_args.rcport) - run(host=cli_args.host, port=int(cli_args.port), debug=True, reloader=False) + # Import selectable paramaters values + paramFile = open("rcparam.json") + paramStr = paramFile.read() + paramObj = json.loads(paramStr) + run(host=cli_args.host, port=int(cli_args.port), debug=True, reloader=False) diff --git a/gui/rcparam.json b/gui/rcparam.json new file mode 100644 index 0000000..f350060 --- /dev/null +++ b/gui/rcparam.json @@ -0,0 +1,48 @@ +{
+ "labels": {
+ "buffermanagement":"Buffer management",
+ "ptysd":"Program-type mode",
+ "pty":"Program type"
+ },
+ "buffermanagement": [
+ {"value":"prebuffering", "desc":"prebuffering"},
+ {"value":"timestamped", "desc":"timestamped"}
+ ],
+ "ptysd": [
+ {"value":"dynamic", "desc":"dynamic"},
+ {"value":"static", "desc":"static"}
+ ],
+ "pty": [
+ {"value":"0", "desc":"None"},
+ {"value":"1", "desc":"News"},
+ {"value":"2", "desc":"Affairs"},
+ {"value":"3", "desc":"Info"},
+ {"value":"4", "desc":"Sport"},
+ {"value":"5", "desc":"Educate"},
+ {"value":"6", "desc":"Drama"},
+ {"value":"7", "desc":"Arts"},
+ {"value":"8", "desc":"Science"},
+ {"value":"9", "desc":"Talk"},
+ {"value":"10", "desc":"Pop"},
+ {"value":"11", "desc":"Rock"},
+ {"value":"12", "desc":"Easy"},
+ {"value":"13", "desc":"Light classics"},
+ {"value":"14", "desc":"Classics"},
+ {"value":"15", "desc":"Other music"},
+ {"value":"16", "desc":"Weather"},
+ {"value":"17", "desc":"Finance"},
+ {"value":"18", "desc":"Children"},
+ {"value":"19", "desc":"Factual"},
+ {"value":"20", "desc":"Religion"},
+ {"value":"21", "desc":"Phone in"},
+ {"value":"22", "desc":"Travel"},
+ {"value":"23", "desc":"Leisure"},
+ {"value":"24", "desc":"Jazz"},
+ {"value":"25", "desc":"Country"},
+ {"value":"26", "desc":"National music"},
+ {"value":"27", "desc":"Oldies"},
+ {"value":"28", "desc":"Folk"},
+ {"value":"29", "desc":"Document"}
+ ]
+ }
+
\ No newline at end of file diff --git a/gui/views/rcparam.tpl b/gui/views/rcparam.tpl index 3bf3e5c..c415d7a 100644 --- a/gui/views/rcparam.tpl +++ b/gui/views/rcparam.tpl @@ -9,17 +9,31 @@ <script type="text/javascript" src="/static/intercooler-1.0.1.min.js"></script> </head> - <body> - <h1 class="w3-container w3-blue-grey">Remote-Control of module {{module}}</h1> - <div class="w3-container"> - <form class="w3-container w3-card-4" ic-on-error="alert(str)" ic-post-to="/rc/{{module}}/{{param}}"> + <body class="w3-container"> + <h1 class="w3-blue-grey">Remote-Control: module {{module}}</h1> + <div class="w3-card-4"> + <form class="w3-container" ic-on-error="alert(str)" ic-post-to="/rc/{{module}}/{{param}}"> <p /> - <label>Parameter <b>{{param}}</b></label> - <input name="newvalue" type="text" value="{{value}}"> + % if (len(list) == 0): + <label>{{param}}:</label> + <input name="newvalue" type="text" value="{{value}}" autofocus> + % else: + <label>{{label}}:</label> + <select id="newvalue" name="newvalue"> + % for l in list: + % if (bytes(l["value"], 'utf-8') == value): + <option selected value={{l["value"]}}>{{l["desc"]}}</option> + % else: + <option value={{l["value"]}}>{{l["desc"]}}</option> + % end + % end + </select> + % end <p /> <button class="w3-button w3-blue-grey">Update</button> + <p /> </form> </div> </body> -</html> +</html>
\ No newline at end of file |