Added D-Region Absorption Predictions

This commit is contained in:
Marco Dalla Tiezza
2024-05-31 19:59:51 +02:00
parent 359e5c9076
commit 3fdbdbfae4
6 changed files with 1561 additions and 153 deletions

View File

@@ -50,6 +50,9 @@ Window {
TabButton {
text: qsTr("Forecasts")
}
TabButton {
text: qsTr("DRAP")
}
}
StackLayout {
@@ -68,6 +71,12 @@ Window {
id: spaceWeatherForecastPage
}
}
Item {
SpaceWeatherDRAPPage {
id: spaceWeatherDRAPPage
}
}
}
}
}

107
ui/SpaceWeatherDRAPPage.qml Normal file
View File

@@ -0,0 +1,107 @@
import QtQuick
import QtQuick.Window
import QtQuick.Controls
import QtQuick.Controls.Material
import QtQuick.Layouts
Page {
id: spaceWeatherDRAP
anchors.fill: parent
objectName: "spaceWeatherDRAPObj"
function loadDrapReport(poseidon_data) {
labelRecovery.text = poseidon_data['DRAP']['Recovery Time']
labelXrayMsg.text = poseidon_data['DRAP']['XRay Msg']
labelProtonMsg.text = poseidon_data['DRAP']['Proton Msg']
checkUrlExists("https://www.aresvalley.com/poseidon_engine/drap.png", function(exists) {
if (exists) {
imageBox.source = "https://www.aresvalley.com/poseidon_engine/drap.png"
} else {
imageBox.source = "qrc:///images/artemis_not_available.svg"
}
})
}
function checkUrlExists(url, callback) {
var xhr = new XMLHttpRequest()
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE) {
callback(xhr.status === 200)
}
}
xhr.open("HEAD", url, true)
xhr.send()
}
ColumnLayout {
anchors.fill: parent
anchors.rightMargin: 20
anchors.leftMargin: 20
anchors.bottomMargin: 20
anchors.topMargin: 20
Image {
id: imageBox
Layout.fillHeight: true
Layout.fillWidth: true
fillMode: Image.PreserveAspectFit
}
RowLayout {
Item {
Layout.fillWidth: true
}
Label {
text: qsTr("RECOVERY TIME:")
Layout.fillWidth: false
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
}
Label {
id: labelRecovery
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
font.pointSize: 12
font.bold: true
}
Item {
Layout.fillWidth: true
}
}
RowLayout {
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
Layout.fillWidth: true
ColumnLayout {
Label {
text: qsTr("X-RAY STATUS")
}
Label {
id: labelXrayMsg
font.pointSize: 12
font.bold: true
}
}
Item {
Layout.fillWidth: true
}
ColumnLayout {
Label {
text: qsTr("PROTON STATUS")
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
}
Label {
id: labelProtonMsg
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
font.pointSize: 12
font.bold: true
}
}
}
}
}