make the frontend resume when an sdr device becomes present
This commit is contained in:
parent
8fa1796037
commit
acee318dae
@ -800,6 +800,12 @@ function on_ws_recv(evt) {
|
|||||||
return '<option value="' + profile['id'] + '">' + profile['name'] + "</option>";
|
return '<option value="' + profile['id'] + '">' + profile['name'] + "</option>";
|
||||||
}).join(""));
|
}).join(""));
|
||||||
$('#openwebrx-sdr-profiles-listbox').val(currentprofile.toString());
|
$('#openwebrx-sdr-profiles-listbox').val(currentprofile.toString());
|
||||||
|
// this is a bit hacky since it only makes sense if the error is actually "no sdr devices"
|
||||||
|
// the only other error condition for which the overlay is used right now is "too many users"
|
||||||
|
// so there shouldn't be a problem here
|
||||||
|
if (json['value'].keys()) {
|
||||||
|
$('#openwebrx-error-overlay').hide();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "features":
|
case "features":
|
||||||
Modes.setFeatures(json['value']);
|
Modes.setFeatures(json['value']);
|
||||||
@ -836,6 +842,7 @@ function on_ws_recv(evt) {
|
|||||||
var $overlay = $('#openwebrx-error-overlay');
|
var $overlay = $('#openwebrx-error-overlay');
|
||||||
$overlay.find('.errormessage').text(json['value']);
|
$overlay.find('.errormessage').text(json['value']);
|
||||||
$overlay.show();
|
$overlay.show();
|
||||||
|
$("#openwebrx-panel-receiver").demodulatorPanel().stopDemodulator();
|
||||||
break;
|
break;
|
||||||
case 'secondary_demod':
|
case 'secondary_demod':
|
||||||
secondary_demod_push_data(json['value']);
|
secondary_demod_push_data(json['value']);
|
||||||
|
@ -325,6 +325,7 @@ class OpenWebRxReceiverClient(OpenWebRxClient, SdrSourceEventClient):
|
|||||||
self.sdr.addSpectrumClient(self)
|
self.sdr.addSpectrumClient(self)
|
||||||
|
|
||||||
def handleNoSdrsAvailable(self):
|
def handleNoSdrsAvailable(self):
|
||||||
|
self.stack.removeLayerByPriority(0)
|
||||||
self.write_sdr_error("No SDR Devices available")
|
self.write_sdr_error("No SDR Devices available")
|
||||||
|
|
||||||
def startDsp(self):
|
def startDsp(self):
|
||||||
|
@ -294,6 +294,11 @@ class PropertyStack(PropertyManager):
|
|||||||
|
|
||||||
return changes
|
return changes
|
||||||
|
|
||||||
|
def removeLayerByPriority(self, priority):
|
||||||
|
for layer in self.layers:
|
||||||
|
if layer["priority"] == priority:
|
||||||
|
self.removeLayer(layer["props"])
|
||||||
|
|
||||||
def removeLayer(self, pm: PropertyManager):
|
def removeLayer(self, pm: PropertyManager):
|
||||||
for layer in self.layers:
|
for layer in self.layers:
|
||||||
if layer["props"] == pm:
|
if layer["props"] == pm:
|
||||||
|
@ -42,6 +42,18 @@ class PropertyStackTest(TestCase):
|
|||||||
om.removeLayer(high_pm)
|
om.removeLayer(high_pm)
|
||||||
self.assertEqual(om["testkey"], "low value")
|
self.assertEqual(om["testkey"], "low value")
|
||||||
|
|
||||||
|
def testLayerRemovalByPriority(self):
|
||||||
|
om = PropertyStack()
|
||||||
|
low_pm = PropertyLayer()
|
||||||
|
high_pm = PropertyLayer()
|
||||||
|
low_pm["testkey"] = "low value"
|
||||||
|
high_pm["testkey"] = "high value"
|
||||||
|
om.addLayer(1, low_pm)
|
||||||
|
om.addLayer(0, high_pm)
|
||||||
|
self.assertEqual(om["testkey"], "high value")
|
||||||
|
om.removeLayerByPriority(0)
|
||||||
|
self.assertEqual(om["testkey"], "low value")
|
||||||
|
|
||||||
def testPropertyChange(self):
|
def testPropertyChange(self):
|
||||||
layer = PropertyLayer()
|
layer = PropertyLayer()
|
||||||
stack = PropertyStack()
|
stack = PropertyStack()
|
||||||
|
Loading…
Reference in New Issue
Block a user