Skip to content

fontlabapp.contours.selection.panel.model

model

Shared panel base of the Contours scripts that work on the selected glyphs.

What: panel_type() returns SelectionPanel, the non-modal PythonQt panel of Shadow Copy, Outline Effect, Autohint Selected Layers and Remove PostScript Hints: script controls, a master scope ("Current master" or "All masters"), a consent tick for bases of automatic composites (BASES_TEXT), a preview table, a status line and the buttons Use selection, Close and the action. fontlabapp.glyphs.copies.panel_type() returns CopiesPanel, the same base set up for the scripts that create glyph copies.

How: the panel binds to the font that is current when it opens and takes the Font window selection. The public facts attribute stores auto-layer facts from construction, reselect() or scan() (explicit Refresh). Use self.facts in plan_rows to avoid a whole-font scan for each control signal. Every control change plans again with the script's plan_rows and fills the table with its cells. The action plans again from the live font and calls the script's write once. Use selection reads the selection again and clears the consent tick, because the consent belongs to the glyphs that the user saw. A refusal (ValueError, RuntimeError or TimeoutError) in Use selection or in the action shows its text in the status line. Signals connect through scripting.connect_guarded and disconnect when the panel closes.

Why: the four panels differed only in their controls, so each script now holds only its own logic, a small panel subclass and main. The panel is not fontlabapp.contours.panel.model's OutlinePanel: that one plans outline_writer rows; these scripts plan their own rows. MAX_ROWS is the fontlabapp.anchors.panel.model limit. This module imports only stdlib-only App modules at load time; panel_type() loads the class from fontlabapp.contours.selection.panel.ui, which imports PythonQt. Offline tests do not prove native panel behaviour.

How to use (a script)::

import fly.ap.contours.selection.panel.model as selection_panel

class ShadowPanel(selection_panel.panel_type()):
    TITLE, KEY, ACTION = "Shadow Copy", "generate_shadow", "Add Shadow"

    def build_controls(self): ...
    def plan_rows(self, package, masters): ...
    def cells(self, row): ...
    def pending(self, todo): ...
    def write(self, package, rows): ...
    def result_text(self, result): ...

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
BASES_TEXT attribute
HOOKS attribute
MAX_NAMES attribute
MEMBERS attribute
panel_type function () -> type Return the <code>SelectionPanel</code><code> base class (a PythonQt </code><code>QDialog</code>).