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, WHYPHEN
4from control.typ.value import Value
7CW = C.web
9Qq = H.icon(CW.unknown[N.generic], asChar=True)
12class TypeContribution(Value):
13 """Type class for contribution types."""
15 def __init__(self, context):
16 super().__init__(context)
18 def titleStr(self, record, markup=True, **kwargs):
19 """Put the main type and the sub type in the title."""
21 if not record:
22 return E if markup is None else Qq
24 mainType = G(record, N.mainType) or E
25 subType = G(record, N.subType) or E
26 sep = WHYPHEN if mainType and subType else E
27 valBare = f"""{mainType}{sep}{subType}"""
28 return valBare if markup is None else H.he(valBare)
30 def titleHint(self, record):
31 return H.join(G(record, N.explanation) or [])