Skip to content

Commit

Permalink
Added show_precip_detail. GH-231
Browse files Browse the repository at this point in the history
  • Loading branch information
Daveiano committed Dec 12, 2023
1 parent 930411d commit 88c07d3
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 35 deletions.
3 changes: 2 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -754,4 +754,5 @@ See https://github.com/Daveiano/weewx-wdc/compare/v3.3.0...580071ca175a03fe4924b
- Open Webcam Links/Stat Tile links in a Modal GH-220
- Bugfix: Max Rain Rate Does Not Reset GH-224
- Added MQTT connection with username/password GH-225
- Added finnish translation GH-230
- Added finnish translation GH-230
- Added "Precipitation detail" on forecast display (show rain/snow separately) GH-231
2 changes: 2 additions & 0 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ def __init__(self):
"skins/weewx-wdc/includes/icons/forecast/rain--scattered.svg",
"skins/weewx-wdc/includes/icons/forecast/thunderstorm.svg",
"skins/weewx-wdc/includes/icons/forecast/thunderstorm--scattered.svg",
"skins/weewx-wdc/includes/icons/forecast/rain-drop.svg",
"skins/weewx-wdc/includes/icons/forecast/snowflake.svg",
],
),
],
Expand Down
70 changes: 36 additions & 34 deletions skins/weewx-wdc/includes/forecast-table.inc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#set $show_moon = 0
#set $show_pop = 1
#set $show_precip = 1
#set $show_precip_detail = 1
#set $show_obvis = 0

#set $local_settings = dict()
Expand Down Expand Up @@ -67,6 +68,7 @@
#set $show_moon = int($local_settings.get('show_moon', $show_moon))
#set $show_pop = int($local_settings.get('show_pop', $show_pop))
#set $show_precip = int($local_settings.get('show_precip', $show_precip))
#set $show_precip_detail = int($local_settings.get('show_precip_detail', $show_precip_detail))
#set $show_obvis = int($local_settings.get('show_obvis', $show_obvis))

#set $num_days = $local_settings.get('num_days', $num_days)
Expand Down Expand Up @@ -456,63 +458,75 @@

#set $lastday = $thisday
#set $summary = $forecast.weather_summary($forecast_source, $period.event_ts.raw, periods=$periods)
<!--prettier-ignore-->
<bx-structured-list-cell class="index-$x">
<!--prettier-ignore-->
#if $summary.pop.raw is not None and $summary.pop.raw > 0
$summary.pop.format('%.0f','')
#end if
</bx-structured-list-cell>
<!--prettier-ignore-->
#end if
#end for
</bx-structured-list-row>
#end if

<!--prettier-ignore-->
#if $show_precip
#set $vertical_align = "top" if $show_precip_detail else "bottom"
<bx-structured-list-row class="rain">
#if $show_legend
<bx-structured-list-cell style="vertical-align: bottom">
$obs.label.rain <br />
<bx-structured-list-cell style="vertical-align: $vertical_align">
$gettext('Precipitation') <br />
<span class="unit-label">in $unit.label.rain</span>
</bx-structured-list-cell>
#end if

<!--prettier-ignore-->
#for $x, $period in enumerate($periods)
#set $thisday = $period.event_ts.format('%d')
#if $lastday != $thisday

#set $lastday = $thisday
#set $summary = $forecast.weather_summary($forecast_source, $period.event_ts.raw, periods=$periods)
<!--prettier-ignore-->
<bx-structured-list-cell class="index-$x" style="vertical-align: bottom">

<bx-structured-list-cell class="index-$x" style="vertical-align: $vertical_align">
#set $rain = $summary.qpf.raw is not None and $summary.qpf.raw > 0
#set $snow = $summary.qsf.raw is not None and $summary.qsf.raw > 0
#if $rain or $snow
#if $rain and not $snow
<!-- include 'includes/icons/forecast/rain.svg' -->
$summary.qpf.nolabel('%.2f','')
#end if
<div class="precip-main">
#if $rain and not $snow
$summary.qpf.nolabel('%.2f','')
#end if

#if $snow and not $rain
<!-- include 'includes/icons/forecast/snow.svg' -->
$summary.qsf.nolabel('%.2f','')
#end if
#if $snow and not $rain
$summary.qsf.nolabel('%.2f','')
#end if

#if $rain and $snow
<!-- include 'includes/icons/forecast/sleet.svg' -->
#set $q_pf_sf = '{:.2f}'.format($summary.qpf.raw + $summary.qsf.raw)
$q_pf_sf
#if $rain and $snow
<!-- include 'includes/icons/forecast/sleet.svg' -->
#set $q_pf_sf = '{:.2f}'.format($summary.qpf.raw + $summary.qsf.raw)
$q_pf_sf
#end if
</div>

#if $show_precip_detail
#if $rain
<div class="precip-detail">
#include 'includes/icons/forecast/rain-drop.svg'
$summary.qpf.nolabel('%.2f','')
</div>
#end if

#if $snow
<div class="precip-detail">
#include 'includes/icons/forecast/snowflake.svg'
$summary.qsf.nolabel('%.2f','')
</div>
#end if
#end if

#end if

#if not $rain and not $snow
-
#end if
</bx-structured-list-cell>
<!--prettier-ignore-->
#end if
#end for
</bx-structured-list-row>
Expand All @@ -522,7 +536,6 @@
</bx-structured-list-body>
</bx-structured-list>

<!--prettier-ignore-->
#if $show_hourly
#set $periods = $all_periods
<bx-structured-list class="forecast-list hourly" style="display: none">
Expand All @@ -532,7 +545,6 @@
#if $show_legend
<bx-structured-list-header-cell></bx-structured-list-header-cell>
#end if
<!--prettier-ignore-->
#for $x, $period in enumerate($periods)

#set $thisday = $period.event_ts.format('%d')
Expand All @@ -545,9 +557,7 @@
<span class="day">$period.event_ts.format('%a')</span>
<br />
#end if
<!--prettier-ignore-->
#if $show_date
<!--prettier-ignore-->
<span class="date">
#if $lastday != $thisday
$period.event_ts.format('%d %b')<br />
Expand All @@ -556,7 +566,6 @@
</span>
#end if
</bx-structured-list-header-cell>
<!--prettier-ignore-->
#if $lastday != $thisday
#set $lastday = $thisday
#end if
Expand All @@ -571,18 +580,14 @@
<bx-structured-list-cell>$gettext("Outlook")</bx-structured-list-cell>
#end if

<!--prettier-ignore-->
#for $x, $period in enumerate($periods)
<bx-structured-list-cell class="index-$x">
<!--prettier-ignore-->
#include "includes/icons/forecast/" + $get_day_icon($period, hourly=True)
</bx-structured-list-cell>
<!--prettier-ignore-->
#end for
</bx-structured-list-row>
#end if

<!--prettier-ignore-->
#if $show_temp
<bx-structured-list-row>
#if $show_legend
Expand All @@ -592,17 +597,14 @@
</bx-structured-list-cell>
#end if

<!--prettier-ignore-->
#for $x, $period in enumerate($periods)
<bx-structured-list-cell class="index-$x">
<span> $period.temp.nolabel('%.0f') </span>
</bx-structured-list-cell>
<!--prettier-ignore-->
#end for
</bx-structured-list-row>
#end if

<!--prettier-ignore-->
#if $show_dewpoint and $period.dewpoint is not None
<bx-structured-list-row>
#if $show_legend
Expand Down
25 changes: 25 additions & 0 deletions skins/weewx-wdc/includes/icons/forecast/rain-drop.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions skins/weewx-wdc/includes/icons/forecast/snowflake.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions skins/weewx-wdc/skin.conf
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ SKIN_VERSION = 3.5.0-alpha1
show_moon = 1
show_pop = 1
show_precip = 1
show_precip_detail = 1

# For instructions, see https://github.com/Daveiano/weewx-wdc/wiki/Support-for-weewx-DWD
#[[weewx-DWD]]
Expand Down
12 changes: 12 additions & 0 deletions skins/weewx-wdc/src/scss/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,18 @@ div[id^="panel"] .tile-radar-forecast {
& ~ .forecast {
margin-top: $spacing-06;
}
.precip-main + .precip-detail {
margin-top: $spacing-04;
}
div.precip-detail {
display: flex;
align-items: center;
svg {
max-width: 16px;
height: auto;
margin-right: 5px;
}
}
// bx-structured-list-row,
// bx-structured-list-header-row {
// @include carbon--breakpoint-down(md) {
Expand Down

0 comments on commit 88c07d3

Please sign in to comment.