View Single Post
Markkyboy's Avatar
Posts: 433 | Thanked: 727 times | Joined on Oct 2012 @ Costa Blanca, Espaņa
#14
Right, fair enough. Moving on, same matter, different slant; As I cannot get live weather data (windspeed/direction) on the lockscreen, id like to try and get wind direction to show as intended, by that I mean, labelled "N" or "NE" and so on. I thought using an else/if type statement would make this happen and I'm halfway there, but still no cigar - the aim ultimately being to get this working and then going back to getting such data to show on lockscreen.

The file I'm editing is /usr/lib/qt5/qml/Sailfish/Weather/WeatherDetailsHeader.qml and this is what I've added so far,

Code:
        DetailItem {
            //% "WindDirection"
            label: qsTrId("Wind direction")
            value: {
                var windDirectionText
                var windDirection = 0
                if      (weather.windDirection=0)   windDirectionText='N';
                else if (weather.windDirection=45)  windDirectionText='NE';
                else if (weather.windDirection=90)  windDirectionText='E';
                else if (weather.windDirection=135) windDirectionText='SE';
                else if (weather.windDirection=180) windDirectionText='S';
                else if (weather.windDirection=225) windDirectionText='SW';
                else if (weather.windDirection=270) windDirectionText='W';
                else if (weather.windDirection=315) windDirectionText='NW';
            }
        }
Problem is, my output text is stuck on "NE" and does not change when selecting different days, so clearly there is something wrong with my code, but I have no idea what, so any clues here would be appreciated.

This is how the data above looks on the device (see "Wind direction" near the bottom of the screen but notice the position of the arrow at the top of the screen pointing from south);
Attached Images
 
__________________
..oO(Don't just sit there standing around, pick up a shovel and sweep up!)Oo..
 

The Following 2 Users Say Thank You to Markkyboy For This Useful Post: