Skip to content

Commit

Permalink
Fix Refresh bug
Browse files Browse the repository at this point in the history
  • Loading branch information
bauidch committed Dec 28, 2020
1 parent 7f5309e commit 03df04d
Show file tree
Hide file tree
Showing 12 changed files with 169 additions and 81 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# AirMeteo
METAR Client
A simply METAR(Meteorological Aviation Report) Client for SailfishOS

## Description
Show the METAR of your Favourite Airports
Show the METAR of your Favourite Airports.

#### Features:
- Show METAR
- Add favourite Airports
- Some METAR Decoding

## Disclaimer
Not for operational use! The data used on this app could be outdated, inaccurate or contain errors. Always use up-to-date official service from your airport for flight planning.

## Credits:
- [harbour-meteoswiss](https://github.com/ichthyosaurus/harbour-meteoswiss)
Expand All @@ -14,7 +19,7 @@ Show the METAR of your Favourite Airports

## ToDo
- Better UI
- Icons
- Icons(wind, etc..)
- Better Cover interaction
- TAF
- All Request in JS
Expand All @@ -23,3 +28,6 @@ Show the METAR of your Favourite Airports
- From RAW to Decode(own implementation)
- Better Error handling

## Dev Hints
https://github.com/python-metar/python-metar/blob/master/metar/Metar.py
https://github.com/joanpc/XplaneNoaaWeather/blob/master/noaweather/metar.py
5 changes: 4 additions & 1 deletion qml/cover/CoverPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ CoverBackground {

CoverAction {
iconSource: "image://theme/icon-cover-refresh"
onTriggered: updateMetarsToStorage()
onTriggered: {
updateMetarsToStorage()
reloadMetarsData()
}
}
}
function updateData(index) {
Expand Down
5 changes: 5 additions & 0 deletions qml/dialogs/AddStationDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -76,27 +76,32 @@ Dialog {
width: parent.width
text: qsTr("Station not Found, try again")
visible: false
x: Theme.paddingLarge
}
Label {
id: stationIcao
width: parent.width
text: "ZZZZ"
visible: false
x: Theme.paddingLarge
}
Label {
id: stationName
width: parent.width
visible: false
x: Theme.paddingLarge
}
Label {
id: stationLocation
width: parent.width
visible: false
x: Theme.paddingLarge
}
Label {
id: stationCountry
width: parent.width
visible: false
x: Theme.paddingLarge
}

}
Expand Down
1 change: 0 additions & 1 deletion qml/harbour-airmeteo.qml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ ApplicationWindow
var metars = metarBank.getMETARS()
for (var i = 0; i < metars.length; ++i) {
var station_id = metars[i].station_id
console.log("Update: " + station_id )
python.call('airdata.getMetar', [station_id], function(result) {
if (result.length <= 0) {
console.log('QML Debug: No Data')
Expand Down
27 changes: 26 additions & 1 deletion qml/pages/AboutPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Page {
}
}
Label {
text: qsTr("AirMeteo version: 0.1")
text: qsTr("AirMeteo version: 0.2")
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeMedium
anchors {
Expand All @@ -51,6 +51,29 @@ Page {
text: qsTr("bauidch")
}
}
Row {
x: Theme.paddingLarge

Label {
font.pixelSize: Theme.fontSizeSmall
color: Theme.highlightColor
text: qsTr("Disclaimer:")
}
}

Row {
x: Theme.paddingLarge
width: parent.width - 2*x
spacing: Theme.paddingLarge

Label {
text: qsTr("Not for operational use! The data used on this app could be outdated, inaccurate or contain errors. Always use up-to-date official service from your airport for flight planning.")
color: Theme.primaryColor
font.pixelSize: Theme.fontSizeSmall
wrapMode: Text.Wrap
width: parent.width
}
}

Row {
x: Theme.paddingLarge
Expand All @@ -66,6 +89,7 @@ Page {

Label {
font.pixelSize: Theme.fontSizeExtraSmall
wrapMode: Text.Wrap
text: "aviationweather.gov, airport-data.com"
}
}
Expand All @@ -83,6 +107,7 @@ Page {

Label {
font.pixelSize: Theme.fontSizeExtraSmall
wrapMode: Text.Wrap
text: "harbour-meteoswiss, welkweer, harbour-opensensefish"
}
}
Expand Down
23 changes: 15 additions & 8 deletions qml/pages/OverviewPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,24 @@ Page {
verticalAlignment: Text.AlignVCenter
height: implicitHeight + Theme.paddingSmall
}

Label {
id: temperaturLabel
anchors.top: locationLabel.bottom
font.pixelSize: Theme.fontSizeSmall
color: Theme.secondaryColor
text: model.temp_c + "° C"
wrapMode: Text.WordWrap
verticalAlignment: Text.AlignVCenter
height: implicitHeight + Theme.paddingMedium
color: highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor
font.pixelSize: Theme.fontSizeLarge

anchors {
top: parent.top; topMargin: Theme.paddingSmall
right: parent.right; rightMargin: Theme.horizontalPageMargin
}
}

Image {
id: boxpositionicon
source: "image://theme/icon-s-task"
anchors {
top: temperaturLabel.bottom
top: locationLabel.bottom
left: parent.left
leftMargin: Theme.horizontalPageMargin
}
Expand Down Expand Up @@ -138,7 +141,11 @@ Page {
}
MenuItem {
text: qsTr("Refresh Data")
onClicked: updateMetarsToStorage()
onClicked: {
updateMetarsToStorage()
reloadMetarsData()
}

}
}
}
Expand Down
54 changes: 35 additions & 19 deletions qml/pages/StationPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,19 @@ Page {
function loadMetar() {
var metar = metarBank.getMETAR(stationCode)
rawMETARLabel.text = metar[0].raw_text
temperatur.valueLabelText = metar[0].temp_c + " C"
dewpoint.valueLabelText = metar[0].dewpoint_c + " C"
windDirection.valueLabelText = metar[0].wind_dir_degrees + " Grad"
windSpeed.valueLabelText = metar[0].wind_speed_kt + " kt"

var pressureRex = /Q([0-9]{3,4})/
var pressureValue = pressureRex.exec(metar[0].raw_text)

var visibilityRex = /\b(CAVOK|[PM]?([0-9]{4})|([0-9] )?([0-9]{1,2})([0-9])?(SM|KM))\b/
var visibilityValue = visibilityRex.exec(metar[0].raw_text)

view.valueLabelText = visibilityValue[1]
presure.valueLabelText = pressureValue[1] + " hPa"
temperatur.valueLabelText = metar[0].temp_c + "° C"
dewpoint.valueLabelText = metar[0].dewpoint_c + "° C"
wind.valueLabelText = metar[0].wind_dir_degrees + "° with " + metar[0].wind_speed_kt + " kt"

metarUpdateTime.text = qsTr("Update at ") + metar[0].observation_time
subLabel.text = metar[0].location

Expand All @@ -31,14 +40,10 @@ Page {
PullDownMenu {
MenuItem {
text: qsTr("Refresh")
//onClicked: loadDataToStorage(stationCode)
}
}

PushUpMenu {
MenuItem {
text: qsTr("Raw") // dataMode RAW Decoded
//onClicked: test_airdata.getMETAR("LSZH")
onClicked: {
updateMetarsToStorage()
reloadMetarsData()
}
}
}

Expand Down Expand Up @@ -71,7 +76,7 @@ Page {
SectionHeader {
font.pixelSize: Theme.fontSizeMedium
color: Theme.secondaryHighlightColor
text: "METAR"
text: qsTr("RAW")
wrapMode: Text.Wrap
}
Column {
Expand All @@ -90,7 +95,21 @@ Page {

}
}
SectionHeader {
font.pixelSize: Theme.fontSizeMedium
color: Theme.secondaryHighlightColor
text: qsTr("Decoded")
wrapMode: Text.Wrap
}

AirDataIteam {
id: view
typeLabelText: qsTr("Visibility")
}
AirDataIteam {
id: wind
typeLabelText: qsTr("Wind")
}
AirDataIteam {
id: temperatur
typeLabelText: qsTr("Temperatur")
Expand All @@ -101,14 +120,11 @@ Page {
typeLabelText: qsTr("Dewpoint")
}
AirDataIteam {
id: windDirection
typeLabelText: qsTr("Wind Direction")
}
AirDataIteam {
id: windSpeed
typeLabelText: qsTr("Wind Speed")
id: presure
typeLabelText: qsTr("Air Presure")
}


Label {
id: metarUpdateTime
anchors.horizontalCenter: parent.horizontalCenter
Expand Down
7 changes: 4 additions & 3 deletions rpm/harbour-airmeteo.changes.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# * date Author's Name <author's email> version-release
# - Summary of changes

* Sun Apr 13 2014 Jack Tar <jack.tar@example.com> 0.0.1-1
- Scrubbed the deck
- Hoisted the sails
* Sun Dec 27 2020 bauidch <info@bauidc.ch> 0.1-1
- Add Metar Info

* Mon Dec 28 2020 bauidch <info@bauidc.ch> 0.2-1
- Bug fixes
2 changes: 1 addition & 1 deletion rpm/harbour-airmeteo.spec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Name: harbour-airmeteo
# << macros

Summary: METAR Client
Version: 0.1
Version: 0.2
Release: 1
Group: Qt/Qt
License: LICENSE
Expand Down
2 changes: 1 addition & 1 deletion rpm/harbour-airmeteo.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Name: harbour-airmeteo
Summary: METAR Client
Version: 0.1
Version: 0.2
Release: 1
# The contents of the Group field should be one of the groups listed here:
# https://github.com/mer-tools/spectacle/blob/master/data/GROUPS
Expand Down
Loading

0 comments on commit 03df04d

Please sign in to comment.