From 1b629e32ff15eabe7f69a2f83a6ca1be50d7569b Mon Sep 17 00:00:00 2001 From: Marat Fayzullin Date: Sat, 25 Mar 2023 16:15:17 -0400 Subject: [PATCH] Added UI opacity setting. --- htdocs/openwebrx.js | 6 ++++++ owrx/config/defaults.py | 1 + owrx/connection.py | 1 + owrx/controllers/settings/general.py | 9 +++++++++ 4 files changed, 17 insertions(+) diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js index 7c51bd3b..076e16bc 100644 --- a/htdocs/openwebrx.js +++ b/htdocs/openwebrx.js @@ -1050,6 +1050,12 @@ function on_ws_recv(evt) { tuning_step_reset(); } + if ('ui_opacity' in config) { + var x = config['ui_opacity']; + x = x<10? 10 : x>100? 100 : x; + $('.openwebrx-panel').css('opacity', x/100); + } + break; case "secondary_config": var s = json['value']; diff --git a/owrx/config/defaults.py b/owrx/config/defaults.py index 1e9b05df..667eea0e 100644 --- a/owrx/config/defaults.py +++ b/owrx/config/defaults.py @@ -155,6 +155,7 @@ defaultConfig = PropertyLayer( waterfall_levels=PropertyLayer(min=-88, max=-20), waterfall_auto_levels=PropertyLayer(min=3, max=10), waterfall_auto_min_range=50, + ui_opacity=100, tuning_precision=2, squelch_auto_margin=10, google_maps_api_key="", diff --git a/owrx/connection.py b/owrx/connection.py index d2496797..cac1c07f 100644 --- a/owrx/connection.py +++ b/owrx/connection.py @@ -137,6 +137,7 @@ class OpenWebRxReceiverClient(OpenWebRxClient, SdrSourceEventClient): "fft_compression", "max_clients", "tuning_precision", + "ui_opacity", ] def __init__(self, conn): diff --git a/owrx/controllers/settings/general.py b/owrx/controllers/settings/general.py index 403f9fc9..ba17842b 100644 --- a/owrx/controllers/settings/general.py +++ b/owrx/controllers/settings/general.py @@ -9,6 +9,7 @@ from owrx.form.input import ( DropdownInput, Option, ) +from owrx.form.input.validator import RangeValidator from owrx.form.input.converter import WaterfallColorsConverter, IntConverter from owrx.form.input.receiverid import ReceiverKeysConverter from owrx.form.input.gfx import AvatarInput, TopPhotoInput @@ -164,6 +165,14 @@ class GeneralSettingsController(SettingsFormController): ), Section( "Display settings", + NumberInput( + "ui_opacity", + "User interface opacity", + infotext="Specifies how opaque user interface is, " + + "10% for near invisible, 100% for totally solid.", + validator=RangeValidator(10, 100), + append="%", + ), DropdownInput( "tuning_precision", "Tuning precision",