Coverage for control/typ/cust/criteriaEntry.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.utils import pick as G, E
3from control.html import HtmlElements as H
4from control.typ.master import Master
6CW = C.web
8Qn = H.icon(CW.unknown[N.number], asChar=True)
9Qq = H.icon(CW.unknown[N.generic], asChar=True)
12class CriteriaEntry(Master):
13 """Type class for criteria entries."""
15 def __init__(self, context):
16 super().__init__(context)
18 def titleStr(self, record, markup=True, **kwargs):
19 """The title is a sequence number plus the short criterion text."""
21 context = self.context
22 types = context.types
24 seqBare = G(record, N.seq)
25 eid = G(record, N.criteria)
26 titleBare = (
27 E if eid is None else types.criteria.title(eid=eid, markup=markup, **kwargs)
28 )
29 return (
30 f"""{seqBare or E}.{titleBare}"""
31 if markup is None
32 else f"""{H.he(seqBare) or Qn}. {Qq if titleBare is None else titleBare}"""
33 )