From 852665779c24880e97c1a560e8f19a11f2ee28a3 Mon Sep 17 00:00:00 2001 From: Robin ALEXANDER Date: Thu, 3 Feb 2022 10:55:20 +0100 Subject: Introduce selectable values for ad-hoc parameters --- gui/odr-dabmux-gui.py | 19 ++++++++++++++++--- gui/rcparam.json | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ gui/views/rcparam.tpl | 28 +++++++++++++++++++++------- 3 files changed, 85 insertions(+), 10 deletions(-) create mode 100644 gui/rcparam.json (limited to 'gui') 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//', 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 @@ - -

Remote-Control of module {{module}}

-
-
+ +

Remote-Control: module {{module}}

+
+

- - + % if (len(list) == 0): + + + % else: + + + % end

+

- + \ No newline at end of file -- cgit v1.2.3