qet-mcp: size a folio for a sheet of paper (set_folio_border preset)

setFolioBorder(folio, "preset", "tabloid-landscape") picks the column and
row counts and whole-number sizes that fill the sheet best without going
over it, as one ChangeBorderCommand. The title block and headers are
measured from the folio, so it holds for any template on either edge.
Sizes stay whole because the folio properties panel edits them in whole
pixels. Among fills within 1.5 pt of the sheet, the size nearest the
current one wins: from a new folio tabloid landscape is 23 x 70 by 12 x 82,
not 9 x 179 by 5 x 197. A0-A5, letter, legal, tabloid/ledger, each
-portrait or -landscape; folioPresets() lists them, and folioBorder() reads
"width" and "height" of the frame and title block.

Every preset exports on its sheet; landscape ones rely on the previous
commit, which turns a wide page before matching it to a sheet.

The MCP server checks the name up front, probes for folioPresets(), and
the op's note says what was chosen and the frame's size in points.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-10-02 22:26:14 +13:00
parent 797d502c0a
commit 0b4fc8beb0
5 changed files with 252 additions and 6 deletions
+12
View File
@@ -254,6 +254,17 @@ class QetGraphicsTableItem;
which it does not, are left alone. Changing the project title is not
undoable: the application sets it directly too.
A seventh, write-only field, "preset", sizes the frame for a sheet of
paper: "a4-landscape", "tabloid-portrait" and so on (folioPresets()
lists them). It picks the column and row counts and whole-number
sizes that fill the sheet best without going over it, keeping each
size as near the current one as it can, and pushes them as one
ChangeBorderCommand. Whole numbers because the folio properties panel
edits these sizes in whole pixels: a fraction would be rounded off the
first time someone opened it. Two read-only fields, "width" and
"height", are the frame and title block together in scene units --
what an export draws -- so a caller can check the result.
A folio's title block @b template is a seventh, separate case:
Diagram::setTitleBlockTemplate() resolves a name only against
QETProject::embeddedTitleBlockTemplatesCollection() -- the same
@@ -538,6 +549,7 @@ class QetScriptApi : public QObject
Q_INVOKABLE bool setProjectTitle(const QString &title);
Q_INVOKABLE QString folioBorder(int folioIndex, const QString &property) const;
Q_INVOKABLE bool setFolioBorder(int folioIndex, const QString &property, const QString &value);
Q_INVOKABLE QStringList folioPresets() const;
// -- the conductor defaults of a folio (Folio properties > Conductors),
// or with folioIndex -1, the project's defaults for new folios --