fontlabapp.anchors.panel.model
model
Shared panel base and colour helpers of the anchor writer scripts.
What: panel_type() returns AnchorPanel, the non-modal PythonQt panel
of the Anchors scripts: script controls, a live preview table, Reload
selection, Close and Apply. ink, muted and readable_palette give
readable text colours in FontLab's light and dark themes. ERROR_COLOR
colours blocked rows; MAX_ROWS limits the preview rows.
How: the panel plans with fontlabapp.anchors.writer (collect,
blocked_rows, require_safe) on every control change, and Apply plans
again from live data and writes with anchor_writer.apply_work (one Undo
step). Signals connect through scripting.connect_guarded and disconnect
in closeEvent.
Why: the seven Anchors scripts then hold only their planner, a small panel
subclass and main. This module imports only the standard library and
stdlib-only App modules at load time; PythonQt loads inside the functions,
and panel_type() loads the class from fontlabapp.anchors.panel.ui. So
FontLab's 5-second cold import stays fast, and tests without Qt can import
it. Offline tests do not prove native panel behaviour.
How to use (a script)::
import fly.ap.anchors.panel.model as anchor_panel
class RoundToGrid(anchor_panel.panel_type()):
TITLE, KEY, ACTION = "Round Anchors to Grid", "anchors_round_to_grid", "Round"
def build_controls(self): ...
def planner(self): ...
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 |
|---|---|---|---|
ERROR_COLOR |
attribute | ||
MAX_ROWS |
attribute | ||
ink |
function | () -> Any |
Return a <code>QBrush</code><code> for item text, from the main window </code><code>WindowText</code>. |
panel_type |
function | () -> type |
Return the <code>AnchorPanel</code><code> base class (a PythonQt </code><code>QDialog</code>). |
readable_palette |
function | (widget: Any) -> None |
Give <code>widget</code><code> a readable </code><code>Text</code> colour in each colour group. |