Some layout improvements.
authorScott Gasch <[email protected]>
Tue, 7 Apr 2026 04:02:39 +0000 (21:02 -0700)
committerScott Gasch <[email protected]>
Tue, 7 Apr 2026 04:02:39 +0000 (21:02 -0700)
kiosk.py
ratago_renderer.py

index fe9e174262537b5267541d52483a8f3d746152ab..55b14920c723caaea8cd5610ee56cc47ca04d60b 100755 (executable)
--- a/kiosk.py
+++ b/kiosk.py
@@ -402,32 +402,29 @@ def emit_wrapped(
   // Zoom the 'contents' div to fit without scrollbars and then make
   // it visible.
   function zoomScreen() {
-    z = 285;
+    var content = document.getElementById("content");
+
+    // If we are on the photo page, skip zooming and show immediately
+    if (document.querySelector('.kiosk-container')) {
+        content.style.zoom = "100%";
+        content.style.visibility = "visible";
+        return;
+    }
+
+    // Legacy zoom logic for other pages
+    var z = 285;
     do {
-      document.getElementById("content").style.zoom = z+"%";
+      content.style.zoom = z + "%";
       var body = document.body;
       var html = document.documentElement;
-      var height = Math.max(body.scrollHeight,
-                            body.offsetHeight,
-                            html.clientHeight,
-                            html.scrollHeight,
-                            html.offsetHeight);
-      var windowHeight = window.innerHeight;
-      var width = Math.max(body.scrollWidth,
-                           body.offsetWidth,
-                           html.clientWidth,
-                           html.scrollWidth,
-                           html.offsetWidth);
-      var windowWidth = window.innerWidth;
-      var heightRatio = height / windowHeight;
-      var widthRatio = width / windowWidth;
-
-      if (heightRatio <= 1.0 && widthRatio <= 1.0) {
+      var height = Math.max(body.scrollHeight, html.clientHeight);
+      var width = Math.max(body.scrollWidth, html.clientWidth);
+      if (height <= window.innerHeight && width <= window.innerWidth) {
         break;
       }
       z -= 4;
     } while(z >= 70);
-    document.getElementById("content").style.visibility = "visible";
+    content.style.visibility = "visible";
   }
 
   // Load IMG tags with DATA-SRC attributes late.
@@ -552,10 +549,11 @@ def emit_wrapped(
 """
         % kiosk_constants.root_url
     )
+
     f.write(f'<BODY BGCOLOR="#{bgcolor}">')
     f.write(
         """
-    <TABLE style="height:100%; width:100%" BORDER=0>
+    <TABLE style="width:100%" BORDER=0>
     <TR HEIGHT=30>
         <TD ALIGN="left">
             <DIV id="date">&nbsp;</DIV>
@@ -567,38 +565,36 @@ def emit_wrapped(
             <DIV id="time">&nbsp;</DIV>
         </TD>
     </TR>
-    <TR STYLE="vertical-align:top">
-        <TD COLSPAN=3>
-            <DIV ID="content" STYLE="zoom: 1; visibility: hidden;">
-              <!-- BEGIN main page contents. -->
+    </TABLE>
+    <DIV ID="content" STYLE="flex: 1; width: 100%; visibility: hidden;">
+        <!-- BEGIN main page contents. -->
 """
     )
     f.write(f'<!--#include virtual="{filename}"-->')
     f.write(
         """
-            <!-- END main page contents. -->
-            </DIV>
-            <BR>
-            <DIV STYLE="position: absolute; top:1030px; width:99%">
-            <P ALIGN="right">
+        <!-- END main page contents. -->
+    </DIV>
+    <DIV STYLE="position: absolute; bottom: 0; width: 100%; left: 0;">
+    <!--    <DIV STYLE="position: absolute; top:1030px; width:99%"> -->
+        <P ALIGN="right" STYLE="margin: 0 10px 2px 0;">
 """
     )
-    f.write(f"<FONT SIZE=2 COLOR=#bbbbbb>{pageid} @ {age} ago.</FONT>")
+    f.write(
+        '<span style="font-size: 0.6rem; color: #888888; font-family: monospace;">'
+        f'{pageid} @ {age} ago.</span>'
+    )
     f.write(
         """
-            </P>
-            <HR id="countdown" STYLE="width:0px;
-                                      text-align:left;
-                                      margin:0;
-                                      border:none;
-                                      border-width:0;
-                                      height:5px;
-                                      visibility:hidden;
-                                      background-color:#ffffff;">
-            </DIV>
-        </TD>
-    </TR>
-    </TABLE>
+        </P>
+        <HR id="countdown" STYLE="width: 0px;
+                                  text-align: left;
+                                  margin: 0;
+                                  border: none;
+                                  height: 5px;
+                                  visibility: hidden;
+                                  background-color: maroon;">
+    </DIV>
 </BODY>"""
     )
 
@@ -731,14 +727,14 @@ def main() -> None:
                 # point number within [0, 1]. A higher sensitivity
                 # reduces the miss rate at the cost of increased false
                 # alarm rate.
-                sensitivities = [0.4] * len(keyword_paths)
-                listener = listen.HotwordListener(
-                    command_queue,
-                    keyword_paths,
-                    sensitivities,
-                )
-                hotword_thread = Thread(target=listener.listen_forever, args=())
-                hotword_thread.start()
+                #sensitivities = [0.4] * len(keyword_paths)
+                #listener = listen.HotwordListener(
+                #    command_queue,
+                #    keyword_paths,
+                #    sensitivities,
+                #)
+                #hotword_thread = Thread(target=listener.listen_forever, args=())
+                #hotword_thread.start()
 
             if changer_thread is None or not changer_thread.is_alive():
                 if changer_thread is None:
index ef89765fe4d33e12fcc3051e5332ce75453909f5..59ebaaebb3d96c130c0f5c4722debc16880ae7fb 100644 (file)
@@ -73,8 +73,7 @@ class ratago_renderer(renderer.abstaining_renderer):
     def update_page(self) -> bool:
         with file_writer.file_writer(kiosk_constants.ratago_pagename) as f:
             f.write(
-                f"""
-<H1>Garage Door Status</H1>
+                f"""<H1>Garage Door Status</H1>
 <!-- Last updated at {self.last_update} -->
 <HR>
 <TABLE BORDER=0 WIDTH=99%>