Live mode: print, save/close, changes, snapshot; house-style layout rules; saved symbol index

QElectroTech (LiveServer):
- print: folios to the default (or a named) printer with no print dialog,
  always after asking the user (paper cannot be undone); or to a new PDF
  file. Rendered as the PDF export draws a folio (no grid, no terminals).
- save_project (own file, or save as a new file, never over one) and
  close_project (only without unsaved changes: never discards work).
- changes: the undo history, each step marked assistant or user, with
  "since" to ask what changed after a point.
- snapshot: a copy of the open project as on screen, for a check to read,
  without saving it or changing its file.
- qet.elementTextGeometry(): where a symbol's text is drawn on the folio.

qet MCP server:
- qet_live_print, qet_live_save_project, qet_live_close_project,
  qet_live_changes, qet_live_layout_check (snapshot + qet_layout_check, no
  "run this script?" window); write paths never overwrite.
- Layout rules from the house style, for file and live checks alike:
  label_on_wire, four_way_junction, misaligned_branch.
- The element index is saved under ~/.cache/qet-mcp: a new server process
  loads 8839 symbols in 0.4 s instead of parsing them for 6.9 s; the
  change check is a third faster.
- qet_about lists the installation's standard symbols
  (standard-symbols.json in QElectroTech's data folder) when there are any.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-10-05 19:36:34 +13:00
parent 4ceeeed302
commit 0df8ca5b3c
6 changed files with 806 additions and 10 deletions
+19
View File
@@ -3489,6 +3489,25 @@ bool QetScriptApi::deleteImage(int folioIndex, int imageIndex)
return true;
}
/**
@brief QetScriptApi::elementTextGeometry
Where one of a symbol's text fields is drawn on the folio, in folio
coordinates: left, top, right, bottom of the text as shown. A label
that sits on a wire is visible here, not from x/y alone (x/y are
relative to the symbol and say nothing about the text's size).
@return an empty map when the text does not exist
*/
QVariantMap QetScriptApi::elementTextGeometry(int folioIndex, const QString &elementUuid,
int textIndex) const
{
DynamicElementTextItem *t = findElementText(folioIndex, elementUuid, textIndex,
QStringLiteral("elementTextGeometry"));
if (!t) return {};
const QRectF r = t->sceneBoundingRect();
return {{QStringLiteral("left"), r.left()}, {QStringLiteral("top"), r.top()},
{QStringLiteral("right"), r.right()}, {QStringLiteral("bottom"), r.bottom()}};
}
/**
@brief QetScriptApi::addPdfPage
Render one page of a PDF file to an image and place it, as the "add