Coverage for control/typ/cust/score.py : 100%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1from config import Config as C, Names as N
2from control.html import HtmlElements as H
3from control.utils import pick as G, E
4from control.typ.value import Value
6CW = C.web
8Qq = H.icon(CW.unknown[N.generic], asChar=True)
11class Score(Value):
12 """Type class for scores."""
14 def __init__(self, context):
15 super().__init__(context)
17 def titleStr(self, record, markup=True, **kwargs):
18 """Put the score and the level in the title."""
20 score = G(record, N.score)
21 if score is None:
22 return E if markup is None else Qq
24 levelBare = G(record, N.level)
25 return (
26 f"""{score or E} - {levelBare or E}"""
27 if markup is None
28 else f"""{H.he(score)} - {H.he(levelBare) or Qq}"""
29 )