mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-04 01:44:13 +02:00
Scripting: qet.currentFolio(), and one undo step per script run in the editor
A script started from the editor had no way to know which folio is on screen, and each qet.* call was its own undo step, so a script that adds twenty items needed twenty Ctrl+Z to take back. qet.currentFolio() returns the folio shown in the editor; through --run, which has no view, the first folio, or -1 when there is none. A run from the editor is now one undo macro, named after the script. A run that changed nothing leaves no empty entry behind. qet.undo() and qet.redo() inside a grouped run say why they cannot work (QUndoStack ignores them inside a macro) instead of failing silently. --run is unchanged: one step per call, so scripts that call qet.undo() keep working. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -51,8 +51,9 @@ namespace QetScripting {
|
||||
|
||||
/**
|
||||
@brief Run @p scriptPath against an already-open @p project (the
|
||||
"Run Script..." GUI macro path). Errors go to stderr; there is no
|
||||
modal reporting in this first version.
|
||||
"Run Script..." GUI macro path). Errors go to stderr, and with a
|
||||
@p view also to a message box. With a @p view the whole run is one
|
||||
undo step; without one, each call is its own step, as on --run.
|
||||
@param view the active DiagramView, so the script's zoom methods
|
||||
have something to act on; nullptr from the headless entry point,
|
||||
where they become no-ops (see QetScriptApi).
|
||||
|
||||
Reference in New Issue
Block a user