add an input for wsjt_decoding_depths
This commit is contained in:
parent
819790cbc8
commit
c0193e677c
@ -75,4 +75,8 @@ table.bookmarks .frequency {
|
||||
|
||||
.actions .btn {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.wsjt-decoding-depths-table {
|
||||
width: auto;
|
||||
}
|
23
htdocs/lib/settings/MapInput.js
Normal file
23
htdocs/lib/settings/MapInput.js
Normal file
@ -0,0 +1,23 @@
|
||||
$.fn.mapInput = function() {
|
||||
this.each(function(el) {
|
||||
var $el = $(this);
|
||||
var field_id = $el.attr("for");
|
||||
var $lat = $('#' + field_id + '-lat');
|
||||
var $lon = $('#' + field_id + '-lon');
|
||||
$.getScript('https://maps.googleapis.com/maps/api/js?key=' + $el.data('key')).done(function(){
|
||||
$el.css('height', '200px');
|
||||
var lp = new locationPicker($el.get(0), {
|
||||
lat: parseFloat($lat.val()),
|
||||
lng: parseFloat($lon.val())
|
||||
}, {
|
||||
zoom: 7
|
||||
});
|
||||
|
||||
google.maps.event.addListener(lp.map, 'idle', function(event){
|
||||
var pos = lp.getMarkerPosition();
|
||||
$lat.val(pos.lat);
|
||||
$lon.val(pos.lng);
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
16
htdocs/lib/settings/WsjtDecodingDepthsInput.js
Normal file
16
htdocs/lib/settings/WsjtDecodingDepthsInput.js
Normal file
@ -0,0 +1,16 @@
|
||||
$.fn.wsjtDecodingDepthsInput = function() {
|
||||
var renderTable = function(data) {
|
||||
var $table = $('<table class="table table-sm table-borderless wsjt-decoding-depths-table">');
|
||||
$table.append($.map(data, function(value, mode){
|
||||
return $('<tr><td>' + mode + '</td><td>' + value + '</td></tr>');
|
||||
}));
|
||||
return $table;
|
||||
}
|
||||
|
||||
this.each(function(){
|
||||
var $input = $(this);
|
||||
var $el = $input.parent();
|
||||
var $table = renderTable(JSON.parse($input.val()));
|
||||
$el.append($table);
|
||||
});
|
||||
};
|
@ -1,27 +1,7 @@
|
||||
$(function(){
|
||||
$(".map-input").each(function(el) {
|
||||
var $el = $(this);
|
||||
var field_id = $el.attr("for");
|
||||
var $lat = $('#' + field_id + '-lat');
|
||||
var $lon = $('#' + field_id + '-lon');
|
||||
$.getScript("https://maps.googleapis.com/maps/api/js?key=" + $el.data("key")).done(function(){
|
||||
$el.css("height", "200px");
|
||||
var lp = new locationPicker($el.get(0), {
|
||||
lat: parseFloat($lat.val()),
|
||||
lng: parseFloat($lon.val())
|
||||
}, {
|
||||
zoom: 7
|
||||
});
|
||||
|
||||
google.maps.event.addListener(lp.map, 'idle', function(event){
|
||||
var pos = lp.getMarkerPosition();
|
||||
$lat.val(pos.lat);
|
||||
$lon.val(pos.lng);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$(".sdrdevice").sdrdevice();
|
||||
$(".imageupload").imageUpload();
|
||||
$(".bookmarks").bookmarktable();
|
||||
$('.map-input').mapInput();
|
||||
$('.sdrdevice').sdrdevice();
|
||||
$('.imageupload').imageUpload();
|
||||
$('.bookmarks').bookmarktable();
|
||||
$('.wsjt-decoding-depths').wsjtDecodingDepthsInput();
|
||||
});
|
@ -147,8 +147,10 @@ class CompiledAssetsController(GzipMixin, ModificationAwareController):
|
||||
"lib/Header.js",
|
||||
"lib/settings/Input.js",
|
||||
"lib/settings/SdrDevice.js",
|
||||
"lib/settings/MapInput.js",
|
||||
"lib/settings/ImageUpload.js",
|
||||
"lib/settings/BookmarkTable.js",
|
||||
"lib/settings/WsjtDecodingDepthsInput.js",
|
||||
"settings.js",
|
||||
],
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
from owrx.controllers.settings import SettingsFormController, Section
|
||||
from owrx.form import CheckboxInput, NumberInput, DropdownInput, Js8ProfileCheckboxInput, MultiCheckboxInput, Option
|
||||
from owrx.form.wfm import WfmTauValues
|
||||
from owrx.form.wsjt import Q65ModeMatrix
|
||||
from owrx.form.wsjt import Q65ModeMatrix, WsjtDecodingDepthsInput
|
||||
from owrx.wsjt import Fst4Profile, Fst4wProfile
|
||||
|
||||
|
||||
@ -55,6 +55,10 @@ class DecodingSettingsController(SettingsFormController):
|
||||
"Default WSJT decoding depth",
|
||||
infotext="A higher decoding depth will allow more results, but will also consume more cpu",
|
||||
),
|
||||
WsjtDecodingDepthsInput(
|
||||
"wsjt_decoding_depths",
|
||||
"Individual decoding depths",
|
||||
),
|
||||
NumberInput(
|
||||
"js8_decoding_depth",
|
||||
"Js8Call decoding depth",
|
||||
|
@ -1,5 +1,8 @@
|
||||
from owrx.form import Input
|
||||
from owrx.wsjt import Q65Mode, Q65Interval
|
||||
from owrx.modes import Modes
|
||||
import json
|
||||
import html
|
||||
|
||||
|
||||
class Q65ModeMatrix(Input):
|
||||
@ -50,3 +53,17 @@ class Q65ModeMatrix(Input):
|
||||
if in_response(mode, interval)
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
class WsjtDecodingDepthsInput(Input):
|
||||
def render_input(self, value):
|
||||
return """
|
||||
<input type="hidden" class="{classes}" id="{id}" name="{id}" value="{value}">
|
||||
""".format(
|
||||
id=self.id,
|
||||
classes=self.input_classes(),
|
||||
value=html.escape(json.dumps(value)),
|
||||
)
|
||||
|
||||
def input_classes(self):
|
||||
return super().input_classes() + " wsjt-decoding-depths"
|
||||
|
Loading…
Reference in New Issue
Block a user