projects
/
kiosk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Changes needed to get the kiosk to run on the rpi.
[kiosk.git]
/
health_renderer.py
diff --git
a/health_renderer.py
b/health_renderer.py
index 774e0babc893967a83b9562f2f7e60e53de2d803..d369630429bb1441f4b1fe3d6dc058cce6d01dbe 100644
(file)
--- a/
health_renderer.py
+++ b/
health_renderer.py
@@
-61,27
+61,31
@@
class periodic_health_renderer(renderer.debuggable_abstaining_renderer):
now = time.time()
n = 0
now = time.time()
n = 0
- for
x in sorted(limits
):
- ts = os.stat(
x
).st_mtime
+ for
filepath, limit_sec in sorted(limits.items()
):
+ ts = os.stat(
filepath
).st_mtime
age = now - ts
age = now - ts
- self.debug_print("%s -- age is %ds, limit is %ds" % (x, age, limits[x]))
- if age < limits[x]:
+ self.debug_print(f"{filepath} -- age: {age}, limit {limit_sec}")
+ if age < limits[filepath]:
+ # OK
f.write(
f.write(
- '<TD BGCOLOR="#007010" HEIGHT=100 WIDTH=33% STYLE="text-size:
6
0%; vertical-align: middle;">\n'
+ '<TD BGCOLOR="#007010" HEIGHT=100 WIDTH=33% STYLE="text-size:
7
0%; vertical-align: middle;">\n'
)
)
+ txt_color="#ffffff"
else:
else:
+ # BAD!
f.write(
f.write(
- '<TD BGCOLOR="#990000" HEIGHT=100 WIDTH=33% CLASS="invalid" STYLE="text-size:
6
0%; vertical-align:middle;">\n'
+ '<TD BGCOLOR="#990000" HEIGHT=100 WIDTH=33% CLASS="invalid" STYLE="text-size:
7
0%; vertical-align:middle;">\n'
)
)
- f.write(" <CENTER><FONT SIZE=-2>\n")
+ txt_color="#000000"
+ f.write(f" <CENTER><FONT SIZE=-1 COLOR={txt_color}>\n")
- name =
x
.replace(timestamps, "")
+ name =
filepath
.replace(timestamps, "")
name = name.replace("last_", "")
name = name.replace("_", " ")
name = name.replace("last_", "")
name = name.replace("_", " ")
-
ts = utils.describe_duration_briefly(age
)
+
duration = utils.describe_duration_briefly(int(age)
)
- self.debug_print(f"{name} is {
ts
} old.")
- f.write(f"{name}<BR>\n<B>{
ts
}</B> old.\n")
+ self.debug_print(f"{name} is {
duration
} old.")
+ f.write(f"{name}<BR>\n<B>{
duration
}</B> old.\n")
f.write("</FONT></CENTER>\n</TD>\n\n")
n += 1
if n % 3 == 0:
f.write("</FONT></CENTER>\n</TD>\n\n")
n += 1
if n % 3 == 0:
@@
-151,5
+155,5
@@
class periodic_health_renderer(renderer.debuggable_abstaining_renderer):
)
)
-#
test = periodic_health_renderer({"Test", 123})
-#
test.periodic_render("Test")
+#test = periodic_health_renderer({"Test", 123})
+#test.periodic_render("Test")