maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   Wind speed and direction on lockscreen (https://talk.maemo.org/showthread.php?t=100244)

Markkyboy 2018-03-12 11:28

Wind speed and direction on lockscreen
 
2 Attachment(s)
As usual, I've been tinkering, this time with the Weather app (sailfish-weather). I wanted to see the weather description as well as high and low temperatures on the lockscreen, this I have achieved, it isn't pretty (yet) but it works. I did this by copying /usr/lib/qt5/aml/Sailfish/Weather/WeatherBanner.qml to /usr/share/lipstick-jolla-home-qt5/lockscreen/* and then editing that file to get what I wanted.

I also would like to see wind speed and wind direction on the lockscreen, but for some reason I cannot get this to display/show. I thought I'd be able to achieve this in the same or similar fashion to getting temperature, weather image and weather description to show, but it seems I am wrong.

There is a file called /usr/lib/qt5/qml/Sailfish/Weather/WeatherDetailsHeader.qml which contains the models for windspeed and wind direction, I copied this to the lockscreen folder and have edited it until the cows came home....but I cannot get windspeed/direction to display. Obviously there are other files pertaining to wind speed and direction; Model.qml and Model.js.....I tried copying these files to lockscreen, but again, no amount of 'fiddling' helped.

The second image is of course a mock-up of what i'd like to see.

Any ideas guys?

nieldk 2018-03-12 16:56

Re: Sailfish weather on lockscreen
 
Tried copying that file, but nothing shows up on lock screen ?
SFOS-x 2.1.4

Markkyboy 2018-03-12 20:24

Re: Sailfish weather on lockscreen
 
Quote:

Originally Posted by nieldk (Post 1542288)
Tried copying that file, but nothing shows up on lock screen ?
SFOS-x 2.1.4

With WeatherBanner.qml entered into the lockscreen folder, you need to make an entry in Clock.qml;

Code:

WeatherBanner {
    id: weatherBanner
}


Ancelad 2018-03-12 20:44

Re: Sailfish weather on lockscreen
 
Huh, you can explore my analog clock patch

Markkyboy 2018-03-12 20:57

Re: Sailfish weather on lockscreen
 
Quote:

Originally Posted by Ancelad (Post 1542300)
Huh, you can explore my analog clock patch

I wasn't aware that your patch shows windspeed/direction, I'll check it out.....I assume you mean lockscreen weather patch, not clock?

Ancelad 2018-03-12 21:05

Re: Sailfish weather on lockscreen
 
Clock from pm2 web-catalog. It doesn't show things you want, but probably will help.

olf 2018-03-13 11:05

Re: Sailfish weather on lockscreen
 
Quote:

Originally Posted by Ancelad (Post 1542300)
Huh, you can explore my analog clock patch

I.e. this one: "Lockscreen Analog Clock"

Quote:

Originally Posted by Markkyboy (Post 1542301)
I wasn't aware that your patch shows windspeed/direction, I'll check it out.....

It has the ability to display the weather forecast on the lockscreen (for Meecast); for "Jolla / Foreca Weather", you also need to install and apply "Jolla-Weather additional patch for Lockscreen Analog Clock".

@Markkyboy, except for some details (e.g. windspeed and its direction), IMHO it basically does what you want, already. I considered suggesting yesterday (but then refrained from doing so), that you may contribute to "Lockscreen Analog Clock". I am definitely willing to test any outcome of this with Meecast (instead of "Jolla / Foreca Weather").

Cheers & happy coding

rfa 2018-03-13 11:49

Re: Sailfish weather on lockscreen
 
Is this editable such that I can change it to show dawn & dusk (in place of windspeed / direction)?

Quote:

Originally Posted by olf (Post 1542325)
I.e. this one: "Lockscreen Analog Clock"


It has the ability to display the weather forecast on the lockscreen (for Meecast); for "Jolla / Foreca Weather", you also need to install and apply "Jolla-Weather additional patch for Lockscreen Analog Clock".

@Markkyboy, except for some details (e.g. windspeed and its direction), IMHO it basically does what you want, already. I considered suggesting yesterday (but then refrained from doing so), that you may contribute to "Lockscreen Analog Clock". I am definitely willing to test any outcome of this with Meecast (instead of "Jolla / Foreca Weather").

Cheers & happy coding


pichlo 2018-03-13 12:56

Re: Wind speed and direction on lockscreen
 
Off-topic, but just out of curiosity, why would people insist on top-posting like e.g. rfa in post #8 above?

It's annoying enough in emails I have to deal with every day at work but there I can at least accept people being clueless/careless/lazy (delete as appropriate) and just typing wherever Holy Microsoft has put the cursor. But to reply to a TMO post and still top post means going out of one's way to do it on purpose, since TMO is civil enough to place your cursor below the quoted text where it belongs.

I am not asking people to change their ways, that would be too much to ask. Just a simple rationale would do. As I say, out of curiosity.

rfa 2018-03-13 19:25

Re: Wind speed and direction on lockscreen
 
If you're referring to my placement of text in relation to a question it's because I have a question about something detailed in the text.

I don't put it after the quote as you would need to re-read the quote.

Is this what you mean? I'm sorry if I've broken any rules

olf 2018-03-13 20:11

Re: Wind speed and direction on lockscreen
 
Quote:

Originally Posted by pichlo (Post 1542330)
Off-topic, but just out of curiosity, why would people insist on top-posting like e.g. rfa in post #8 above?

It's annoying enough in emails I have to deal with every day at work but there I can at least accept people being clueless/careless/lazy (delete as appropriate) and just typing wherever Holy Microsoft has put the cursor. But to reply to a TMO post and still top post means going out of one's way to do it on purpose, since TMO is civil enough to place your cursor below the quoted text where it belongs.

I am not asking people to change their ways, that would be too much to ask. Just a simple rationale would do. As I say, out of curiosity.

@pichlo, you just outed yourself as a structure-nazi. ;)
And I am absolutely with you.

But I already guessed that the answer is the obvious one: This is what many are accustomed to, i.e. what they perceive as usual (/ "normal") style.
But @rfa also provided a rationale, which I heard a couple of times from regular OL users reasoning for their email reply style, when using different clients than Outlook.

Quote:

Originally Posted by rfa (Post 1542355)
[...]I'm sorry if I've broken any rules

Don't worry, you did not "break any rules".
It is just an etiquette. Plus for "defenders of the right style", a convention.

I think a proper take away from @pichlo's injunction may be:
Do not top-post in Unix-centric environments.

rfa 2018-03-13 21:36

Re: Wind speed and direction on lockscreen
 
so, is it possible to use any of the weather patches or clock settings to show dawn & dusk times on the forecast and / or clock?

Ancelad 2018-03-13 22:26

Re: Wind speed and direction on lockscreen
 
Quote:

Originally Posted by rfa (Post 1542360)
so, is it possible to use any of the weather patches or clock settings to show dawn & dusk times on the forecast and / or clock?

Currently no

Markkyboy 2018-03-29 12:30

Re: Wind speed and direction on lockscreen
 
1 Attachment(s)
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);

Zeta 2018-03-29 18:41

Re: Wind speed and direction on lockscreen
 
Quote:

Originally Posted by Markkyboy (Post 1542781)
Code:

if (weather.windDirection=0) windDirectionText='N';

Shouldn't the test in the if be done using the comparison operator '==' (or '===' as QtCreator usually proposes when editing QML for a reason I forgot), and not the assignement operator '=' ?

And by the way, what do you do with the variable 'windDirectionText' ? I can't see it used anywhere except for setting its value ?

Markkyboy 2018-04-02 12:29

Re: Wind speed and direction on lockscreen
 
Quote:

Originally Posted by Zeta (Post 1542789)
Shouldn't the test in the if be done using the comparison operator '==' (or '===' as QtCreator usually proposes when editing QML for a reason I forgot), and not the assignement operator '=' ?

And by the way, what do you do with the variable 'windDirectionText' ? I can't see it used anywhere except for setting its value ?

Quite right Zeta on some points, especially windDirectionText...a remnant of other code I was playing with.
I'm not using QtCreator, the editing is done directly on the device via ssh. What you say about the operators is not strictly true. I have used different variations with success, here's one example using a single '=' operator with success.

Once again, it's clear to me that I don;t quite know what I'm doing! :D

Zeta 2018-04-02 16:03

Re: Wind speed and direction on lockscreen
 
I am not sure I understand.
Quote:

Originally Posted by Markkyboy (Post 1542945)
I have used different variations with success, here's one example using a single '=' operator with success.

While the previous message you said it didn't work:
Quote:

Originally Posted by Markkyboy (Post 1542781)
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.

So what is this success you are talking about ?

From what I understand (I am more of a C developer than JS...):
First test : the test is using the assignment operator and not the comparison one, so you are actually setting the variable weather.windDirection to 0.
I assume in JS its behavior is like in C, where the whole instruction returns the value that was assigned, so "if(weather.windDirection=0)" is then evaluated to " if(0)" which is false.
So it takes the first else. There the variable is assigned to 45, and likewise the tests is "if(45)" which is true (not 0), so it take the instruction windDirectionText='NE', which probably return the result of this assignement as the return value of the block, so it is always showing "NE", no matter the variable weather.windDirection which gets overwritten constantly by each "test".

I could be wrong in this analysis, but something like the following should be better:
Code:

DetailItem {
            //% "WindDirection"
            label: qsTrId("Wind direction")
            value: {
                if      (weather.windDirection == 0) return 'N';
                else if (weather.windDirection == 45) return 'NE';
                else if (weather.windDirection == 90) return 'E';
                else if (weather.windDirection == 135) return 'SE';
                else if (weather.windDirection == 180) return 'S';
                else if (weather.windDirection == 225) return 'SW';
                else if (weather.windDirection == 270) return 'W';
                else if (weather.windDirection == 315) return 'NW';
            }
        }

I am not sure of the need of the "return" here, I usually use ternary operator for this kind of tests, which gets ugly fast.

Are the only possible values those 45 degrees multiples ? If not, you should use "<=" comparison for it to work for other values (and adding 22.5 degrees to each value).

Markkyboy 2018-04-03 15:48

Re: Wind speed and direction on lockscreen
 
Hi, thanks for replying....
apologies, my life is upside down here as I am about to move.

My reference to success came without a link to another page here on TJC, to show different ways operators can work, this is the reference; http://talk.maemo.org/showpost.php?p...22&postcount=5

Looking at that page now, I can see '=' has not been used alone. I should also make it clear that I'm no expert in any coding field, I simply enjoy tinkering, guessing, playing around until something works, then within that journey, I learn.

I tried your code, sadly it yields an undesired result, no data is displayed but by removing '==' and replacing with '=', I then get "NE" always displayed, so no change :(

Yes, the WeatherModel.js file shows that the angles of wind direction are indeed all at/of 45 degree increments.

Thanks for your input.

Regards,

Zeta 2018-04-04 22:39

Re: Wind speed and direction on lockscreen
 
OK.

I took some time to create a new empty QML project on Desktop to make some tests and be able to confirm what works and not only giving you some pointers.
To keep it simple (for me...) I used a slider to simulate the values of the weather.windDirection variable, and Text elements to show several solutions that all works for me (With the one you have above, I get the same result : stuck to "NE").

Feel free to choose whichever fits bets your way to code, and adjust it to your variable names (weather.windDirection in place of windDirection.value at least). Maybe some QML expert could point out what is the "QML way" to do this properly, even if they all works.

In order you have :
* if/else blocks with return
* if/else blocks without return
* ternary if operators
* string list based indexing (as wind direction can only be multiples of 45, dividing it by 45 gives a simple 0 based index to lookup in the string list)

If that example is not clear enough, I can try to put that at work directly in place in the patch you want to create, but would need your current code and if there is anything special to install (only Jolla's weather app ?) as I didn't follow all that was done at this point.

Code:

import QtQuick 2.6
import QtQuick.Window 2.2
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.3

Window {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")

    ColumnLayout {

        Slider {
            id : windDirection
            value: 180
            minimumValue: 0
            maximumValue: 315
            stepSize: 45
        }

        Text {
            text: {
                if      (windDirection.value == 0) return 'N';
                else if (windDirection.value == 45) return 'NE';
                else if (windDirection.value == 90) return 'E';
                else if (windDirection.value == 135) return 'SE';
                else if (windDirection.value == 180) return 'S';
                else if (windDirection.value == 225) return 'SW';
                else if (windDirection.value == 270) return 'W';
                else if (windDirection.value == 315) return 'NW';
            }
            font.pixelSize: 36
            color: "red"
        }

        Text {
            text: {
                if      (windDirection.value == 0) 'N';
                else if (windDirection.value == 45) 'NE';
                else if (windDirection.value == 90) 'E';
                else if (windDirection.value == 135) 'SE';
                else if (windDirection.value == 180) 'S';
                else if (windDirection.value == 225) 'SW';
                else if (windDirection.value == 270) 'W';
                else if (windDirection.value == 315) 'NW';
            }
            font.pixelSize: 36
            color: "green"
        }


        Text {
            text: (windDirection.value == 0) ? 'N' :
                (windDirection.value == 45) ? 'NE':
                (windDirection.value == 90) ? 'E':
                (windDirection.value == 135) ? 'SE':
                (windDirection.value == 180) ? 'S':
                (windDirection.value == 225) ? 'SW':
                (windDirection.value == 270) ? 'W':
                (windDirection.value == 315) ? 'NW' : '--'
            font.pixelSize: 36
            color: "blue"
        }

        Text {
            text: ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'][windDirection.value/45]
            font.pixelSize: 36
            color: "#FF7F00"
        }

    }
}

Hope this helps !

Markkyboy 2018-04-10 15:29

Re: Wind speed and direction on lockscreen
 
3 Attachment(s)
Thank you zeta, your input has helped a great deal and it now basically works as I wanted it, now to duplicate this on the homescreen, shouldn't be too hard to do! :)

Only modifying WeatherDetailsHeader.qml by adding the following;

Code:

       
        DetailItem {
            id: windDirection
            //% "WindDirection"
            label: qsTrId("Wind direction")
            value: {
                if      (model.windDirection==0)    'N'
                else if (model.windDirection==45)  'NE'
                else if (model.windDirection==90)  'E'
                else if (model.windDirection==135)  'SE'
                else if (model.windDirection==180)  'S'
                else if (model.windDirection==225)  'SW'
                else if (model.windDirection==270)  'W'
                else if (model.windDirection==315)  'NW'
            }
        }

Which yields...

Markkyboy 2018-04-14 15:21

Re: Wind speed and direction on lockscreen
 
1 Attachment(s)
For anyone interested in the above, I have now released a patch on Openrepos
(see the heading above the windspeed value)

Markkyboy 2018-08-24 16:52

Re: Wind speed and direction on lockscreen
 
Hi all,

as many of us know, by adding a few lines of code to Clock.qml in /usr/share/lipstick-jolla-home-qt5/lockscreen and importing WeatherBanner.qml to lockscreen directory, we can produce and customise the Weather Banner, simple enough that I managed to do this without help....cool, or so I thought.

I would like to do the same with 'Wind Direction'. So by applying the same logic as above, I thought it would be a piece of cake to get Wind Direction to show on the lockscreen, but.......no. I have been playing with this for some time and still no cigar.

This is the code for WeatherBanner in Clock.qml;

WeatherBanner {
id: weatherBanner
anchors {
top: month.bottom
topMargin: Theme.paddingMedium
horizontalCenter: parent.horizontalCenter
}
}

and so, this is the code for WindDirection in Clock.qml;

WindDirection {
id: windDirection
anchors {
top: weatherBanner.bottom
topMargin: Theme.paddingLarge*2
horizontalCenter: parent.horizontalCenter
}
}

Behind the scenes and situated in lockscreen folder along with Clock.qml are WeatherBanner.qml (customised) and WeatherDirection.qml. Rather than just having an import statement for WeatherBanner I needed to customise my banner, so that's why I made a copy of the original WeatherBanner.qml and placed it in the lockscreen folder. I also tried various import statements for WindDirection but all/some/none makes no difference, what am I missing here?

Time to ask the experts among us for their wealth of knowledge, so guys and girls, if you have any idea how I can make Wind Direction show on the lockscreen, like we have done with Weather Banner, i'd really appreciate it, I feel like I'm so close to making it work....buuuuuuuuuut, it's not happening!

Ancelad 2018-08-25 06:56

Re: Wind speed and direction on lockscreen
 
Explore the latest Lockscreen Analog Clock, which uses own WeatherBannerMod.qml (obviously it is modified WeatherBanner.qml)

Code:

WeatherLoader {
      id: weatherLoader
      visible: lipstickSettings.lowPowerMode
      width: lockScreen.width
      height: width/2
      scale: rotated ? analogclockSettingsLandscape.sneakScale/100 : analogclockSettings.sneakScale/100
      source: "/usr/lib/qt5/qml/Sailfish/WeatherBannerMod.qml" //here is modified file
      active: true
      anchors {
            top: parent.top
            topMargin: rotated ? analogclockSettingsLandscape.weathertopmargin : analogclockSettings.weathertopmargin
            horizontalCenter: parent.horizontalCenter
      }               
}

and do diff between
Code:

--- /dev/null
+++ /usr/lib/qt5/qml/Sailfish/WeatherBannerMod.qml (YOUR_FILE)

or put the whole file directly.

Markkyboy 2018-08-25 11:47

Re: Wind speed and direction on lockscreen
 
I've had a good play, adding/removing/editing various aspects of each file that should be required. I even removed it all and started again. No amount of 'playing' helped.

I wonder exactly how WeatherBanner is linked to homescreen, I know it is not just via import statements, but what else, how does WeatherBanner appear on lockscreen/Clock.qml when WindDirection doesn't. I'm truly baffled. I'd like to think I understand most of what I'm doing with 'hacking' qml files. I will keep playing though, as I have done for months on and off :D

Thanks for your input Ancelad.

Ancelad 2018-08-25 12:02

Re: Wind speed and direction on lockscreen
 
Weather comes to lockscreen through eventsview in my case.

Markkyboy 2018-08-25 12:52

Re: Wind speed and direction on lockscreen
 
Quote:

Originally Posted by Ancelad (Post 1547564)
Weather comes to lockscreen through eventsview in my case.

Originally, so did mine. But I don't use 'import "../eventsview/weather" statement, because I wanted to customise how WeatherBanner looks on lockscreen and I couldn't achieve it using eventsview methods.

I've had a look already in EventsView for clues, I noticed a few import statements, tried adding them individually, but still no joy. But, you are right, the original method of getting weatherbanner onto lockscreen is through eventsview. Best I get fiddling then! :D

Ancelad 2018-08-25 13:45

Re: Wind speed and direction on lockscreen
 
Share your files and I will check.

Markkyboy 2018-08-25 13:50

Re: Wind speed and direction on lockscreen
 
The basis is my wind direction text patch on openrepos, install that. then, either move its contents to lipstick-jolla-home-qt5 as a qml file and add an entry for windDirection in Clock.qml

Markkyboy 2018-08-25 13:56

Re: Wind speed and direction on lockscreen
 
I added this to lipstick-jolla-home-qt5/lockscreen/Clock.qml;

Code:

WindDirection {
                id: windDirection
                anchors {
                    top: weatherBanner.bottom
                    topMargin: Theme.paddingLarge*2
                    horizontalCenter: parent.horizontalCenter
                }
                text: windDirection.text
        }

Then create WindDirection.qml in the same folder as Clock.qml and enter the following contents;

Code:

    import QtQuick 2.2
        import Sailfish.Silica 1.0
        import Sailfish.Weather 1.0

        Label {
            id: windDirection
            text: {
                if      (model.windDirection==0)  'N'
                else if (model.windDirection==45)  'NE'
                else if (model.windDirection==90)  'E'
                else if (model.windDirection==135) 'SE'
                else if (model.windDirection==180) 'S'
                else if (model.windDirection==225) 'SW'
                else if (model.windDirection==270) 'W'
                else if (model.windDirection==315) 'NW'
            }
    }

I've tried various import statements for both files but none seems to help, the 'why' is what's bugging me!

Ancelad 2018-08-25 20:21

Re: Wind speed and direction on lockscreen
 
Hmmm... Dirty trick, but seems working...

Add into /usr/lib/qt5/qml/Sailfish/Weather/WeatherDetailsHeader.qml

Code:

import org.nemomobile.configuration 1.0
and

Code:

ConfigurationGroup {
    id: windDirection
    path: "/custom_path_you_want"
    property int value: windDirectionIcon.rotation
}

And now you can read this value from Clock.qml by adding

Code:

import org.nemomobile.configuration 1.0
and

Code:

ConfigurationGroup {
    id: windDirection
    path: "/custom_path_you_want"
    property int value: 0
}

and finally

Code:

Text {
        id: wind
        text: windDirection.value
}

It will show values from 0 with stepsize 45... And now you can define texts according values...

I'm not sure if it will work dynamically but it should...

Markkyboy 2018-08-26 08:49

Re: Wind speed and direction on lockscreen
 
I now have a zero showing on my homescreen/lockscreen, zero indicates North, but the actual weather forecast shows SE, which is 135 in numerical terms.
Is it working for you?, do you get output other than 0..?

Ancelad 2018-08-26 10:05

Re: Wind speed and direction on lockscreen
 
Quote:

Originally Posted by Markkyboy (Post 1547581)
I now have a zero showing on my homescreen/lockscreen, zero indicates North, but the actual weather forecast shows SE, which is 135 in numerical terms.
Is it working for you?, do you get output other than 0..?

It will show 0 until wind-direction will change the first time.

Markkyboy 2018-08-26 17:48

Re: Wind speed and direction on lockscreen
 
I need to tidy up my system and try again.

When I tried your code the first time round, I did find that I could not access the second page the sailfish weather app and there were no changes to the output of zero on the lockscreen - meaning that no matter what weather destination I changed to, the output stays at zero. I'm not sure I understand what you mean, surely the output should change to any output other than zero if zero(north) is not the case......but then my device is well played with, hence a tidy and another try with your code.

So you are getting output other than zero?

Ancelad 2018-08-26 18:26

Re: Wind speed and direction on lockscreen
 
Yes, it shows different values according weather-forecast (I've changed system date some times to see).

Markkyboy 2018-08-26 19:09

Re: Wind speed and direction on lockscreen
 
Hmm, not happening for me. Still got zero. Changing the date makes no difference. I'll keep playing! :)

What do you have set in 'path' of configgroup?, I'm using /sailfish/weather/

Ancelad 2018-08-26 19:43

Re: Wind speed and direction on lockscreen
 
I've used my analog clock configuration path for test.

Markkyboy 2018-08-26 20:55

Re: Wind speed and direction on lockscreen
 
Okay, I had it working, dynamically. \it was spewing out some odd figures. so I changed the int value of configgroup and the numbers came up correctly. But in my Label in Clock.qml, I've fiddled with the 'text:' part and cannot remember what I had it written as - now I can't see homescreen when i restart lipstick, bollocks! :D
As soon as I can recall what the line of code was, I can convert the output to letters. So, yeha, cool, with a few tweaks, it works more or les as expected!, now.......what did I write in that Label text ????? (doh!)

Markkyboy 2018-08-27 08:01

Re: Wind speed and direction on lockscreen
 
Okay, I got it working again, silly editing mistake. It is still spewing some odd figures and so getting the output as text is not working as it should. one of the figures was 405, which is 360 + 45. 360 is not or should I say, isn't one of the ouputs we expect, there is some maths applied to rotation of WindDirectionIcon in WeatherDetailsHeader but it is being ignored, it is this maths that prevents spewing of figures above 315 degrees; (rotation: model ? model ? windDirection +180 : -1).

My output changes to whatever weather destination is chosen in sailfish-weather, but I cannot assign compass bearing text (N, NE, etc) with the config spitting out figures above 315. I have tried applying the '+ 180 : -1' math in various places but to no avail.

Ancelad 2018-08-27 12:44

Re: Wind speed and direction on lockscreen
 
You can do something like "angle - 360" if angle is more than 360.

Markkyboy 2018-08-27 13:44

Re: Wind speed and direction on lockscreen
 
So, the code gets more and more complex/bitty to get over a problem that is already gotten over in the weather app.

ConfigurationGroup is clearly calling on WindDirection module, yes? (I believe it is?), in which case, 360 does not exist. The scope of compass points starts with a default of 0(north) and ends at 315(nw) back to 0(north), so I have no idea where the adding up is coming from. I'm seeing 405 and 450, which is clearly (again) 405 + 45(angle)=450, this is no good when it comes to naming (N, NE, S, SE, etc).

I'm not getting on at you by the way, I appreciate your help, but I am frustrated at how hard this is to achieve. I honestly thought I would have licked this months ago.

In WeatherDetailsHeader.qml under id: weatherIconDirection, we have a line of code; rotation: model ? model.direction +180 : -1 // this is what prevents figures like 360 or 405 from being presented, would you agree with that?, I do believe this is the case and have tried inserting it in various places, but then the output on lockscreen does not even appear.

At some point soon, I will paste my current code here, as I have added more to what you've already created, at least then we can sing from the same hymn sheet!

I wouldn't know where to put 'angle - 360' or how to tie it in with the current problem, especially as 360 shouldn't exist in this scenario. Weird, oh well, I have the rest of my life to figure it out :D


All times are GMT. The time now is 09:56.

vBulletin® Version 3.8.8