diff --git a/htdocs/lib/settings/GainInput.js b/htdocs/lib/settings/GainInput.js new file mode 100644 index 0000000..31552bc --- /dev/null +++ b/htdocs/lib/settings/GainInput.js @@ -0,0 +1,22 @@ +$.fn.gainInput = function() { + this.each(function() { + var $container = $(this); + + var update = function(value){ + $container.find('.option').hide(); + $container.find('.option.' + value).show(); + } + + var $select = $container.find('select'); + $select.on('change', function(e) { + var value = $(e.target).val() + update(value); + if (value == 'auto') { + $input.val('auto'); + } else { + $input + } + }); + update($select.val()); + }); +} \ No newline at end of file diff --git a/htdocs/settings.js b/htdocs/settings.js index 1a76dbe..4a9903b 100644 --- a/htdocs/settings.js +++ b/htdocs/settings.js @@ -1,8 +1,8 @@ $(function(){ $('.map-input').mapInput(); - $('.sdrdevice').sdrdevice(); $('.imageupload').imageUpload(); $('.bookmarks').bookmarktable(); $('.wsjt-decoding-depths').wsjtDecodingDepthsInput(); $('#waterfall_scheme').waterfallDropdown(); + $('#rf_gain').gainInput(); }); \ No newline at end of file diff --git a/owrx/controllers/assets.py b/owrx/controllers/assets.py index 51343aa..f090fb6 100644 --- a/owrx/controllers/assets.py +++ b/owrx/controllers/assets.py @@ -150,6 +150,7 @@ class CompiledAssetsController(GzipMixin, ModificationAwareController): "lib/settings/BookmarkTable.js", "lib/settings/WsjtDecodingDepthsInput.js", "lib/settings/WaterfallDropdown.js", + "lib/settings/GainInput.js", "settings.js", ], } diff --git a/owrx/form/device.py b/owrx/form/device.py new file mode 100644 index 0000000..1da6791 --- /dev/null +++ b/owrx/form/device.py @@ -0,0 +1,33 @@ +from owrx.form import Input + + +class GainInput(Input): + def render_input(self, value): + auto_mode = value is None or value == "auto" + + return """ +