Actually a digital readout is useful

This commit is contained in:
M1dgard 2018-05-20 23:44:30 +02:00
parent 385ea67efd
commit 4e13e22dee
Signed by untrusted user who does not match committer: midgard
GPG key ID: 511C112F1331BBB4

View file

@ -26,20 +26,20 @@ try:
minute = minutehands[ t.minute // 5 ]
hour = hourhands [ t.hour % 12 ]
return "%{F000}%{O-24}" + hour + "%{O-24}" + minute
return color_for(t) + "%{T8}%{F#000}%{O-24}" + hour + "%{O-24}" + minute + "%{T-}%{F}"
def color_for(t):
if t.hour < 5 or t.hour > 22:
return "888"
return "%{F#888}"
elif t.hour < 10:
return "DB9"
return "%{F#DB9}"
elif t.hour < 14:
return "DDB"
return "%{F#DDB}"
elif t.hour < 19:
return "DDD"
return "%{F#DDD}"
else:
return "D9B"
return "%{F#D9B}"
while True:
@ -47,22 +47,21 @@ try:
localnow = datetime.now()
leftnow = utcnow.astimezone(tzleft )
rightnow = utcnow.astimezone(tzright)
localcolor = color_for(localnow)
print(
localnow.strftime("%A") +
" " +
"%{T8}%{F#" + color_for(leftnow) + "}" +
face_for(leftnow) +
"%{F}%{T-}" +
" %{F"+color_for(localnow)+"}" +
# "%{T4}" + localnow.strftime("%H:%M") + "%{T-}" +
"%{T8}" + face_for(localnow) + "%{T-}" +
"%{F} " +
" %{T4}" + localcolor + localnow.strftime("%H") +
"%{O2}%{T8}" + face_for(localnow) +
"%{O2}%{T4}" + localcolor + localnow.strftime("%M") + "%{T-}" +
" " +
"%{T8}%{F#" + color_for(rightnow) + "}" +
face_for(rightnow) +
"%{F}%{T-}" +
" " +
localnow.strftime("%d %b"),