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? |
Re: Sailfish weather on lockscreen
Tried copying that file, but nothing shows up on lock screen ?
SFOS-x 2.1.4 |
Re: Sailfish weather on lockscreen
Quote:
Code:
WeatherBanner { |
Re: Sailfish weather on lockscreen
Huh, you can explore my analog clock patch
|
Re: Sailfish weather on lockscreen
Quote:
|
Re: Sailfish weather on lockscreen
Clock from pm2 web-catalog. It doesn't show things you want, but probably will help.
|
Re: Sailfish weather on lockscreen
Quote:
Quote:
@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 |
Re: Sailfish weather on lockscreen
Is this editable such that I can change it to show dawn & dusk (in place of windspeed / direction)?
Quote:
|
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. |
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 |
Re: Wind speed and direction on lockscreen
Quote:
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:
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. |
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?
|
Re: Wind speed and direction on lockscreen
Quote:
|
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 { 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); |
Re: Wind speed and direction on lockscreen
Quote:
And by the way, what do you do with the variable 'windDirectionText' ? I can't see it used anywhere except for setting its value ? |
Re: Wind speed and direction on lockscreen
Quote:
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 |
Re: Wind speed and direction on lockscreen
I am not sure I understand.
Quote:
Quote:
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 { 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). |
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, |
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 |
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:
|
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) |
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! |
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 { Code:
--- /dev/null |
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. |
Re: Wind speed and direction on lockscreen
Weather comes to lockscreen through eventsview in my case.
|
Re: Wind speed and direction on lockscreen
Quote:
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 |
Re: Wind speed and direction on lockscreen
Share your files and I will check.
|
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
|
Re: Wind speed and direction on lockscreen
I added this to lipstick-jolla-home-qt5/lockscreen/Clock.qml;
Code:
WindDirection { Code:
import QtQuick 2.2 |
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 Code:
ConfigurationGroup { Code:
import org.nemomobile.configuration 1.0 Code:
ConfigurationGroup { Code:
Text { I'm not sure if it will work dynamically but it should... |
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..? |
Re: Wind speed and direction on lockscreen
Quote:
|
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? |
Re: Wind speed and direction on lockscreen
Yes, it shows different values according weather-forecast (I've changed system date some times to see).
|
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/ |
Re: Wind speed and direction on lockscreen
I've used my analog clock configuration path for test.
|
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!) |
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. |
Re: Wind speed and direction on lockscreen
You can do something like "angle - 360" if angle is more than 360.
|
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