MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / _fetch_network_data

Method _fetch_network_data

display.py:1003–1022  ·  view source on GitHub ↗

Fetch real host data from database.

(self)

Source from the content-addressed store, hash-verified

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&#x27;t
1022 overlap the header&#x27;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 """

Callers

nothing calls this directly

Calls 3

get_all_hostsMethod · 0.80
debugMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected