Skip to content

Commit

Permalink
some layout enhancements #67
Browse files Browse the repository at this point in the history
  • Loading branch information
roe-dl committed Aug 8, 2024
1 parent 95d3d36 commit 07900d8
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions bin/user/weatherserviceshealth.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,9 @@ def __init__(self, name, conf_dict, archive_interval):
self.plusminus_icon_size = weeutil.weeutil.to_int(
conf_dict.get('plusminus_icon_size',20)
)
self.thermalstress_icon_size = weeutil.weeutil.to_int(
conf_dict.get('thermalstress_icon_size', self.plusminus_icon_size*2)
)
# orientation of the HTML table
orientation = conf_dict.get('orientation','h,v')
if not isinstance(orientation,list):
Expand Down Expand Up @@ -675,7 +678,7 @@ def write_html(self, tabtimespans, area_name, last_update, now):
timespansvalue = False
for ii,val in timespans.items():
s += '<th width="%d%%" scope="col">%s<br />%s' % (colwidth,ii[0],ii[1])
if ii[2]: s += '<br />%s' % ii[2]
if ii[2]: s += '<br />%s' % ii[2].replace('Tageshälfte','Tages&shy;hälfte')
s += '</th>'
if val is not None: timespansvalue = True
s += '</tr>'
Expand Down Expand Up @@ -728,7 +731,7 @@ def write_html(self, tabtimespans, area_name, last_update, now):
col = ''
if self.model=='biowetter':
if ii=='Thermische Belastung':
effect = thermalstress_symbol(effect,self.plusminus_icon_size*2)
effect = thermalstress_symbol(effect,self.thermalstress_icon_size)
else:
effect = symbol(effect,self.plusminus_icon_size)
if self.model=='pollen':
Expand All @@ -738,7 +741,7 @@ def write_html(self, tabtimespans, area_name, last_update, now):
else:
s += effect
if 'recomm' in tab[ii][jj] and tab[ii][jj]['recomm']!='keine':
s += '<br /><strong>%s:</strong><br />%s' % ('Empfehlung',tab[ii][jj]['recomm'])
s += '<span class="hidden-xs hidden-sm"><br /><strong>%s:</strong><br />%s</span>' % ('Empfehlung',tab[ii][jj]['recomm'])
if self.model=='pollen':
s += '</span>'
s += '</td>'
Expand All @@ -760,6 +763,14 @@ def write_html(self, tabtimespans, area_name, last_update, now):
txt = ii if sym==ii else '%s&nbsp;%s' % (sym,ii)
s += '<li style="display:inline-block;padding-left:1em;padding-right:1em">%s</li>' % txt
s += '</ul>'
elif self.model=='pollen':
s += '<ul class="visible-xs-block" style="list-style:none;width:100%;padding:0;margin-left:-1em;margin-bottom:auto">'
s += '<li style="display:inline-block;padding-left:1em;padding-right:1em">Belastung:</li>'
for idx, col in enumerate(DwdHealthThread.POLLEN_COLORS):
txt = ('keine','keine bis gering','gering','gering bis mittel','mittel','mittel bis hoch','hoch')[idx]
tcl = '#ffffff' if idx==0 or idx>3 else '#000000'
s += ('<li style="display:inline-block;padding-left:1em;padding-right:1em"><span style="background-color:%s;color:%s">&nbsp;%3.1f&nbsp;</span> %s</li>' % (col,tcl,idx*0.5,txt)).replace('.',',')
s += '</ul>'
s += '<p style="font-size:65%%">herausgegeben vom <a href="%s" target="_blank">%s</a> am %s | Vorhersage erstellt am %s</p>' % (
self.provider_url,self.provider_name,
time.strftime('%d.%m.%Y %H:%M',time.localtime(last_update)),
Expand Down

0 comments on commit 07900d8

Please sign in to comment.