Fetch real host data from database.
(self)
| 1001 | return f |
| 1002 | |
| 1003 | def _fit_font(self, font_name, base_font, text, max_w): |
| 1004 | """Pick the largest `font_name` size ≤ base that renders `text` within |
| 1005 | `max_w` px. Used so page titles shrink instead of clipping on the 128px |
| 1006 | LCD; on roomy e-paper the base font already fits, so this is a no-op.""" |
| 1007 | if not text or base_font is None or base_font.getlength(text) <= max_w: |
| 1008 | return base_font |
| 1009 | base_size = getattr(base_font, 'size', 13) |
| 1010 | for size in range(base_size - 1, 6, -1): |
| 1011 | f = self._font_at(font_name, size) |
| 1012 | if f.getlength(text) <= max_w: |
| 1013 | return f |
| 1014 | return self._font_at(font_name, 7) |
| 1015 | |
| 1016 | def _unit_display_title(self): |
| 1017 | """Brand name for the panel headers. |
| 1018 | |
| 1019 | Default is 'RAGNAR'. Once the unit is on the mesh with a Viking name it |
| 1020 | shows that name abbreviated to 'FIRSTNAME I' — e.g. 'Sigrid Ringbearer' |
| 1021 | -> 'SIGRID R' — so it stays about as short as 'RAGNAR' and doesn't |
| 1022 | overlap the header's IP/battery. Where a panel is still too narrow, |
| 1023 | _fit_font shrinks the type the rest of the way. Cached (keyed on the |
| 1024 | configured name) so the per-frame render never re-derives it. |
| 1025 | """ |
nothing calls this directly
no test coverage detected