review.page.PageSpec(
title,
items,
questions,
start_key,
save_key,
kind,
file_prefix,
top,
columns,
intro_html='',
start_label='Start',
save_label='Save',
meta=(),
)
Everything a page shows and exports.
Attributes
| title |
str |
The page title. |
| intro_html |
str |
Text above the items; long material belongs in details. |
| items |
tuple[Item, …] |
The items in the order shown. |
| questions |
tuple[Question, …] |
The fields of every item; they lock for good when saved. |
| start_key |
str |
The state key of the time of the start button. |
| save_key |
str |
The state key of the time of the save. |
| start_label |
str |
The text of the start button. |
| save_label |
str |
The text of the save button. |
| meta |
tuple[MetaField, …] |
The texts typed once; all are required to export. |
| kind |
str |
The file kind the export writes (a key of babregen.review.formats.FIELDS) with exactly one array of tables, one table per item. |
| file_prefix |
str |
The downloaded file is <file_prefix>-<hash8>.toml. |
| top |
tuple[Column, …] |
The export columns of the top level of the file, in the order of the kind. |
| columns |
tuple[Column, …] |
The export columns of the table of one item, in the order of the kind. Every required key of the kind needs a column. |
Examples
from babregen.review.page import Column, Item, PageSpec, Question
from babregen.review.vocab import VERDICTS
spec = PageSpec(
title="Demo",
items=(Item("a", "A", consts={"unit": "u", "id": "M1"}),),
questions=(Question("verdict", "Verdict", choices=VERDICTS),),
start_key="shown_at", save_key="rated_at",
kind="gate-verdicts", file_prefix="demo", top=(), columns=(),
)
print(len(spec.items))