k-donn / plasmoid-wunderground

A Plasma 5/6 widget for showing data from Wunderground PWS
https://store.kde.org/p/2135799
GNU General Public License v2.0
35 stars 12 forks source link

Today's forecast and high/low temperatures #16

Closed jat255 closed 3 years ago

jat255 commented 3 years ago

Thanks for such a great plasmoid @k-donn!

I was thinking, I often look at this plasmoid in the morning to get a sense of what to expect for the day, and there's two places that could be improved.

On the "Forecast" tab, including the current day's forecast would be great (it currently starts on the next day, but it looks like today's data is included in the API response).

Also, on the "Details" tab, including today's forecasted high and low temperatures could be a nice addition as well. It looks like the current data API does not include this, so it would have to be sourced from the forecast API.

I'd be interested in helping add this, but I have never done any plasmoid development, so I'm not exactly sure where to start.

jat255 commented 3 years ago

Point 1 above looks like maybe just changing this loop from starting at 1 to 0 might do it?

https://github.com/k-donn/plasmoid-wunderground/blob/733d26aba42632b1cb638502da82d8b2c45b4fc0/plasmoid/contents/code/pws-api.js#L145

Then point 2 looks like (assuming the change above is made), you could change https://github.com/k-donn/plasmoid-wunderground/blob/733d26aba42632b1cb638502da82d8b2c45b4fc0/plasmoid/contents/ui/DetailsItem.qml to include an additional label that pulls from forecastModel[0].dayHigh (or dayLow) -- I'm sure that syntax isn't exactly right, but something like that should work, I think.

k-donn commented 3 years ago

Hey, thanks for using my widget and making suggestions!

For the first point, after 3:00pm or 15:00 local time the API stops sending daytime forecast information. After 15:00, the API only sends the nighttime forecast. That was why the loop you mentioned starts at 1 and not 0 since the 0th element might not have all the info on it. I was lazy earlier and didn't think about implementing something to get around this.

However, it sends the current day forecast prior to 15:00 and I could add that. I would just have to add in a check to make sure that the day object at pws-api.js:148 is not null. If day is null, then I would write the current-night forecast values to the forecastModel.

For point 2, I would add the high/low information at the top of the widget itself next to the icon and condition statement. new-design Something like that; I think it would flow better.

If you want to get more into plasmoid development, check out Zren's tutorial on development. He's helped me a bunch, and thanks again for the input!

jat255 commented 3 years ago

Gotcha on the API response. That makes sense why it's only the next day in that case. If it's not too hard to add that check (which the null check you mentioned seems like an easy way to do it), that would be great to have. And I like your idea for putting the hi/low in with the icon, there's a decent amount of empty space there that I agree is a good spot for it.

As an aside, I'm wondering why your widget looks fairly different than mine:

image

(mainly referring to the highlighting of the tabs, the fonts, and the rounded corners). Is that controlled by the global plasma theme? I tried playing around with those and couldn't see anything that made it match.

And thanks for the link to the tutorial. If I get a bit of time in the next little bit, these features seem like a not-to-hard way to get my feet wet, so maybe I'll take a stab at it (or if it's easy for you and you want to do it, of course feel free!).

k-donn commented 3 years ago

I don't really know what controls the plasmoid style on KDE plasma. As far as I know, the linux distribution you are on changes it. I've been wanting to give this widget the attention it needs, and I'll be happy to care of these changes!

jat255 commented 3 years ago

Hooray! Thanks!

image