NOTICE: All information contained herein is, and remains
the property of TechnoCore.
The intellectual and technical concepts contained
herein are proprietary to TechnoCore and dissemination of this information or reproduction of this material
is strictly forbidden unless prior written permission is obtained
from TechnoCore.
Rich-based interactive terminal form renderer.
Reads form definitions from def_form and def_formfields (seeded by
create_forms_from_yaml), renders interactive terminal forms using Rich
and questionary, and writes collected data back to the form's BaseTable
via INSERT or UPDATE.
Uses existing def_form and def_formfields tables. No new schema required.
run(form_name, key_value)
|
+-- read_form() Load form metadata from def_form
+-- load_fields() Load field definitions, sorted by Sequence
+-- load_record() Optional: load existing record for edit mode
+-- render_form() Interactive prompts per field
+-- show_summary() Rich Table confirmation
+-- save() INSERT or UPDATE to BaseTable
| TUI Type | Rendering |
|---|---|
| STRING | Prompt.ask() single-line input |
| TEXT | Prompt.ask() single-line input |
| NUMBER | Prompt.ask() with integer validation |
| DATETIME | Prompt.ask() with format hint |
| SELECT | questionary.select() with choices |
| BOOLEAN | Confirm.ask() yes/no, stores Y/N |
| DISPLAY | Readonly display, no input |
Complex web field types are mapped to basic TUI types via
map_field_type() using the FIELD_TYPE_MAP dictionary.
Unknown types fall back to STRING.
| Basic TUI Type | Mapped From |
|---|---|
| STRING | STRING, EMAIL, URL, MOBILE, PASSWORD, DUALPASS, MASK, LONG, TINY, USER, TITLE, etc. |
| TEXT | TEXT, BLOB, CODEEDIT, EDIT, EDITTINYMCE, TEMPLATE, LOCALJSON, etc. |
| NUMBER | NUMBER, INT, FLOAT, CURRENCY, RANGE, BIT, MONTH, TIMER, TIMESTAMP |
| DATETIME | DATETIME, DATE, DATEBASIC, DATEDOB, DATEONLY, DATEFULL, NOW, TIME, etc. |
| SELECT | SELECT, QUERY, RADIO, MULTISELECT, MULTICHECK, SUMOSELECT, CHECKGROUP, etc. |
| BOOLEAN | BOOLEAN, TOGGLE, TOGGLEV, TITATOGGLE, CHECKBOX, CHECKLEFT |
| DISPLAY | STATIC, HEADING, EMPTY, IMAGE, FILE, UPLOAD, CAMERA, BARCODE, COLOUR, etc. |
| Attribute | Effect |
|---|---|
| Hidden=Y | Skip display, carry value |
| Readonly=Y | Display value (dim), no prompt |
| Required=Y | Re-prompt if empty |
| Default | Pre-filled value |
| Placeholder | Hint text shown in prompt |
seed_forms() - Scan factory.core YAMLs and seed any database.forms into def_form/def_formfieldsread_form(form_name) - Load form from def_formload_fields() - Load fields from def_formfieldsload_record(key_value) - Load existing record for editingparse_field_type(raw) - Parse SELECT('A','B') into type + optionsmap_field_type(raw) - Map any web field type to a basic TUI type via FIELD_TYPE_MAPrender_field(field) - Render one field interactivelyrender_form() - Render all fields with Rich Panel headershow_summary(values) - Rich Table confirmationsave(values) - INSERT or UPDATE to BaseTablerun(form_name, key_value) - Full lifecycle orchestratorThe CLI runs seed_forms() automatically before every command via a typer
callback. This scans all *.yaml files in factory.core/ for
database.forms sections and calls create_forms_from_yaml() for each,
ensuring form definitions exist in def_form and def_formfields without
needing to instantiate the owning module (e.g. ObjTicket).
Seeding is idempotent -- existing forms and fields are skipped.
# Create mode
python factory.core/ObjTuiForm.py open ticket_create
# Edit mode
python factory.core/ObjTuiForm.py open ticket_edit --key-value "GUID"
# List forms
python factory.core/ObjTuiForm.py list-forms
python factory.core/ObjTuiForm.py list-forms --block Tickets
# Show fields
python factory.core/ObjTuiForm.py fields ticket_edit
ObjData.py - Base class, provides create_forms_from_yaml()ObjTicket.yaml - Example form definitions (ticket_create, ticket_edit, ticket_task)WebForm.py - Web equivalent of form rendering