make receiver details dynamic

This commit is contained in:
Jakob Ketterl 2019-05-05 17:52:26 +02:00
parent 0da62dad82
commit cb0d59de61
3 changed files with 18 additions and 4 deletions

View File

@ -50,8 +50,8 @@
<img id="webrx-rx-avatar" src="static/gfx/openwebrx-avatar.png" onclick="toggle_rx_photo();"/>
</div>
<div id="webrx-rx-texts">
<div id="webrx-rx-title" onclick="toggle_rx_photo();">%[RX_TITLE]</div>
<div id="webrx-rx-desc" onclick="toggle_rx_photo();">%[RX_LOC] | Loc: %[RX_QRA], ASL: %[RX_ASL] m, <a href="https://www.google.hu/maps/place/%[RX_GPS]" target="_blank" onclick="dont_toggle_rx_photo();">[maps]</a></div>
<div id="webrx-rx-title" onclick="toggle_rx_photo();"></div>
<div id="webrx-rx-desc" onclick="toggle_rx_photo();"></div>
</div>
<div id="openwebrx-rx-details-arrow">
<a id="openwebrx-rx-details-arrow-up" onclick="toggle_rx_photo();"><img src="static/gfx/openwebrx-rx-details-arrow-up.png" /></a>
@ -65,8 +65,8 @@
</ul>
</section>
</div>
<div id="webrx-rx-photo-title">%[RX_PHOTO_TITLE]</div>
<div id="webrx-rx-photo-desc">%[RX_PHOTO_DESC]</div>
<div id="webrx-rx-photo-title"></div>
<div id="webrx-rx-photo-desc"></div>
</div>
</div>
<div id="webrx-main-container">

View File

@ -1182,6 +1182,13 @@ function on_ws_recv(evt)
waterfall_init();
audio_preinit();
break;
case "receiver_details":
var r = json.value;
e('webrx-rx-title').innerHTML = r.receiver_name;
e('webrx-rx-desc').innerHTML = r.receiver_location + ' | Loc: ' + r.receiver_qra + ', ASL: ' + r.receiver_asl + ' m, <a href="https://www.google.hu/maps/place/' + r.receiver_gps[0] + ',' + r.receiver_gps[1] + '" target="_blank" onclick="dont_toggle_rx_photo();">[maps]</a>';
e('webrx-rx-photo-title').innerHTML = r.photo_title;
e('webrx-rx-photo-desc').innerHTML = r.photo_desc;
break;
case "smeter":
setSmeterAbsoluteValue(json.value);
break;

View File

@ -78,6 +78,13 @@ class WebSocketMessageHandler(object):
conn.send({"type":"config","value":config})
print("client connection intitialized")
receiver_details = dict((key, pm.getPropertyValue(key)) for key in ["receiver_name", "receiver_location",
"receiver_qra", "receiver_asl",
"receiver_gps", "photo_title",
"photo_desc"]
)
conn.send({"type":"receiver_details","value":receiver_details})
self.forwarder = SpectrumForwarder(conn)
SpectrumThread.getSharedInstance().add_client(self.forwarder)
CpuUsageThread.getSharedInstance().add_client(self.forwarder)