Commit Graph

9958 Commits

Author SHA1 Message Date
ispyisail cc07bb0e96 Merge pull request #1223 from ispyisail/feature/script-live-ask-first
Add ask-first, an Assistant panel and safe commands to live mode
2026-10-02 15:12:45 +13:00
ispyisail b18b6388d3 Merge pull request #1222 from ispyisail/feature/script-live
Add live mode: an AI assistant works on the open project as you watch
2026-10-02 15:12:17 +13:00
ispyisail 5fbc129671 Merge pull request #1221 from ispyisail/feature/script-manager
Add a script manager: write, try, give an icon to and delete scripts
2026-10-02 15:11:53 +13:00
ispyisail bec51d6fd1 Merge pull request #1220 from ispyisail/feature/script-buttons
Add script buttons: stored scripts with an icon in menu and toolbar
2026-10-02 15:11:26 +13:00
ispyisail 43f41eb044 Merge pull request #1219 from ispyisail/feature/script-current-folio-undo
Make a script run one undo step, and let it find the folio on screen
2026-10-02 15:11:03 +13:00
ispyisail 3e5e41b63f Merge pull request #1218 from ispyisail/fix/1210-report-menu-both-arrows
Fix #1210: keep both coming and going arrows in the right-click menu
2026-10-02 15:10:39 +13:00
ispyisail ed54271c23 Merge pull request #1214 from ispyisail/feature/mcp-conductor-defaults
Add a qet_edit op for a folio's wire defaults (one number per potential)
2026-10-02 15:09:56 +13:00
ispyisail 1e7dce4bd5 Merge pull request #1211 from ispyisail/fix/arc-middle-handle-overlap
Fix the arc's middle handle covering a resize or skew handle
2026-10-02 15:09:27 +13:00
ispyisail 7694f4833d Merge branch 'feature/script-live' into feature/script-live-ask-first 2026-10-02 13:03:34 +13:00
ispyisail 124173514d Live mode: advertise the channel in qet-assistant.json
The socket name and token now go in the "live" part of the one file the
qet MCP server reads about this QElectroTech, rather than in a
live-session.json of their own, and are cleared when the channel closes.
The file also says whether the live setting is on.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 13:03:33 +13:00
ispyisail 3a5b72c40f Merge branch 'feature/script-manager' into feature/script-live
# Conflicts:
#	cmake/qet_compilation_vars.cmake
#	sources/qetdiagrameditor.cpp
#	sources/ui/configpage/generalconfigurationpage.cpp
2026-10-02 12:58:54 +13:00
ispyisail 3cc857c754 Merge branch 'feature/script-buttons' into feature/script-manager
# Conflicts:
#	cmake/qet_compilation_vars.cmake
#	sources/qetdiagrameditor.cpp
2026-10-02 12:52:43 +13:00
ispyisail 5473ed7cdb Script buttons: qet-assistant.json, what an assistant needs to know in one file
QElectroTech now writes qet-assistant.json in the standard data folder
when an editor opens, and again whenever the stored scripts or the
scripting setting change: its version and program, every folder (data,
settings, scripts, the element and title block collections), which
features are on, every call a script can make (QetScriptApi::signatures(),
apiSignatures() without a running script), and the stored scripts with
their ids, files, icons and shortcuts, plus those refused and why. On
quit it says nothing is running any more.

The qet MCP server reads it rather than guessing each folder per
platform, which is wrong as soon as QElectroTech runs with --data-dir:
the file stays where the server can find it and names the folders
actually in use. Readable by the user only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 12:49:01 +13:00
ispyisail da312fa467 Merge branch 'feature/script-live' into feature/script-live-ask-first 2026-10-02 11:57:53 +13:00
ispyisail 7d91e8fdf1 Live mode: find the open project while QElectroTech is not the active window
While the user types to the assistant, QElectroTech is not the active
application, and QMdiArea then reports no active sub-window: status said
no project was open and every run was refused. Make the sub-window it
remembers active again before handling a request; the focus stays where
the user put it. Found with the Windows package under Wine; reproduced on
Linux with another window focused.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 11:57:53 +13:00
ispyisail 78ee9ccbaa Merge branch 'feature/script-live' into feature/script-live-ask-first 2026-10-02 11:15:15 +13:00
ispyisail e7b699b59a Live mode: close each connection once it is answered
The qet MCP server connects once per request. On Windows a named pipe's
disconnection reaches QLocalSocket late, so the second of two quick calls
was turned away as "another assistant is already connected". Found
testing the Windows package under Wine with a Windows-side client.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 11:15:15 +13:00
ispyisail 3083654ad3 Live mode: ask first, an Assistant log, commands, folios, screenshot
A script the assistant writes on the spot is shown to the user before it
runs: Exécuter, Refuser, or Toujours pour cette session. Stored scripts
run as a click would. The choice is per session and never saved.

An "Assistant" dock lists every action with the time, ✓ or ✗, and its
undo step; the script, its log or its error show on hover and on a
double-click. It opens with live mode and holds the ask-first box.

The assistant may also:
- trigger an editor command from an allow-list of ones that open no
  dialog and that undo can take back (selection, zoom, rotate, snap,
  group, reset wires); saving, deleting, exporting and the rest are
  refused;
- show another folio;
- undo the newest step only if it made it ("Assistant : …");
- take a picture of the folio on screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 10:43:19 +13:00
ispyisail 2fb14c5bd0 Live mode: an AI assistant acts on the open project while the user watches
A new setting, Configurer QElectroTech > Général > "Autoriser un assistant
IA à agir sur le projet ouvert", off by default. Off, nothing changes:
no channel is opened. On, every start shows a warning first -- Continuer,
Pas pour cette session, or Désactiver -- and nothing can connect until
the user answers Continuer. It waits for any other start-up question to
be answered, so the two never stack.

Accepted, LiveServer opens a local socket only the user's account can
use, with a random name and token written to live-session.json in the
data folder for the qet MCP server, and removed when the channel closes.
One JSON request per line: status (project, folio on screen, selection,
last undo step, stored scripts), run_script and run_stored. Requests are
queued out of the socket handler before they run (the lesson of PR #861).

Each run is one undo step named "Assistant : <name>". The status bar
shows the mode and the assistant's last action with a ✓ or ✗ and the
time, and an Arrêter button that closes the channel for the session.
Unticking the setting closes it at once.

QetScripting::runSource() runs script text and, for a live run, returns
what qet.log() wrote, the error with its line and the undo step instead
of showing boxes; qet.showMessage() is logged rather than opening a box
nobody asked for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 10:41:29 +13:00
ispyisail 3d4f546dbc Keep both folio report arrows in the folio's context menu
Fixes #1210. The "Renvoi de folio" submenu offered the common coming and
going arrows only while the project had no folio report element yet.
Placing one copies it into the embedded collection, so from then on the
menu listed just that one and the other arrow could not be inserted until
the project was closed without saving.

The two common arrows are now always listed, after the project's own
report elements, each name once.

Checked in the GUI on a blank one-folio project: on master the submenu
drops from two entries to one after a coming arrow is placed and the
second pick places another coming arrow; with this change it keeps two
entries and the second pick places a going arrow (both in the saved file).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 10:34:03 +13:00
ispyisail 4f47093cb2 Script buttons: a manager to write, try and delete stored scripts
Projet > Scripts > Gérer les scripts… lists the stored scripts with their
icons, and the files that get no button with the reason. For each one it
edits the name, icon (a file copied next to the script, a theme icon, or
the initials), tooltip, shortcut, when it is enabled, and the script
itself; "Tester" saves it and runs it on the current project, one Ctrl+Z
to undo; "Supprimer" deletes it with its icon if no other script uses it.

It only reads and writes the files in the scripts folder, so a script
written here, by hand or by an assistant over the qet MCP server is the
same thing, and the folder's watcher turns each into a button.

ScriptHeader gains compose(), bodyOf() and idFor(), header-only and
tested: what the manager writes reads back as what was typed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 09:22:10 +13:00
ispyisail b7ce89944e Scripting: qet.apiSignatures(), the calls a script can make
Read from the meta-object, so the list is the one the running build has:
for someone writing a script, and for an assistant that has to write one
without the source at hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 09:04:06 +13:00
ispyisail e03e523069 Script buttons: stored scripts become commands with an icon
Every .js file in the "scripts" folder of the user's data folder that
starts with a // ==QETScript== header becomes a command: in Projet >
Scripts, as a button on a new Scripts toolbar, and, because it is
registered with ShortcutManager as diagrameditor.script.<file name>, in
the shortcut settings, the shortcut bar (S) and command search. The
header gives its name, icon (a file next to the script or a theme icon;
a tile with its initials otherwise), tooltip, default shortcut and when
it is enabled (always, with a selection, with a conductor selected).

The folder is watched, so a script added, edited or deleted while QET is
open appears, changes or goes without a restart. A file with a header
that cannot be used gets no button; the Scripts menu lists it with the
reason. The menu also opens the folder, and holds "Exécuter un script…".

A click runs the script on the current project as one undo step named
after it, and asks to switch scripting on first, like "Exécuter un
script…" does: scripting stays off by default.

ShortcutManager::unregisterAction() takes a command out of the lists
when its script is deleted, and lets it come back under a new name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 09:04:06 +13:00
ispyisail 1c1f9db3eb 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>
2026-10-02 08:47:27 +13:00
ispyisail 7df9052a47 qet-mcp: set a folio's conductor defaults (set_conductor_default)
The "one text per potential" switch (onetextperfolio) lives in a folio's
conductor defaults, which no scripting call or qet_edit op could reach, so
callers patched the saved .qet afterwards (#1178).

qet.setConductorDefault(folio, property, value) sets onetextperfolio or any
setConductorProperty name on a folio's defaults, or with folio -1 on the
project's defaults that new folios copy. A change to onetextperfolio
re-shows or hides the conductor texts at once, as the Folio properties
dialog does. Not on the undo stack, like both dialogs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 07:16:44 +13:00
ispyisail 4c0f51c476 Arc: show the middle handle only with the size handles, uncovering the one under it
The middle handle of a half arc sits exactly on the middle of the top
or bottom edge of the ellipse -- a resize handle in Size mode, a skew
handle in RotateSkew mode -- and, drawn last, it covered that handle
(arummler, discussion #1203). It is now shown in Size mode only, where
the resize handle under it is hidden instead: the middle handle already
changes that height, with the ends kept in place. RotateSkew mode shows
its skew handle again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 06:12:09 +13:00
Laurent Trinques b6495b51a6 Merge pull request #1208 from Kellermorph/strg-shift-v
Linux build and tests / Build and test (Qt 6, Debug) (push) Failing after 3m18s
Ctrl+Shift+V pastes at the origin point, Ctrl+V keeps pasting under the cursor
2026-10-01 18:24:03 +02:00
Laurent Trinques 1ca13ce62d Fix unreadable search field in the Search and Replace widget (dark theme)
The search field gets a light green or light red background to show
whether the text matches, but only QPalette::Base was set. With a dark
theme the text colour is light too, so the typed text was light on
light and could not be read.

Set QPalette::Text to black together with the light background.

Fixes #1209
2026-10-01 16:03:46 +02:00
Laurent Trinques c7d31c08e4 Merge pull request #1204 from ispyisail/fix/wire-panel-unedited-properties
Fix the wire properties panel switching wires to single-line
2026-10-01 15:46:53 +02:00
Kellermorph 87bd172c44 Ctrl+Shift+V pastes at the origin point, Ctrl+V keeps pasting under the cursor
Ctrl+V moves the pasted group under the pointer as before. The new
Ctrl+Shift+V ("Coller au point d'origine", diagrameditor.paste_origin)
leaves the group exactly where it was copied from and warps the OS
cursor to the group's grid-snapped origin, so the paste baseline and
the physical cursor agree and the group starts following the mouse from
its original place instead of jumping to the pointer.

The cursor warp is only trusted as the baseline when it verifiably
lands (QCursor::pos() agrees with the target): QCursor::setPos() needs
pointer focus and is a silent no-op on compositors without
wp_pointer_warp_v1. Otherwise m_baseline_captured stays false and
moveTo() re-baselines on the first real mouse move, so a refused warp
costs at most the first movement rather than flinging the group across
the folio. An origin outside the viewport is scrolled into view first,
since the compositor rejects warp targets outside the window.
2026-10-01 13:04:04 +02:00
Laurent Trinques 041ad33e02 Merge pull request #1207 from jp2images/svg-icons-trace
Linux build and tests / Build and test (Qt 6, Debug) (push) Failing after 3m6s
Convert the toolbar and menu icons to SVG (#1063)
2026-10-01 12:54:11 +02:00
Jeff Patterson 947b067185 Tested that every icon size uses art drawn for it and reads on light and dark 2026-10-01 05:39:52 -05:00
Jeff Patterson 194708c0da Loaded the traced icons by theme name and removed the PNGs they replace 2026-10-01 05:39:52 -05:00
Jeff Patterson 5057817b6e Generated the light and dark icon themes 2026-10-01 05:39:51 -05:00
Jeff Patterson dba532996c Traced QET's own icons as SVGs, with 16 and 22 px drawings, and credited them in ico/copyright 2026-10-01 05:39:51 -05:00
Jeff Patterson cd786af926 Added scripts that import KDE Breeze icons and build the icon themes with a drawing for each size 2026-10-01 05:39:51 -05:00
Laurent Trinques 8e5da3c10b Merge pull request #1202 from ispyisail/feature/arc-tool
Add an Arc tool, with a handle to pull a half arc in or out
2026-10-01 12:37:37 +02:00
ispyisail a8699f6f62 Fix the wire properties panel changing properties nobody edited
With "Show the properties of a selected conductor in the Selection
properties panel" switched on, editing a wire there could change things
the user never touched:

- Enter in a field (Function, Section...) is not used by the line edit,
  so it reaches the checkable "Multifilaire" group box around it, which
  takes it as a click. The wire was switched to single-line, gaining
  ground, neutral and phase symbols. The modal dialog never shows this
  because its OK button takes Enter first.
- Every edit wrote back the whole set of properties as the widget holds
  them, so a value the widget cannot show exactly was rewritten: a dash
  size of 1 became 2.

The panel now swallows Enter at its checkable group boxes, and writes
only the fields that differ from what it showed, through the new
ConductorProperties::applyChanges(). "Apply to all conductors of this
potential" uses the same rule, so the rest of the potential keeps its
own values too.

tst_conductorapplychanges checks each field on its own: change that one
field, and a wire whose every field differs takes it and keeps the rest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 23:10:15 +13:00
ispyisail ffa76a61c1 Add an Arc tool and a handle to pull a half arc in or out (#408)
The diagram toolbar gets an "Ajouter un arc" button next to the
ellipse. Click one end, then click the other end at the height the arc
should reach: the result is a half arc bulging up or down from the line
between the two clicks (Shift: a true half circle). It is not filled,
since a fill would close it into a half disc.

A selected half arc shows one more handle, in the middle of the curve.
Dragging it makes the arc deeper or flatter while both ends stay put;
dragging it across the line between the ends turns the arc over. The
handle is hidden whenever the arc is not a half arc on a horizontal or
vertical diameter, because only then is "keep the ends, move the
middle" one well-defined change.

Nothing new is stored: an arc stays an Ellipse with a start and end
angle, exactly as the existing arc handles of an ellipse save it, so
files read by older versions are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 22:49:35 +13:00
Laurent Trinques 7fdc314e41 Merge pull request #1200 from ispyisail/feature/wire-crossing-hops
Add optional hops where wires cross (#436)
2026-10-01 11:07:09 +02:00
ispyisail 79a8637251 Add optional hops where wires cross (#436)
Where two wires cross without being connected, a project can now draw a
small arc (a hop) on one of them, instead of the user inserting a jump
symbol and splitting the wire. It is a project setting, off by default:
Project properties > Général > "Croisements de conducteurs", with no
hops, hops on horizontal wires, or hops on vertical wires. Choosing the
orientation rather than following drawing order keeps a project
consistent.

Only the drawing changes: no element is added and no wire is split. A
wire that ends or bends on another one is a junction and never hops,
and a crossing too close to the end of a segment for the arc to fit is
drawn plainly. PDF, SVG and image export and printing show the hops,
since they paint through Conductor::paint(); DXF export, which writes
the segments itself, does not.

The setting is saved as <wire_crossings hop="..."/> under the project
root, next to <usage>, and only when hops are on, so a project that
never used them saves exactly as before.

The geometry is in wirehops.cpp, free of any graphics item, and tested
on its own. Conductor::paintedPath() feeds it the conductors of the
folio from a snapshot of their scene points, rebuilt only when a
conductor changes shape, moves, or enters or leaves a folio; each hop
path is cached the same way. Asking the scene for the conductors in a
rect instead strokes every candidate's shape, which made a 366-wire
folio render 0.6 s slower; with the snapshot the difference is within
measurement noise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 21:18:12 +13:00
Laurent Trinques d777b8d44d Merge pull request #1199 from ispyisail/feature/terminal-strip-drag-drop
Add drag and drop of free terminals onto a terminal strip (#409)
2026-10-01 08:14:25 +02:00
Laurent Trinques 3f9ab22224 Merge pull request #1180 from Kellermorph/plc-place
Element editor: save the moved position of the PLC table
2026-10-01 08:13:11 +02:00
Laurent Trinques 75b95cd636 Merge pull request #1198 from ispyisail/fix/terminal-move-tooltip
Fix the terminal strip's move button giving the wrong reason (#409)
2026-10-01 08:01:00 +02:00
ispyisail 66ad129c20 Add drag and drop of free terminals onto a terminal strip (#409)
In the terminal strip manager, free terminals could only be moved into a
strip with the "move to" list and its button. Dragging one onto a strip,
which is what users try first (#409), did nothing.

Free terminals can now be dragged onto a strip in the tree on the left,
from either place they are listed:
- the free terminal table: every selected row is moved;
- the tree itself: the dragged free terminal is moved.

Dropping on a strip, or on a terminal already in that strip, moves them
with the same undo command as the button, so one undo puts them back.
The strip is then selected, showing the terminals just added. A drop
anywhere else is refused.

A drop is also refused while the free terminal table has edits that are
not applied yet: moving reloads that table and would lose them. The
button is disabled in the same case.

The drag carries the uuids of the terminal elements under its own mime
type, and the tree only moves terminals that are still free in the
project when the drop happens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 18:33:50 +13:00
Laurent Trinques 509d551964 Merge pull request #1197 from ispyisail/fix/wiring-list-cable-column
Linux build and tests / Build and test (Qt 6, Debug) (push) Failing after 2m49s
Add a Cable column to the wiring list export
2026-10-01 07:14:00 +02:00
Laurent Trinques 14c217da34 Merge pull request #1194 from ispyisail/fix/element-nonfinite-coordinates
Fix bugtracker #266: symbol with a nan coordinate breaks the editor
2026-10-01 07:12:27 +02:00
Laurent Trinques 2ea570c8f2 Merge pull request #1192 from ispyisail/fix/editor-resize-zero-undo
Fix bugtracker #266: undo of a resize to zero width does nothing
2026-10-01 07:11:49 +02:00
ispyisail 97239657c7 Fix the terminal strip's move button saying the wrong thing (#409)
The button that moves free terminals into a strip is disabled when there
is nothing it can do, but its tooltip always gave the same reason: apply
or cancel the pending edits. With no row selected, which is what the
screenshot on #409 shows, that sends the user looking for edits they
never made.

It also stayed enabled when the project had no terminal strip at all.
The "move to" list is then empty and a click did nothing.

The button is now disabled in all three cases and the tooltip names the
one that applies, the most basic first: no strip yet (create one with
the + button), edits pending, or nothing selected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 18:11:45 +13:00
Laurent Trinques 99422fe56c Merge pull request #1191 from ispyisail/fix/344-one-text-per-potential
Fix bugtracker #344: "one text per potential" now applies at once
2026-10-01 07:09:23 +02:00