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

Method draw

pager/pager_display.py:818–844  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

816 DY = (self.height - DH) // 2 # 37
817
818 def draw():
819 # Box
820 self.pager.fill_rect(DX, DY, DW, DH, self.CARD_BG)
821 self.pager.rect(DX, DY, DW, DH, self.CYAN)
822 self.pager.rect(DX + 2, DY + 2, DW - 4, DH - 4, self.DARK_GRAY)
823
824 # Label — 16px (TTF_MEDIUM), readable
825 lw = self.pager.ttf_width(label[:28], self.font_arial, 16)
826 self.pager.draw_ttf((self.width - lw) // 2, DY + 10, label[:28],
827 self.WHITE, self.font_arial, 16)
828
829 # Value — 36px, very prominent
830 val_str = str(current)
831 vw = self.pager.ttf_width(val_str, self.font_arial, 36)
832 self.pager.draw_ttf((self.width - vw) // 2, DY + 38, val_str,
833 self.CYAN, self.font_arial, 36)
834
835 # Range hint — 13px (TTF_SMALL)
836 hint = f"{min_val} - {max_val} step {step}"
837 hw = self.pager.ttf_width(hint, self.font_arial, 13)
838 self.pager.draw_ttf((self.width - hw) // 2, DY + 94, hint,
839 self.GRAY, self.font_arial, 13)
840
841 # Button hints — 13px
842 self.pager.draw_ttf_centered(DY + 118, "UP: increase DOWN: decrease A: save B: cancel",
843 self.GRAY, self.font_arial, 13)
844 self.pager.flip()
845
846 draw()
847

Callers 1

displayMethod · 0.80

Calls 6

fill_rectMethod · 0.45
rectMethod · 0.45
ttf_widthMethod · 0.45
draw_ttfMethod · 0.45
draw_ttf_centeredMethod · 0.45
flipMethod · 0.45

Tested by

no test coverage detected