Skip to content

fontlabapp.fontui.teaching_text.notebook

notebook

What: Keep named FontLab scripting snippets in a local notebook.

How: Store code as text. Search, browse, edit or remove named records. JSON stores the collection. Snippet export saves one record as a Python file.

Why: A text notebook keeps reusable code available without executing it.

Usage: Enter a title and code. Select Add or Replace before navigation. Use Cancel Draft to restore the current record. Load JSON reads a collection. Export New saves JSON. Export Snippet saves the current record. Copy copies it.

Benefit: Reuse scripting knowledge while keeping the current font unchanged.

Setup: FontLab 9, Python 3.11, Fly and fontlabapp. Panels stay open beside the font. Export uses a new absolute path and never overwrites an existing file.

Idea from the Qt/PyQt examples (Riverbank Computing, Nokia, 2010-2013). Independent rewrite. Apache-2.0.

Classes

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
TITLE attribute
build function (parent: Any=None) -> Any Build the original controls as a hidden child for an owned lab tab. (shared captured text)
capture_names function () -> tuple[str, ...] Read the current font's glyph names. (shared captured text)
check_text function (text: str) -> str Reject character classes that can change in a Qt plain-text document. (shared captured text)
export_new function (filename: str, text: str) -> None Export UTF-8 to a new absolute path. (shared captured text)
main function () -> None Open through Fly. (shared captured text)
read_editor_exact function (editor: Any, gui: Any) -> str Check an export in a detached editor so draft text and Undo stay intact. (shared captured text)
set_plain_exact function (editor: Any, text: str) -> None Set checked text and verify the result. (shared captured text)
show function (qt: Any, parent: Any, *, embedded: bool=False) -> Any Build one modeless tool; retain every exact connection until safe close.