From 1d63e52decefd5a9d97f77fd2b24d7f4a520791a Mon Sep 17 00:00:00 2001 From: SoftFever Date: Thu, 19 Nov 2026 01:39:50 +0800 Subject: [PATCH] Say action and Speed Dial, not tile and palette, in the MCP commands and docs The MCP commands, their catalog and the docs called a command's Speed Dial entry a "tile" and the Speed Dial itself "the palette", words the app already uses for an entry's icon and for sets of colours. They now say "action" and "Speed Dial", as action_search and action_run do, and the catalog's tiles, tile_group and in_palette fields are now actions, action_group and has_own_action. Speed Dial ids, and the pins people stored under them, are unchanged. --- docs/HLSD/design-tab.md | 100 +- docs/HLSD/mcp-server.md | 441 +- docs/HLSD/mcp-tools.md | 129 +- docs/HLSD/scene-benchmark.md | 2 +- resources/web/dialog/SpeedDial/speeddial.js | 4 +- scripts/CAD/README.md | 13 +- scripts/CAD/gen_offer_table.py | 57 +- scripts/CAD/test_gen_offer_table.py | 26 +- scripts/CAD/tool_atlas.json | 2 +- scripts/operation_calls_baseline.txt | 4 +- src/slic3r/GUI/ActionIds.hpp | 12 +- src/slic3r/GUI/ActionRegistry.cpp | 45 +- src/slic3r/GUI/ActionRegistry.hpp | 52 +- src/slic3r/GUI/ActionReplayDialog.cpp | 16 +- src/slic3r/GUI/ActionReplayDialog.hpp | 4 +- src/slic3r/GUI/CAD/DesignOffer.hpp | 14 +- src/slic3r/GUI/CAD/DesignPanel.cpp | 23 +- src/slic3r/GUI/CAD/DesignPanel.hpp | 10 +- src/slic3r/GUI/CommandCatalog.cpp | 52 +- src/slic3r/GUI/CommandCatalog.hpp | 74 +- src/slic3r/GUI/CommandTypes.hpp | 2 +- src/slic3r/GUI/GUI_App.cpp | 4 +- src/slic3r/GUI/Mcp/McpArguments.cpp | 15 +- src/slic3r/GUI/Mcp/McpArguments.hpp | 8 +- src/slic3r/GUI/Mcp/McpJournal.cpp | 14 +- src/slic3r/GUI/Mcp/McpPersonContext.cpp | 4 +- src/slic3r/GUI/Mcp/McpPersonContext.hpp | 29 +- src/slic3r/GUI/Mcp/McpRecorder.cpp | 2 +- src/slic3r/GUI/Mcp/McpReplaySummary.cpp | 48 +- src/slic3r/GUI/Mcp/McpReplaySummary.hpp | 12 +- src/slic3r/GUI/Mcp/McpServerInfo.cpp | 8 +- src/slic3r/GUI/Mcp/McpTools.hpp | 26 +- src/slic3r/GUI/Mcp/McpToolsActions.cpp | 68 +- src/slic3r/GUI/Mcp/McpToolsApi.cpp | 6 +- src/slic3r/GUI/Mcp/McpToolsApp.cpp | 36 +- src/slic3r/GUI/Mcp/McpToolsCad.cpp | 80 +- src/slic3r/GUI/Mcp/McpToolsCad.hpp | 57 +- src/slic3r/GUI/Mcp/McpToolsCommon.cpp | 4 +- src/slic3r/GUI/Mcp/McpToolsConfig.cpp | 191 +- src/slic3r/GUI/Mcp/McpToolsPlugins.cpp | 16 +- src/slic3r/GUI/Mcp/McpToolsProject.cpp | 142 +- src/slic3r/GUI/Mcp/McpToolsPython.cpp | 4 +- src/slic3r/GUI/Mcp/McpToolsRecord.cpp | 24 +- src/slic3r/GUI/Mcp/McpToolsScene.cpp | 255 +- src/slic3r/GUI/Mcp/McpToolsView.cpp | 79 +- src/slic3r/GUI/NativeCommandMenuItems.hpp | 6 +- src/slic3r/GUI/NativeCommands.cpp | 112 +- src/slic3r/GUI/NativeCommands.hpp | 96 +- src/slic3r/GUI/Operations/Outcome.hpp | 2 +- src/slic3r/GUI/OptionsGroup.cpp | 2 +- src/slic3r/plugin/host/PluginHostTools.cpp | 6 +- tests/automation/automation_test_utils.hpp | 6 +- tests/automation/test_command_catalog.cpp | 36 +- tests/automation/test_mcp_replay_summary.cpp | 181 +- tests/data/command_catalog.json | 3544 ++++++++--------- ...alls.json => speed_dial_action_calls.json} | 0 ...ial_tiles.json => speed_dial_actions.json} | 0 tests/slic3rutils/retired_names.hpp | 4 +- tests/slic3rutils/test_action_source.cpp | 138 +- tests/slic3rutils/test_command_catalog.cpp | 282 +- tests/slic3rutils/test_mcp_cad.cpp | 194 +- tests/slic3rutils/test_mcp_config.cpp | 2 +- tests/slic3rutils/test_mcp_core.cpp | 28 +- tests/slic3rutils/test_mcp_recording.cpp | 46 +- tests/slic3rutils/test_mcp_results.cpp | 8 +- tests/slic3rutils/test_mcp_scene.cpp | 24 +- tests/slic3rutils/test_mcp_tools.cpp | 155 +- tests/slic3rutils/test_operations.cpp | 16 +- tools/mcp/README.md | 66 +- tools/mcp/gen_skill_reference.py | 100 +- tools/mcp/sweep.json | 4 +- tools/mcp/test_additions_refusals.py | 19 +- tools/mcp/test_cad_commands.py | 42 +- ...est_every_tile.py => test_every_action.py} | 121 +- tools/mcp/test_menu_items_refusals.py | 16 +- tools/mcp/test_operation_routes.py | 12 +- tools/mcp/test_person_forms.py | 34 +- tools/mcp/test_plugin_commands.py | 2 +- tools/mcp/test_plugin_tools.py | 10 +- tools/mcp/test_send_gcode.py | 16 +- tools/mcp/test_web_ui.py | 6 +- .../{tiles_ask.json => actions_ask.json} | 15 +- tools/mcp/tests/menu_items_objects.json | 4 +- tools/mcp/tests/menu_items_placement.json | 14 +- tools/mcp/tests/menu_items_structure.json | 6 +- tools/mcp/tests/ops_export_gcode.json | 4 +- tools/mcp/tests/ops_import_models.json | 2 +- tools/mcp/tests/ops_new_project.json | 12 +- tools/mcp/tests/ops_select_plate.json | 4 +- tools/mcp/tests/ops_send_gcode_to_host.json | 2 +- tools/mcp/tests/ops_set_instance_count.json | 4 +- tools/mcp/tests/ops_set_plate_locked.json | 6 +- tools/mcp/tests/ops_show_layer_range.json | 6 +- tools/mcp/tests/ops_start_arrange.json | 2 +- tools/mcp/tests/ops_start_slice.json | 2 +- .../mcp_web_fixture/mcp_web_fixture.py | 4 +- tools/mcp/tests/scene.json | 2 +- 97 files changed, 3843 insertions(+), 3796 deletions(-) rename tests/data/{speed_dial_tile_calls.json => speed_dial_action_calls.json} (100%) rename tests/data/{speed_dial_tiles.json => speed_dial_actions.json} (100%) rename tools/mcp/{test_every_tile.py => test_every_action.py} (88%) rename tools/mcp/tests/{tiles_ask.json => actions_ask.json} (85%) diff --git a/docs/HLSD/design-tab.md b/docs/HLSD/design-tab.md index 09c6e2c086..096f105a26 100644 --- a/docs/HLSD/design-tab.md +++ b/docs/HLSD/design-tab.md @@ -369,27 +369,27 @@ one would be unreachable, and a table in which an entry's name is not marked for `Design` context (`L_CONTEXT`): every name is a command's title, which a person sees translated, and the mark compiles to the bare string, so nothing at run time could tell it is missing. -The same table is the Design tab's Speed Dial tiles and its automation commands, so the three cannot drift +The same table is the Design tab's Speed Dial actions and its automation commands, so the three cannot drift apart. The header's `kDesignTools` holds 127 entries: the 92 verbs with a menu item, and 35 commands with no -menu item (`row` -1), such as `describe_design`, `sketch_draw` or `commit_to_plate`. An entry with an `action` -or a `tool` block is a command of the catalog, whose key is the entry's id and whose title is its name, unless -it is a folded item: 88 commands. An entry with an `action` does what its menu item does when it is called with -no arguments, and has a tile. An entry with a `tool` block also runs silently, with arguments: the block is that -form's access, params, examples, whether it reports a rejected rebuild in its reply and whether its schema -refuses an argument it does not name (`closed`), which the header carries as JSON text (`doc`) beside the -entry's `access` and `ok_false`. An item whose tool is a variant of a command is folded into it -(`"fold": {"into", "args"}`): it is no command, keeps its id, its place in the menu, its key and its tile, and -the command opens its tool when called with exactly the item's arguments, as Polar array is -`sketch_pattern {type: "circular"}` and the Corner rectangle `sketch_draw {type: "rectangle_2_point"}`. 37 items -fold into eight commands, the 24 shape items into `sketch_draw` among them. An entry with an action and a block -may name the arguments that choose its own item (`args`), as Boolean's Join item is -`boolean {operation: "join"}`, so that each of a command's variants opens the same way. Two items have neither -an action nor a block, Pattern on Curve and Align to, and are shown greyed: they are no command. Every command -has a `section`, its heading in the names index the MCP server's `tool_search` gives, and `feature_row` marks -the four items whose action works on the Feature tree's selected row (Edit, Rename, Delete and Constrain -sketch). `modal` marks the three entries whose action opens a dialog that waits for an answer: a modal one for -SVG (a file picker) and Color, which holds the call that opened it until it is answered, and the Design tab's -own modeless dialog for Text, which does not. +menu item (`row` -1), such as `describe_design`, `sketch_draw` or `commit_to_plate`. An entry with a handler +(`action`, the code its menu item runs) or a `tool` block is a command of the catalog, whose key is the entry's +id and whose title is its name, unless it is a folded item: 88 commands. An entry with a handler does what its +menu item does when it is called with no arguments, and has an action of its own in the Speed Dial. An entry +with a `tool` block also runs silently, with arguments: the block is that form's access, params, examples, +whether it reports a rejected rebuild in its reply and whether its schema refuses an argument it does not name +(`closed`), which the header carries as JSON text (`doc`) beside the entry's `access` and `ok_false`. An item +whose tool is a variant of a command is folded into it (`"fold": {"into", "args"}`): it is no command, keeps its +id, its place in the menu, its key and its Speed Dial action, and the command opens its tool when called with +exactly the item's arguments, as Polar array is `sketch_pattern {type: "circular"}` and the Corner rectangle +`sketch_draw {type: "rectangle_2_point"}`. 37 items fold into eight commands, the 24 shape items into +`sketch_draw` among them. An entry with a handler and a block may name the arguments that choose its own item +(`args`), as Boolean's Join item is `boolean {operation: "join"}`, so that each of a command's variants opens +the same way. Two items have neither a handler nor a block, Pattern on Curve and Align to, and are shown greyed: +they are no command. Every command has a `section`, its heading in the names index the MCP server's +`tool_search` gives, and `feature_row` marks the four items whose handler works on the Feature tree's selected +row (Edit, Rename, Delete and Constrain sketch). `modal` marks the three entries whose handler opens a dialog +that waits for an answer: a modal one for SVG (a file picker) and Color, which holds the call that opened it +until it is answered, and the Design tab's own modeless dialog for Text, which does not. `kDesignSelectionIds` names the selection kinds in `OfferSel`'s order, the ids the verbs' `accepts` use. The atlas and its generator sit in `scripts/CAD/` rather than in `docs/`: they are build inputs @@ -404,38 +404,38 @@ lists them, `tool_search {tool}` gives one's arguments, how its failure shows an as Fusion 360, Onshape and SolidWorks use it, with a prefix for where each works (`sketch_`, `surface_`, `construct_`, `feature_`, `body_`, and none for the model), and one argument for a variant: `type` for which kind of thing it makes, `operation` for what the result does to the bodies already there. A person picks the -same commands from the Speed Dial: while the Design tab is shown with the CAD feature on, it has a tile for -each entry with an action of the mode the tab is in, a folded item's included, the sketch's tools in a sketch +same commands from the Speed Dial: while the Design tab is shown with the CAD feature on, it has an action for +each entry with a handler of the mode the tab is in, a folded item's included, the sketch's tools in a sketch and the model's outside one, titled as the right-click menu names it and with its icon, and on any other tab, -or once the feature is turned off, none; a pinned Design tile stays pinned while it is not shown, and takes no -place on the favourites bar meanwhile. A folded item's tile runs its command with the item's arguments. A call -whose arguments are exactly those that choose an item (none for an entry's own item) does what the menu item -does, only in the mode the item belongs to, and replies `{"result": {"interactive": true, ...}}` with what the -tab shows then (its busy reason and status line); with other arguments, or `silent: true`, the commands -(`Mcp/McpToolsCad.*`) describe the design, read topology, measure, and run the same verbs the offer does — -they re-implement nothing, so a scripted action and a clicked one cannot diverge. Where a GUI action is bound -to a selection, a card or a dialog, its work is split into a function both callers share, and the command +or once the feature is turned off, none; a pinned Design tab action stays pinned while it is not shown, and +takes no place on the favourites bar meanwhile. A folded item's action runs its command with the item's +arguments. A call whose arguments are exactly those that choose an item (none for an entry's own item) does what +the menu item does, only in the mode the item belongs to, and replies `{"result": {"interactive": true, ...}}` +with what the tab shows then (its busy reason and status line); with other arguments, or `silent: true`, the +commands (`Mcp/McpToolsCad.*`) describe the design, read topology, measure, and run the same verbs the offer +does — they re-implement nothing, so a scripted action and a clicked one cannot diverge. Where a GUI action is +bound to a selection, a card or a dialog, its work is split into a function both callers share, and the command calls that function with explicit arguments instead of driving the widgets. The command set, what each command does and takes and which menu items call it, is in [mcp-tools.md](mcp-tools.md), The Design tab's commands. -An agent's call needs the MCP server on (`--mcp`, or Preferences), and every command, a person's tile included, -needs the CAD feature on (Preferences > Features, or `--cad` for one run). The catalog holds them only when the -feature is on at startup, as the main window makes the Design page only then, so turning it on takes a restart; -with it off they are unknown commands, whose error says how a person turns it on, as `app_state`'s -`cad_note` does. Turned off while OrcaSlicer runs, the tab stays until the restart, but the Speed Dial has no -tile of it. A call is refused (`-32002`) while the Design tab is busy: none runs while a rebuild owns the -document, `change` and `sketch` commands do not run under an open feature card, the Text dialog, Constrain mode -or a body Move, and a `change` one does not run under a sketch session, which `sketch` ones drive. `read` -commands are refused only during a rebuild, and so are `confirm_tool` and `cancel_tool`, which confirm or cancel -what is open as its Confirm and Cancel do, the Text dialog's OK and Cancel among them, and the opening of a -tool, which is also refused in the mode its item does not belong to (a model tool in a sketch, a sketch tool -outside one): the tab's right-click menu offers a tool only in its mode and refuses it for nothing else, and -each tool decides what an open card means to it. For the menu, and so for the commands, a sketch in Constrain -mode is open, while the tab's keys there are the model's: there a command does what its menu item does, not what -its key does. A tool whose menu item only the right-click menu reaches (a `btn:` or `fly:` action) is refused -for a selection its item does not accept, saying so and naming the selections it takes. `undo` and `redo` are -the shared commands of the Speed Dial and act on the history of the tab shown, the Design tab's while it is -shown; `history: "design"` names the Design tab's from any tab. +An agent's call needs the MCP server on (`--mcp`, or Preferences), and every command, a person's pick of a Speed +Dial action included, needs the CAD feature on (Preferences > Features, or `--cad` for one run). The catalog +holds them only when the feature is on at startup, as the main window makes the Design page only then, so +turning it on takes a restart; with it off they are unknown commands, whose error says how a person turns it on, +as `app_state`'s `cad_note` does. Turned off while OrcaSlicer runs, the tab stays until the restart, but the +Speed Dial has none of its actions. A call is refused (`-32002`) while the Design tab is busy: none runs while a +rebuild owns the document, `change` and `sketch` commands do not run under an open feature card, the Text +dialog, Constrain mode or a body Move, and a `change` one does not run under a sketch session, which `sketch` +ones drive. `read` commands are refused only during a rebuild, and so are `confirm_tool` and `cancel_tool`, +which confirm or cancel what is open as its Confirm and Cancel do, the Text dialog's OK and Cancel among them, +and the opening of a tool, which is also refused in the mode its item does not belong to (a model tool in a +sketch, a sketch tool outside one): the tab's right-click menu offers a tool only in its mode and refuses it for +nothing else, and each tool decides what an open card means to it. For the menu, and so for the commands, a +sketch in Constrain mode is open, while the tab's keys there are the model's: there a command does what its menu +item does, not what its key does. A tool whose menu item only the right-click menu reaches (a `btn:` or `fly:` +handler) is refused for a selection its item does not accept, saying so and naming the selections it takes. +`undo` and `redo` are the shared commands of the Speed Dial and act on the history of the tab shown, the Design +tab's while it is shown; `history: "design"` names the Design tab's from any tab. Face and edge ids name faces and edges of the current model, and a rebuild renumbers them while a stale id still names a real face or edge, so the replies carry the model's `generation`: a call that @@ -546,7 +546,7 @@ and replay tests. | `src/slic3r/GUI/CAD/DesignSketchTool.*` | in-canvas sketching | | `src/slic3r/GUI/Mcp/McpToolsCad.*` | the automation surface: the Design commands made from the table, their silent forms (`kSilentForms`) and their gate | | `src/slic3r/GUI/CAD/DesignInteraction.hpp` | the Esc level contract | -| `src/slic3r/GUI/CAD/DesignOffer.hpp` | the generated table: the offer, the tiles and the commands | +| `src/slic3r/GUI/CAD/DesignOffer.hpp` | the generated table: the offer, the Speed Dial actions and the commands | | `scripts/CAD/tool_atlas.json` | source of truth for the table | ## Verification @@ -561,7 +561,7 @@ The automation surface has its own checks. `slic3rutils_tests "[Mcp][CAD]"` (`tests/slic3rutils/test_mcp_cad.cpp`) runs the commands' argument checks and kernel calls on a `CadDocument` or a bare `DesignSketchTool`, with no panel, and checks the table and the commands the catalog holds: one per command entry and none for a folded or a greyed item, a silent form for every tool -block and a block for every silent form, the folded items' tiles, which call opens a tool and which runs, their +block and a block for every silent form, the folded items' actions, which call opens a tool and which runs, their schemas and summaries, and examples that call only real commands with arguments their schemas take; `scripts/CAD/test_gen_offer_table.py` checks the generator's refusals. On a live application launched with `tools/mcp/orca_mcp.py launch --cad`, the replays `tools/mcp/tests/cad_*.json` drive the commands through `tool_call`, the live tests `tools/mcp/test_cad_replay.py`, diff --git a/docs/HLSD/mcp-server.md b/docs/HLSD/mcp-server.md index c96c99ec6c..32a1dd1d59 100644 --- a/docs/HLSD/mcp-server.md +++ b/docs/HLSD/mcp-server.md @@ -9,7 +9,7 @@ screenshots before and after a fix and replays the steps from a replay file. A u OrcaSlicer from Claude Code, Codex, Cursor or Claude Desktop. The server runs inside the GUI process, because most of what an agent reproduces is GUI behaviour, and -reuses the Speed Dial catalog, so a feature added to the palette reaches agents, replays and scripts +reuses the Speed Dial catalog, so a feature added to the Speed Dial reaches agents, replays and scripts too. It is off by default. The code is in `src/slic3r/GUI/Mcp/`. The core, which uses no wx (the command catalog's type, the dispatch core, the hand-off to the UI thread, the job registry, the followed threads, the journal, the paths, argument checking, the protocol and HTTP transport, what the server says of itself, the @@ -101,10 +101,10 @@ The rest is in three sections, by what the commands are for: running the session which an agent should prefer, and driving the GUI itself. They say to prefer the commands that act on project data over clicks and never retry a call that returned a job, that commands are named place first, then verb, and `tool_search {group}` lists a place's, that a call -with exactly a tile's arguments may ask as a person's pick does while any other runs from its arguments, -point to `settings_get {query}` and its meta for what a setting does, say how a gizmo opens and is driven -(and that `gizmo_pick_file` only stands in for a file picker inside one, since its name draws agents to it -for any gizmo work), that the camera turns with `view_set` rather than a drag, and which indices are 0-based. +with exactly a Speed Dial action's arguments may ask as a person's pick does while any other runs from its +arguments, point to `settings_get {query}` and its meta for what a setting does, say how a gizmo opens and is +driven (and that `gizmo_pick_file` only stands in for a file picker inside one, since its name draws agents to +it for any gizmo work), that the camera turns with `view_set` rather than a drag, and which indices are 0-based. They also point to `tool_search {query}` as the one search across every catalog an agent calls into: the commands, among them those `tools/list` never shows (the three menu items that take no arguments, the Design tab's and the operations plugins offer, so nothing else tells an agent they exist), the Speed Dial's @@ -360,7 +360,7 @@ for a slice and 10 minutes for an export. **Worker jobs.** Arrange, orient, Fill bed and the jobs of the Text, SVG and texture gizmos run on the Plater's UI job worker, whatever started them: `object_arrange` or `object_auto_orient`, called or -run as a tile, a GL toolbar item, an ImGui button such as the Arrange options panel's, or a gizmo +run as a Speed Dial action, a GL toolbar item, an ImGui button such as the Arrange options panel's, or a gizmo control. `McpCore` watches that worker through `WorkerHooks` (busy and cancel, both on the UI thread). A call that finds the worker idle at the start of one of its UI closures and busy at the end of that closure, or of a @@ -434,8 +434,8 @@ whose callback wx then never delivers, and moves on a generation that a zero-del queued with `CallAfter` checks. An export is numbered in `export_seq` once scheduled, so an unchanged number means it never started; otherwise its `ExportRecord` ends `ok`, `failed`, `cancelled` or `superseded`. A G-code export with a path is refused while slicing runs. Without a -path, `project_export {format: "gcode"}` is its tile's call and asks in a native file dialog, which -a caller answers only with a `dialog_auto_answer` rule registered first. The +path, `project_export {format: "gcode"}` is its Speed Dial action's call and asks in a native file +dialog, which a caller answers only with a `dialog_auto_answer` rule registered first. The decision logic is in `Operations/RunStatus`, which uses neither wx nor `Plater` (see The operations layer). @@ -451,11 +451,11 @@ the UI thread. ## The operations layer -Three interfaces ask the app to do things by name: the Speed Dial's tiles, the MCP commands, and the +Three interfaces ask the app to do things by name: the Speed Dial's actions, the MCP commands, and the plugin API (`orca.host`). What one of them does is often what another does too: exporting G-code is a -tile, a call of `project_export` and the tile run through `action_run`. The checks, the refusal and its -wording, the undo snapshot and the order of the owner calls of such a function are in one place, -`src/slic3r/GUI/Operations/` (namespace `Slic3r::GUI::Ops`), and the three interfaces convert their +Speed Dial action, a call of `project_export` and the action run through `action_run`. The checks, the +refusal and its wording, the undo snapshot and the order of the owner calls of such a function are in one +place, `src/slic3r/GUI/Operations/` (namespace `Slic3r::GUI::Ops`), and the three interfaces convert their arguments and results around it. Where a dialog does the same work (the Clone dialog, the Preferences dialog, the Plugins window, the Printer Selection and System Filaments dialogs, the AMS sync dialog, Fix Model), the dialog calls the operation too, so a command and the dialog cannot differ. A command keeps @@ -482,7 +482,7 @@ the result or a `Refusal`: | `msgid`, `args` | one English message, marked with `L()`, and the values of its `%1%` placeholders | | `names` | names that help the caller: the candidates of an ambiguous name, the closest names to an unknown one | -The palette shows `translated()`. A tool and a Python exception carry `english()`, and a tool's +The Speed Dial shows `translated()`. A tool and a Python exception carry `english()`, and a tool's error also carries the code (`code`) and puts the names under the key it has always used (`similar`, `presets`). `action_run` replies with the English text and the code too, where the command ran an operation, so a command's refusal reads the same through every route. A caller may add a hint after @@ -499,7 +499,7 @@ and does not wait for background work: it returns a ticket, and a status functio operation, says how the work stands (`start_gcode_export()` and `gcode_export_state()`; `start_slice()` with `slice_status()` of `Operations/RunStatus`). The caller owns the loop, the timeout and the cancel, and reaches the status function through its own way to the UI thread: -`ctx.run_ui()` and `poll_ui()` for a tool, nothing for the palette, `run_on_ui_thread()` for Python. +`ctx.run_ui()` and `poll_ui()` for a tool, nothing for the Speed Dial, `run_on_ui_thread()` for Python. An operation adds no guard and refuses on the state of the project only; each interface keeps its own guards. @@ -510,7 +510,7 @@ open a dialog of its own (a STEP file's mesh options, the modified-presets quest `Plater::load_project()`, the Transfer-or-discard prompt of `Tab::select_preset()` when no answer is given). A call that stops there behaves as any call behind a dialog: a tool replies `blocked_by_dialog`, and a plugin's call waits for the person. A path that asks a person keeps its -owner method: a command's person's form (a call with exactly one of its tiles' arguments) is the asking +owner method: a command's person's form (a call with exactly one of its actions' arguments) is the asking path and calls the owner. **The plugin API.** Where an operation exists for what a binding does, the binding calls it and @@ -543,7 +543,7 @@ nothing from it, and `plugin/` includes nothing from `GUI/Mcp`. | | `set_plate_locked`, `delete_plate`, `duplicate_plate`, `rename_plate` | `plate_lock`, `plate_delete`, `plate_duplicate`, `plate_rename` | | | `start_arrange` | `object_arrange` | | | `start_slice` | `plate_slice` | -| | `show_layer_range` | `view_set`'s layer arguments and its Go to layer tile | +| | `show_layer_range` | `view_set`'s layer arguments and its Go to layer action | | | `show_prepare_view`, `shown_prepare_canvas` | the commands that act on the Prepare view's selection: its canvas, shown and with its scene loaded | | `PresetOps` | `resolve_preset`, `select_preset` | `preset_select`, the plugin API's `begin_update(preset_name)` | | | `assign_filament_preset` | `preset_select`, the plugin API's `begin_update(slot_number, preset_name)` (the sidebar's selector calls the same owner effect, `Sidebar::select_filament_preset()`) | @@ -578,7 +578,7 @@ the same whichever interface asks: A check only one route makes stays with that route, as a step of its own before the call: -- `object_arrange` refuses a locked or an empty plate it was given by index; its tile names no plate. +- `object_arrange` refuses a locked or an empty plate it was given by index; its Speed Dial action names no plate. Fill bed is a call's alone. - The plugin API refuses a filament slot whose preset is empty or does not resolve, since its transaction edits that preset; `preset_select` only assigns one. @@ -624,7 +624,7 @@ Design tab's commands come before Driving the GUI, in a CAD build with the CAD f them. A command is made with `inspect_tool()`, `mutate_tool()`, `record_tool()` or `recover_input_tool()`, which build it through `long_command()` with its function unchanged, so it runs where its call does, or, for one made from menu items, with `menu_command()`, which builds it through `ui_command()` with the items as its -tiles; a menu item's function is in namespace `MenuItems` (`NativeCommandMenuItems.hpp`), beside the helpers +actions; a menu item's function is in namespace `MenuItems` (`NativeCommandMenuItems.hpp`), beside the helpers the items share in `NativeCommands.cpp`. `reaching()` names the operations a command reaches. A function reaches the automation runtime through its call's context, `ToolContext::runtime()`: the core gives the runtime that owns it (`McpCore::set_runtime()`), a person's pick starts the runtime without the endpoint, and @@ -637,19 +637,19 @@ command alike and journal it as its own call. `tools/list` and the editors' tool command, then the plugin operations of the catalog's source (`search_commands()`; see Plugins and the tools), so its one inventory finds an unlisted menu item's key or a Design command's as it finds a listed one's. -A command's tiles are its menu items, which a person picks in the Speed Dial (see Speed Dial catalog). A -call whose arguments are exactly those of one of its tiles, a command's own tile being `{}`, is the person's -form: it does what a person's pick of that tile does, so it may ask in a dialog, which an agent's call -replies as `blocked_by_dialog`, or act on the selection. Any other call runs from its arguments and opens -nothing, and where a command's own function needs nothing more than a tile gives, `silent: true` -(`Mcp::with_silent()`) runs it from its arguments without asking. So `project_export {format: "gcode"}` -asks for the file and `project_export {format: "gcode", path}` writes it; `object_add_primitive {shape: -"cube"}` asks for the size and `{shape: "cube", silent: true}` takes the built-in one. The journal keeps -`silent`, so a replay of such a call asks nothing either. A call of the person's form is refused while a -modal dialog is open or another call's nested loop runs (`UiInvoker::require_mutate()`), also for a command -whose guard lets it run behind dialogs, unless that form opens nothing: `recording_stop {}` stops the -recording wherever the command runs. `project_save`'s `path` is required in every call that is not one of -its tiles', under `then`; `recording_start` given arguments records for up to an hour unless `max_seconds` +A command's actions, most of them its menu items, are what a person picks in the Speed Dial to run it (see +Speed Dial catalog). A call whose arguments are exactly those of one of its actions, a command's own action +being `{}`, is the person's form: it does what a person's pick of that action does, so it may ask in a dialog, +which an agent's call replies as `blocked_by_dialog`, or act on the selection. Any other call runs from its +arguments and opens nothing, and where a command's own function needs nothing more than an action gives, +`silent: true` (`Mcp::with_silent()`) runs it from its arguments without asking. So `project_export +{format: "gcode"}` asks for the file and `project_export {format: "gcode", path}` writes it; +`object_add_primitive {shape: "cube"}` asks for the size and `{shape: "cube", silent: true}` takes the built-in +one. The journal keeps `silent`, so a replay of such a call asks nothing either. A call of the person's form is +refused while a modal dialog is open or another call's nested loop runs (`UiInvoker::require_mutate()`), also +for a command whose guard lets it run behind dialogs, unless that form opens nothing: `recording_stop {}` stops +the recording wherever the command runs. `project_save`'s `path` is required in every call that is not one of +its actions', under `then`; `recording_start` given arguments records for up to an hour unless `max_seconds` says otherwise, and its reply says the limit it runs under. Two things have no silent form, so the caller answers their dialogs. `preset_export` always opens the @@ -760,9 +760,9 @@ leaves out the Design commands, and says that the feature was off when OrcaSlice turns it on. `CommandCatalog::unknown_command()` builds the error for every lookup of a command that misses: `tools/call`, `tool_call`, `tool_search {tool}`, a replay step and a plugin's or script's call. `action_run` gives the closest action ids, and says that `action_search` finds an action and -`tool_search` a command, since the name may be a command's that has no tile; a tile's key runs its -command. For a Design tile that is not shown it says when the tile is there instead, and that `tool_call` -runs its command from any tab, or, when the catalog leaves its command out, why. +`tool_search` a command, since the name may be a command's that has no action; an action's key runs its +command. For a Design tab action that is not shown it says when the action is there instead, and that +`tool_call` runs its command from any tab, or, when the catalog leaves its command out, why. Each tool family lives in its own `McpTools*.cpp`. List tools take `limit` and `offset` and reply `{items, offset, total}` (`page()`; `object_list`, a tree, has `plates` and `outside` in place of @@ -887,7 +887,7 @@ selected instance or part. `last_arrange_job_is_finished()` flag, which a cancelled job never clears; with `fill_object`, the object's row selected and `fill_bed_with_instances()` or `fill_bed_with_copies()`, which fill the object's own plate. Each takes one "Arrange" undo snapshot. An arrangement shows the Prepare view first and runs -with a gizmo open, as the toolbar's does (`Ops::start_arrange()`, which a person's pick of its tile, +with a gizmo open, as the toolbar's does (`Ops::start_arrange()`, which a person's pick of its action, Auto-Arrange, calls too), and is refused while another job runs. Fill bed selects the object's row, so it refuses the assemble view and an open gizmo as the commands that select do. The command also refuses a locked or empty plate given by index, `fill_object` with `plates`, and an object Fill bed refuses @@ -907,9 +907,9 @@ leaves alone (`skipped_plates`: locked, or printing in another sequence than the setting asked for did not apply (one plate in another sequence is arranged with automatic spacing). An arrange sorts the model's objects by arrange order (`PartPlateList::rebuild_plates_after_arrangement()`), so indices may change. After `timeout_s` -(default 300) the call cancels the job. Called with no arguments, as its tile, it arranges every unlocked -plate with the panel's saved settings, as the toolbar does, and an automated call of that form waits and -replies as any other call; a person's pick starts the arrangement and returns. +(default 300) the call cancels the job. Called with no arguments, as its Speed Dial action, it arranges +every unlocked plate with the panel's saved settings, as the toolbar does, and an automated call of that form +waits and replies as any other call; a person's pick starts the arrangement and returns. ### object_set_height_ranges @@ -1363,7 +1363,7 @@ values), `effective` and `changed`. The plate tab's `skirt_start_angle` is not a plate other than the current one is made current first, and the name the plate has already changes nothing. `plate_lock` locks or unlocks a plate as its lock icon does (`Ops::set_plate_locked()`, `PartPlateList::lock_plate()`), and only when it differs, so `locked: true` twice leaves the plate locked; -without `locked` it toggles, as its tile does. `plate_delete` and `plate_duplicate` take `plate` too +without `locked` it toggles, as its Speed Dial action does. `plate_delete` and `plate_duplicate` take `plate` too (`Ops::delete_plate()`, `Ops::duplicate_plate()`, the plate menu's functions with the plate given), and reply with every plate afterwards; a duplicate is one undo step and is refused while slicing and at the most plates a project holds. `plate_select` makes a plate current as a click on it does. @@ -1439,10 +1439,10 @@ version) save from a handler on their drop-down list, where a person's pick arri `calibration_generate_test` runs a Calibration menu test (`test`: temperature, max volumetric speed, pressure advance as tower, line or pattern, flow ratio in its four passes, retraction, VFA, cornering, input shaping frequency and damping) one level below its dialog: it calls the same `Plater::calib_*` the dialog's -OK calls, with the `Calib_Params` the dialog would build. Called with `test` alone, the call of its tile -(one per menu item, whose ids are the items' ids: `calib_temperature` and the rest), it opens that test's -dialog, as the Calibration menu does (`blocked_by_dialog`), and the dialog's OK runs the test; any value of -the test, or `silent: true`, runs it without the dialog. The dialogs only collect and check numbers, so +OK calls, with the `Calib_Params` the dialog would build. Called with `test` alone, the call of its Speed +Dial action (one per menu item, whose ids are the items' ids: `calib_temperature` and the rest), it opens that +test's dialog, as the Calibration menu does (`blocked_by_dialog`), and the dialog's OK runs the test; any value +of the test, or `silent: true`, runs it without the dialog. The dialogs only collect and check numbers, so their rules are shared with the command in `libslic3r/calib.cpp`: `calib_default_params()` (the values each dialog opens with), `check_calib_params()` (what each dialog refuses, as an enum, so each dialog keeps its own message box and the command states the rule with the values given), `cornering_end_limits()`, @@ -1488,16 +1488,16 @@ and saves it with `preset_save`; staying in the test project, `settings_set {"re ### Object commands Each object command does one menu item's job, or a few items' with the argument that picks the variant, and -takes its targets as Tool catalog says, so a call names what to act on and a tile acts on the selection, -as its menu item does. What it does is an operation of `ObjectOps` (see The operations layer), which the -item's own GUI function calls where it has one, so a pick and a call cannot differ. A few have more to say -than their descriptions: +takes its targets as Tool catalog says, so a call names what to act on and a Speed Dial action works on the +selection, as its menu item does. What it does is an operation of `ObjectOps` (see The operations layer), +which the item's own GUI function calls where it has one, so a pick and a call cannot differ. A few have more +to say than their descriptions: - `object_order` orders a plate's objects (the current plate, or `plate`, or with `all` every plate), which sets the object list and print order. With `by` (name, filament, height, size) it does what the plate - menu's Order By does (`ObjectList::order_objects()`), ascending or with `descending`; called as its tile, - with `by` alone, it keeps Order By's toggle and reverses the order the objects already have, which a call - with any other argument never does. With `order`, the objects of the plate in the order wanted + menu's Order By does (`ObjectList::order_objects()`), ascending or with `descending`; called as its Speed + Dial action, with `by` alone, it keeps Order By's toggle and reverses the order the objects already have, + which a call with any other argument never does. With `order`, the objects of the plate in the order wanted (`Ops::reorder_objects()`), it makes the drops a drag in the object list makes (`ObjectList::OnDrop()`), so a call reaches what a person can only drag: `order` names each of the plate's objects once, by index, and the other plates' objects keep their order. One undo step; the reply gives the new order. @@ -1518,10 +1518,10 @@ than their descriptions: - `object_set_printable` sets the flag the object list's Printable cell toggles, and `object_set_auto_drop` the 3D view's Auto Drop, which only says whether the object drops when it is next moved: the call drops nothing. -- `object_split` into objects asks Split's Auto-Drop question as its tile; a call answers it with `keep_z`, - or is refused (`auto_drop_question`) where pieces would float. `object_delete` refuses what Delete would - ask about (part of a cut object, an object's last solid part) with the question as its reason, and its tile - leaves those to the object list, which asks. +- `object_split` into objects asks Split's Auto-Drop question as its Speed Dial action; a call answers it + with `keep_z`, or is refused (`auto_drop_question`) where pieces would float. `object_delete` refuses what + Delete would ask about (part of a cut object, an object's last solid part) with the question as its reason, + and its Speed Dial action leaves those to the object list, which asks. ### Filament slots and the AMS @@ -1534,8 +1534,8 @@ a mix the project has already is not added again, and the reply names its slot. undo history, as in the GUI. `filament_sync_ams` takes the filament list from the AMS of the printer selected on the Device tab. As its -tile, with no arguments, it opens the sync dialog where the project has objects. With `mode` it does what -the dialog's Synchronize now does with that choice, on what the dialog first shows, without the dialog +Speed Dial action, with no arguments, it opens the sync dialog where the project has objects. With `mode` it +does what the dialog's Synchronize now does with that choice, on what the dialog first shows, without the dialog (`Ops::sync_filaments_from_ams()`, which the dialog applies its choice through too, `Ops::apply_ams_sync()`): `map` maps each of the project's filaments to a slot, as the dialog's Mapping first does, and takes a project with objects; `overwrite` replaces the list with the slots' filaments. No printer, no AMS, no @@ -1603,9 +1603,9 @@ which the window's switches and row menus call too: (`Ops::uninstall_plugin()`). It is labelled destructive: a person's plugin and its files go for good. - `plugin_install_local` installs a `.py` or `.whl` file by path, as the window's Install local plugin does, without its file dialog. A plugin of that name already installed is replaced only with `overwrite: - true`; without it the call is refused with the question the window asks. Its tile, with no arguments, - asks for the file and, before it replaces an installed plugin, in Orca's own "Overwrite Plugin" message - dialog. + true`; without it the call is refused with the question the window asks. Its Speed Dial action, with no + arguments, asks for the file and, before it replaces an installed plugin, in Orca's own "Overwrite Plugin" + message dialog. - `plugin_refresh` does what Refresh Plugins does: the installed plugins are rescanned and the plugin hub's list fetched again, off the UI thread (`Ops::start_plugin_refresh()`). Refreshes take turns: each call and each pick of Refresh Plugins is a run of its own, and one asked for while others wait or run begins once @@ -1638,18 +1638,18 @@ right-click menu does. The headings are the generator's (`SECTIONS` in `gen_offe in the header), and a command's is its entry's `section`. So an agent learns without a search that the commands exist, that they are CAD and where each works, and reads a command's description and schema only when it looks it up. The description stays within 4096 characters, the most a client is known to keep of one. The -commands that open a tool are in the palette, whose tiles for them the Speed Dial has while the Design tab is -shown (see Speed Dial catalog). `register_all_commands()` adds them through `register_cad_commands()` only +commands that open a tool have Speed Dial actions while the Design tab is shown (see Speed Dial catalog). +`register_all_commands()` adds them through `register_cad_commands()` only when the catalog is built with the CAD feature on (`CatalogOptions::cad`, which startup takes in the editor from the value in force: the `enable_cad_feature` preference, or `--cad` for the run). With it off the catalog holds none, and records that it leaves them out (`leave_out_cad_commands()`), a folded item's id among them, -which names a tile: `tool_call {tool: "hole"}` is an unknown command whose error says the feature was off when -OrcaSlicer started and how a person turns it on, and `app_state` carries `cad_note`, how a person turns the -feature on (`cad_note()`, in the editor while the catalog holds no Design command or the feature is off). The -catalog is sealed at startup and the main window makes the Design page only then, so turning the feature on or -off takes effect after a restart, but for the Speed Dial's Design tiles, which go as soon as it is turned off -(see Speed Dial catalog); a window rebuilt for a language change in between makes the page by the new -preference, while the catalog keeps the commands it started with. +which names a Speed Dial action: `tool_call {tool: "hole"}` is an unknown command whose error says the feature +was off when OrcaSlicer started and how a person turns it on, and `app_state` carries `cad_note`, how a person +turns the feature on (`cad_note()`, in the editor while the catalog holds no Design command or the feature is +off). The catalog is sealed at startup and the main window makes the Design page only then, so turning the +feature on or off takes effect after a restart, but for the Speed Dial's Design tab actions, which go as soon +as it is turned off (see Speed Dial catalog); a window rebuilt for a language change in between makes the page +by the new preference, while the catalog keeps the commands it started with. The commands' names, their variant arguments and those arguments' values use the industry's terminology, as popular CAD programs such as Fusion 360, Onshape and SolidWorks use it, so that people and agents who know one @@ -1683,34 +1683,34 @@ this one (`align_index`, `align_conflicts`), and a feature's type name (`Mate`, `CoordSys`) is the app's name for it in the history. One table, the Design tab's, declares every command: `kDesignTools` in `CAD/DesignOffer.hpp`, generated from -`scripts/CAD/tool_atlas.json`, which is also the right-click menu (`docs/HLSD/design-tab.md`). An entry with an -action or a tool block is a command, unless it is a folded item (`is_design_command()`): its id is the key and +`scripts/CAD/tool_atlas.json`, which is also the right-click menu (`docs/HLSD/design-tab.md`). An entry with a +handler or a tool block is a command, unless it is a folded item (`is_design_command()`): its id is the key and its name the title. Of the 127 entries, 88 are commands, in five kinds: - A merged entry is a menu item and the argument command for its job as one entry under the command's name: - the item's slot, key, action, accepts, mode, name, icon and hint, with the command's tool block (47: - `sketch_trim`, `extrude`, `feature_edit`). Called with no arguments it does what its menu item does. -- A menu-only command has an action and no block (5: `rename_selected`, `zoom_to_selection`, + the item's slot, key, handler (`action`), accepts, mode, name, icon and hint, with the command's tool block + (47: `sketch_trim`, `extrude`, `feature_edit`). Called with no arguments it does what its menu item does. +- A menu-only command has a handler and no block (5: `rename_selected`, `zoom_to_selection`, `sketch_polygon_inscribed`, `sketch_polygon_circumscribed`, `sketch_constrain_selected`). It takes no argument at all (`additionalProperties: false`), `silent` included. -- An argument-only command has a block and no action (36: `describe_design`, `sketch_draw`, +- An argument-only command has a block and no handler (36: `describe_design`, `sketch_draw`, `select_geometry`); all but `measure`, whose menu item has no GUI path, have no menu item (`row` -1). - A folded item (`"fold": {"into": "sketch_pattern", "args": {"type": "linear"}}`) is a menu item whose tool is a variant of the command it names: calling that command with the item's arguments opens it, so Linear array is `sketch_pattern {type: "linear"}` and Color `body_set {}`. It is no command, and keeps its entry - and its id, which the menu, the keys, the toolbar, its tile and the GUI tests use. 37 items fold into eight - commands: `sketch_draw` (24 shapes), `sketch_set_value` (the three value items, one action under three - labels, each `{}`), `sketch_transform` (3), `sketch_pattern` (2), `boolean` (2), and `thicken`, `pattern` - and `body_set` (one each). -- A greyed item has a slot and neither an action nor a block (`pat_curve`, `align_to`): shown disabled, and no + and its id, which the menu, the keys, the toolbar, its Speed Dial action and the GUI tests use. 37 items fold + into eight commands: `sketch_draw` (24 shapes), `sketch_set_value` (the three value items, one handler under + three labels, each `{}`), `sketch_transform` (3), `sketch_pattern` (2), `boolean` (2), and `thicken`, + `pattern` and `body_set` (one each). +- A greyed item has a slot and neither a handler nor a block (`pat_curve`, `align_to`): shown disabled, and no command. -An entry with an action and a block may also name the arguments that choose its own menu item (`args`): +An entry with a handler and a block may also name the arguments that choose its own menu item (`args`): `boolean`'s Join item is `{operation: "join"}`, `thicken`'s `{type: "face"}` and `pattern`'s `{type: "linear"}`, so that each of a command's variants opens the same way. The generator refuses a table in which a fold names no entry, another folded item or an entry with no block, a folded item has a block of its own or another mode than its command's item, two items of a command have the same arguments under different -actions, an item's arguments are its command's own, own `args` sit on an entry without an action and a block +handlers, an item's arguments are its command's own, own `args` sit on an entry without a handler and a block or are `{}`, or a command has no `section` (and a folded or greyed item has one). An entry with a tool block has a silent form, whose function `kSilentForms` binds by the entry's id; a unit @@ -1760,7 +1760,7 @@ the tree edits also read. One rule decides what a call of a Design command does (`opened_item()`): **a call whose arguments are exactly those that choose one of its menu items opens that item's tool for a person, as a pick of the item does; any other -call runs its silent form.** No arguments choose the entry's own item where it has an action (`sketch_trim {}`, +call runs its silent form.** No arguments choose the entry's own item where it has a handler (`sketch_trim {}`, `boolean {}`); where it has none, the items folded into it with `{}` (`body_set {}` the Color item, `sketch_set_value {}` the first of the value items). An item's own or folded `args` choose that item: `boolean {operation: "cut"}` opens the Subtract item, `sketch_draw {type: "circle_3_point"}` arms the 3-point @@ -1773,38 +1773,38 @@ none, since a call of them with no arguments opens nothing, and their closed sch choosing arguments. So a call meant to run that gives only an item's arguments opens the tool, and its reply says so. -A call that opens a tool, an agent's or a tile's, is the person's form (`open_tool()`, on the item's entry). It -passes `cad_gate()` with `CadAccess::None`, whose only busy rule is the rebuild's, so the recipe is loaded and -the call refused while the model is being rebuilt, and runs the item's action in place +A call that opens a tool, an agent's or a Speed Dial action's, is the person's form (`open_tool()`, on the +item's entry). It passes `cad_gate()` with `CadAccess::None`, whose only busy rule is the rebuild's, so the +recipe is loaded and the call refused while the model is being rebuilt, and runs the item's handler in place (`DesignPanel::mcp_run_verb()`), as the menu item and the tab's keys do: an open card does not refuse it, -since each tool decides what that means to it. Before the action, `open_refusal()` refuses it in two cases +since each tool decides what that means to it. Before the handler runs, `open_refusal()` refuses it in two cases (`-32000`). An entry runs only in the mode its menu item belongs to, where the right-click menu offers it (`offered_in_mode()`, by the menu's `sketch_map_applies()`, for which a sketch in Constrain mode is open too): a model tool such as Shell in an open sketch is refused with "This tool works on the model: finish or cancel the sketch first" (`mode: "model"`), a sketch tool outside a sketch with "This tool works in a sketch: open a sketch first" (`mode: "sketch"`). No entry is offered in both modes, and the only keys read in both, the -Ctrl+Shift ones, are no entry's action. The tab's keys take the sketch's entries only in Sketch mode, so in +Ctrl+Shift ones, are no entry's handler. The tab's keys take the sketch's entries only in Sketch mode, so in Constrain mode they reach the model's while the menu offers the sketch's: there a command does what its menu -item does, not what its key does. And an action that only the right-click menu reaches (`btn:`, `fly:`), +item does, not what its key does. And a handler that only the right-click menu reaches (`btn:`, `fly:`), whose item the menu greys for a selection it does not accept, is refused for one with "This tool does not apply to what is selected", its details naming the selection (`selection_kind`, `selection`) and the atlas ids of those the item accepts (`accepts`). Only an item that accepts a kind the tab can report in its mode is greyed so (`reported_kinds()`): Boolean's items take two bodies and Rib's a sketch line, which the tab never reports as what is selected, so `boolean {}` opens the Boolean card as its toolbar button does, whatever is selected. It never gives the item's refusal, which is about the document (no body yet) and which the menu shows only for an -item that takes the selection. A `key:` action runs whatever is selected, as its key does. A call that is not a +item that takes the selection. A `key:` handler runs whatever is selected, as its key does. A call that is not a person's pick, made while a row of the Feature list is selected and nothing is picked in the view, takes that row as what four menu items act on (`feature_row` in the atlas): `feature_edit`, `rename_selected`, -`feature_delete` and `sketch_constrain_selected` are not refused for the selection then, and their action says +`feature_delete` and `sketch_constrain_selected` are not refused for the selection then, and their handler says itself what it cannot do with the row; `zoom_to_selection` acts on what is picked in the view. A person's pick keeps the menu's rule, which greys those items for that selection. The reply is `{"result": {"interactive": true, "tool", "applies", "modal", "selection_kind", "busy", "status"}}`: the command called, whether the item accepts -the selection, whether a dialog the action opened held the call until it was answered (the atlas's `modal` +the selection, whether a dialog the handler opened held the call until it was answered (the atlas's `modal` entries but Text, whose dialog is modeless: `DesignPanel::mcp_text_dialog_open()` tells it), the selection's -kind, `mcp_busy()`'s reason after the action (a card, a dialog or a sketch now open) or null, and the text of -the tab's status line (`DesignPanel::mcp_status()`). It claims nothing about what the action did, which may be -to open a card, arm a sketch tool, act at once, or say on the status line why it cannot (Loft with fewer than -two profile sketches). A modal dialog the action opens holds the call, which the core reports as blocked by +kind, `mcp_busy()`'s reason after the handler ran (a card, a dialog or a sketch now open) or null, and the text +of the tab's status line (`DesignPanel::mcp_status()`). It claims nothing about what the handler did, which may +be to open a card, arm a sketch tool, act at once, or say on the status line why it cannot (Loft with fewer +than two profile sketches). A modal dialog the handler opens holds the call, which the core reports as blocked by it, as for `project_new {}`; Text's dialog is modeless, so `sketch_text {}` replies at once with a `busy` that names it, and its own Cancel or Escape closes it. For a person's pick, a refusal is shown in the UI's language where its text is a msgid, as these three refusals are. `describe_design` gives `selection`, `{kind, id}`, the @@ -2120,7 +2120,7 @@ the Bodies row's Move and Place on Face: where the body goes for Commit to Plate no undo step, and the project file does not keep it; a placement follows its body when the bodies are renumbered, by the transient `uid` of the feature that made it (`CadFeature::uid`). -`undo` and `redo` are commands of The app, each with a tile of its own (`McpToolsApp.cpp`), shared by the +`undo` and `redo` are commands of The app, each with an action of its own (`McpToolsApp.cpp`), shared by the Design tab and the project, and act on the history of the tab shown, as Edit > Undo and Redo and the top bar's buttons do: the Design tab's while `MainFrame::shown_design_panel()` is not null, else the project's. @@ -2139,11 +2139,11 @@ and after (`Plater::undo_redo_string_getter()`), which change only when the acti with "Nothing was undone in the project's history" (or redone) when neither changed. Success means an entry of the history was taken back or put back, as the Undo list shows it, not that the project differs afterwards: the plater classes a snapshot by its type, and an action can leave one that changed nothing (renaming an object to the name it -has). That is an automated call's, `action_run` of the tile +has). That is an automated call's, `action_run` of its action included: a person's pick from the Speed Dial does what the Edit menu's item does, and where the menu greys that item it does nothing and shows nothing: on the Design tab's history through `menu_undo_redo()` where `menu_can_undo_redo()` allows, and on the project's only where `Plater::can_undo()` (or `can_redo()`) holds, -so not from the Preview or while a job runs, since `Plater::undo()` itself acts wherever it is called. The reply is the tile's, with `history` and, for the +so not from the Preview or while a job runs, since `Plater::undo()` itself acts wherever it is called. The reply is the action's, with `history` and, for the Design tab's, `result`, `cad_undo_redo()`'s reply; with the CAD feature off, or in a build without CAD, `design` fails ("The CAD feature is off"). Their examples, which call Design commands, are only in a catalog that holds them. The Design history is not saved with a project. @@ -2211,8 +2211,8 @@ its file all the same, since a loaded recipe counts as a loaded project. `tests/slic3rutils/test_mcp_cad.cpp` (`[Mcp][CAD]`) checks the Design commands as the catalog holds them (one per command entry of the Design table, none for a folded or greyed item, a silent form for every -block and a block for every silent form, which entries have a tile and an icon, the folded items' tiles, their -schemas, descriptions, sections and access, and every example's calls against their commands' schemas), that +block and a block for every silent form, which entries have a Speed Dial action and an icon, the folded items' +actions, their schemas, descriptions, sections and access, and every example's calls against their commands' schemas), that none is registered with the feature off, which call opens a tool and which runs, how a call is journaled, the plane resolver, the rollbacks, and the tools through their public seams (`cad_sketch_extrude()`, `cad_sketch_call()`, `cad_body_describe()`, `cad_thread()` and the rest), which take a `CadDocument` or a @@ -2230,7 +2230,7 @@ and fails an example when a call fails or its result has `ok` false, an error, o `tools/mcp/test_cad_commands.py` checks in the running app what the commands' arguments do where the Design panel's own functions answer: the words, `sketch_draw` against each shape's tool, `sketch_edit`, the gaps' argument forms, `feature_edit`'s `refs`, `select_geometry`, `confirm_tool` and `cancel_tool`, -`body_place`, the Boolean card a call opens, and a folded item's tile picked from the Speed Dial and +`body_place`, the Boolean card a call opens, and a folded item's action picked from the Speed Dial and replayed. `tools/mcp/test_cad_sketching.py`, `test_cad_context_menu.py` and `test_cad_click_edit.py` drive the Design tab through the GUI tools as a person does (canvas gestures, typed values, the offer menu, file pickers answered by path rules) and read the result back with `read` @@ -2238,70 +2238,75 @@ Design commands. ## Speed Dial catalog -`action_search` and `action_run` serve the Speed Dial's `ActionRegistry`: the commands' tiles, plates, -recent projects, plugin scripts and pages, and, on request, settings. A tile is a menu item a person picks: -one of a command's `tiles` (`NativeCommand::tiles`, made with `NativeCommands::tile()`: `{key, title, -group, icon, description, args, input?, input_arg?}`, which the command reference writes), or a command's -own tile (`in_palette`), whose key is the command's. A menu item and the command that does its job are one -command, so the items of one job are tiles of one command, each with the arguments that pick its variant: -Mirror > Along X Axis is `object_mirror {axis: "x"}` under the id `obj_mirror_x`, Export G-code is -`project_export {format: "gcode"}` under `export_gcode`, and the nine view directions are `view_set {camera}` -tiles. Eight commands, whose names are their menu items' ids, have a tile of their own: `plate_add`, -`plate_delete`, `plate_duplicate`, `plate_rename`, `filament_add`, `filament_delete`, `undo` and `redo`. +`action_search` and `action_run` serve the Speed Dial's `ActionRegistry`, which holds what a person picks +there, its actions: the commands' actions, plates, recent projects, plugin scripts and pages, and, on request, +settings. A command's actions are those of the Speed Dial's actions that run that command, each with fixed +arguments. Most of them match a menu item; Go to tab... and Go to layer (percent) collect a value in the +Speed Dial and match none. A command's action is one of its `actions` (`NativeCommand::actions`, made with +`NativeCommands::action()`: `{key, title, group, icon, description, args, input?, input_arg?}`, which the +command reference writes), or the command's own action (`has_own_action`), whose key is the command's. A menu +item and the command that does its job are one command, so the items of one job are actions of one command, +each with the arguments that pick its variant: Mirror > Along X Axis is `object_mirror {axis: "x"}` under the +id `obj_mirror_x`, Export G-code is `project_export {format: "gcode"}` under `export_gcode`, and the nine view +directions are `view_set {camera}` actions. Eight commands, whose names are their menu items' ids, have an +action of their own: `plate_add`, `plate_delete`, `plate_duplicate`, `plate_rename`, `filament_add`, +`filament_delete`, `undo` and `redo`. -A tile keeps what a person sees of its menu item: its id (`orca_command::orca`, the item's id as the key, -whatever its command is named), its title, its Speed Dial section (the item's `group`, or the command's -`tile_group` for its own tile, since a command's `group` is its place's heading and one command's tiles come -from several sections: `export_gcode` is in Slice & Export, `export_stl_multi` in Export), its icon and the -value its second phase collects (`input`). A person's pins and run counts are stored under the id, so the -ids of the menu items a released build stored stay the ids of tiles. `tests/data/speed_dial_tiles.json` holds -the 129 tiles (key, title, section, icon, input), and the unit test "every Speed Dial tile of today is still a -tile" finds each in the palette with that presentation and no other; "a menu item's id is a tile's key, not -a command" holds that no menu item's id is a command's name. +An action keeps what a person sees of its menu item: its id (`orca_command::orca`, the item's id as the +key, whatever its command is named), its title, its Speed Dial section (the item's `group`, or the command's +`action_group` for its own action, since a command's `group` is its place's heading and one command's actions +come from several sections: `export_gcode` is in Slice & Export, `export_stl_multi` in Export), its icon and +the value its second phase collects (`input`). A person's pins and run counts are stored under the id, so the +ids of the menu items a released build stored stay the ids of actions. `tests/data/speed_dial_actions.json` +holds the 129 actions (key, title, section, icon, input), and the unit test "every Speed Dial action of today +is still a command's action" finds each in the Speed Dial with that presentation and no other; "a menu item's id +is an action's key, not a command" holds that no menu item's id is a command's name. The commands live in one `CommandCatalog` (`CommandCatalog.hpp`, which includes no wx), built once at startup by `NativeCommands::build()` before the automation runtime starts, and sealed: from then on it never changes and any thread reads it (`NativeCommands::instance()`, `find()`). A process that never calls `build()`, such as the unit tests and the stdio bridge, gets it built on first use; nothing in the GUI process reads it before startup builds it, the automation runtime included, which `GUI_App` starts after `build()`. -`NativeCommands::palette_tiles()` returns the tiles a person picks whatever tab is shown, in the catalog's -order, a command's own tile first and then each item of its tiles, and `ActionRegistry` makes an action of -each, once, at the snapshot: these tiles depend on no tab or mode. `make_action()` makes it: a -`CommandAction` with the tile's id, its title (`NativeCommands::tile_title()`, translated in the command's -`title_context()`), its section and icon, the tile's description as what automation reads, and its `args` -as the action's `preset`, so a pick runs the command with the tile's arguments (`tile_call_args()`) through -`NativeCommands::run()` with a person's context, with the MCP server on or off. A tile shows an agent no -arguments, but a tile that collects a value: that one takes the value alone, under its `input` token, typed -as the command's argument it goes to. `find_tile()` maps a tile's id to its command and tile. +`NativeCommands::speed_dial_actions()` returns the actions a person picks whatever tab is shown, in the +catalog's order, a command's own action first and then each item of its actions, and `ActionRegistry` makes an +`AppAction` of each, once, at the snapshot: these actions depend on no tab or mode. `make_action()` makes it: a +`CommandAction` with the action's id, its title (`NativeCommands::action_title()`, translated in the command's +`title_context()`), its section and icon, the action's description as what automation reads, and its `args` +as the `AppAction`'s `preset`, so a pick runs the command with the action's arguments (`action_call_args()`) +through `NativeCommands::run()` with a person's context, with the MCP server on or off. An action shows an agent +no arguments, but an action that collects a value: that one takes the value alone, under its `input` token, +typed as the command's argument it goes to. `find_command_action()` maps an action's id to its command and +action. -The Design tab's tiles are the exception: `palette_tiles()` leaves group `Design` out, and +The Design tab's actions are the exception: `speed_dial_actions()` leaves group `Design` out, and `ActionRegistry::materialize_design_actions()`, which `materialize_live()` runs beside the plate and -recent-project families for `snapshot()`, `describe()` and `find_live()`, holds a tile for each entry of the -Design table with an action that is offered in the tab's mode, in the table's order (`Mcp::design_tiles()`, by -`Mcp::offered_in_mode()`), while `MainFrame::shown_design_panel()` is not null and the CAD feature is on, and -none otherwise, so the Speed Dial has the sketch's tiles in an open sketch, the model's outside one, and no -Design tile on another tab, nor once the feature is turned off: the tab stays until the restart, but -`cad_gate()` would refuse every pick of its tiles. A Design command with an action of its own has its tile -under its key (`orca_command:sketch_trim:orca`); a menu item folded into a Design command keeps its tile under -the item's id (`orca_command:sk_array:orca`), one of the command's `tiles`, with the item's title and icon, and -a pick runs the command with the item's arguments, as `tool_call {"tool": "sketch_pattern", "args": {"type": -"linear"}}` does. 89 Design tiles in all: 52 commands' own and 37 folded items'. A Design command's own tile, -unlike any other command's, takes its command's arguments. For a Design command, a tile's title is the -entry's name translated with the `Design` context (`title_context()`), as the right-click menu translates it, -and its icon is the entry's. Every place that shows a person a command's title translates it so: the Action -Replay window's step and its summary line, a person's job notices ("Started", "Finished"), the tool list of -the replay and script editors, and a recording's caption of a call (`CaptionBoard` keeps the context beside -the title). A call of a command with exactly a tile's arguments is titled as that tile wherever a person is -shown it (`call_title()`, `tile_with_args()`, which skips a tile that collects a value): a recording's caption -(`McpRecorder::call_started()`, through `shown_title()`, which also titles `action_run` of a tile as the -tile) and an Action Replay step, whose description names the tile (`describe_step()`'s `what` has `tile`, -which `replay_what_text()` titles). Every Design entry's name is marked for translation in that context -(`gen_offer_table.py` writes it as `L_CONTEXT`), also an entry's with no menu item, which has no tile but is -shown in these places. A pin of a Design tile stays in the stored favourites while its tile is not live, and -only leaves the bar that is shown (`prune_favourites()`, `is_design_tile_id()`, which goes by the Design -table's entries with an action, a folded item's among them, so also when the CAD feature was off at startup). -Every other pin with no live action is dropped, a pin stored under an id the table does not have among them, -and the pins around it are kept. A build without CAD has no Design tile, and drops such a pin as any other. +recent-project families for `snapshot()`, `describe()` and `find_live()`, holds an action for each entry of the +Design table with a handler that is offered in the tab's mode, in the table's order (`Mcp::design_actions()`, +by `Mcp::offered_in_mode()`), while `MainFrame::shown_design_panel()` is not null and the CAD feature is on, +and none otherwise, so the Speed Dial has the sketch's actions in an open sketch, the model's outside one, and +no Design tab action on another tab, nor once the feature is turned off: the tab stays until the restart, but +`cad_gate()` would refuse every pick of its actions. A Design command with a handler of its own has its action +under its key (`orca_command:sketch_trim:orca`); a menu item folded into a Design command keeps its action +under the item's id (`orca_command:sk_array:orca`), one of the command's `actions`, with the item's title and +icon, and a pick runs the command with the item's arguments, as `tool_call {"tool": "sketch_pattern", "args": +{"type": "linear"}}` does. 89 Design tab actions in all: 52 commands' own and 37 folded items'. A Design +command's own action, unlike any other command's, takes its command's arguments. For a Design command, an +action's title is the entry's name translated with the `Design` context (`title_context()`), as the right-click +menu translates it, and its icon is the entry's. Every place that shows a person a command's title translates +it so: the Action Replay window's step and its summary line, a person's job notices ("Started", "Finished"), +the tool list of the replay and script editors, and a recording's caption of a call (`CaptionBoard` keeps the +context beside the title). A call of a command with exactly an action's arguments is titled as that action +wherever a person is shown it (`call_title()`, `action_with_args()`, which skips an action that collects a +value): a recording's caption (`McpRecorder::call_started()`, through `shown_title()`, which also titles +`action_run` of an action as that action) and an Action Replay step, whose description names the action +(`describe_step()`'s `what` has `action`, which `replay_what_text()` titles). Every Design entry's name is +marked for translation in that context (`gen_offer_table.py` writes it as `L_CONTEXT`), also an entry's with no +menu item, which has no Speed Dial action but is shown in these places. A pin of a Design tab action stays in +the stored favourites while its action is not live, and only leaves the bar that is shown +(`prune_favourites()`, `is_design_action_id()`, which goes by the Design table's entries with a handler, a +folded item's among them, so also when the CAD feature was off at startup). Every other pin with no live +action is dropped, a pin stored under an id the table does not have among them, and the pins around it are +kept. A build without CAD has no Design tab action, and drops such a pin as any other. The bar's limit of ten is on what it shows: the first ten live pins in their stored order. A pin is refused only while the bar shows ten (`add_favourite()`), so a hidden pin never fills it, and a live pin past the tenth stays stored and comes onto the bar once a pin before it is unpinned. After each pin, unpin and reorder @@ -2315,7 +2320,7 @@ list cuts it to `ActionRegistry::kFavStoredLimit` (100), so a corrupt configurat ### One function, JSON arguments -A command has one function, `run(args, context)`, which the palette, a menu and every automated caller +A command has one function, `run(args, context)`, which the Speed Dial, a menu and every automated caller call. Its arguments are a JSON object that matches its `input_schema`, and every caller checks them first with `Mcp::argument_error(command, args)`, which normalizes them as a tool's (`normalize_arguments()`) and validates them. The context is a `ToolContext`, declared beside the catalog with the other types a command @@ -2323,8 +2328,8 @@ is written in (`CommandTypes.hpp`: `ToolResult`, `ToolFailure`, `GuardClass`). I call, or a `Mcp::PersonContext` (`McpPersonContext.hpp`) for a person's pick, whose `person()` is true. A person's pick runs in place on the UI thread, outside the runtime's dispatch core: it has no job, no journal entry and no operation to hold, and its context reads as cancelled once OrcaSlicer is closing. It needs no MCP -endpoint, so every tile runs with the server off. A pick starts the automation runtime only when its command -needs it: through its context (`runtime()`, `submit()`), as a long command does, or through +endpoint, so every command's action runs with the server off. A pick starts the automation runtime only when +its command needs it: through its context (`runtime()`, `submit()`), as a long command does, or through `GUI_App::automation()`, as a person's recording and the Action Replay and Run Script windows do. Helpers wrap the function a command's author writes and place it on the thread it needs: @@ -2346,10 +2351,10 @@ Helpers wrap the function a command's author writes and place it on the thread i a script it runs runs as the person's. The pick replies at once with the notice "Started:" and the command's title, or an Error when no job started (another operation holds the project, the app is closing); the job's result shows as a notification when it ends. So a pick of Slice and Preview or Slice - All Plates, tiles of `plate_slice`, starts the slice as a job, where a call waits for its result. + All Plates, actions of `plate_slice`, starts the slice as a job, where a call waits for its result. - `with_menu_item_forms(tool, person, ...)` and `with_person_form(tool, person, ...)`: a typed command whose - tiles are menu items that ask, or that act on what a person selected. Its person's forms are `{}` for its - own tile and the `args` of each item that collects no value (`Mcp::person_forms()`); a call that is one of + actions are menu items that ask, or that act on what a person selected. Its person's forms are `{}` for its + own action and the `args` of each item that collects no value (`Mcp::person_forms()`); a call that is one of them (`Mcp::person_form(command, args)`) runs `person` with those arguments on the UI thread, as `ui_command()` runs a function, and any other call is the command's own function. `with_person_form()` is for a command whose own function needs what its person's forms leave out (a path a dialog asks for): @@ -2358,26 +2363,26 @@ Helpers wrap the function a command's author writes and place it on the thread i `"if": {"minProperties": 1}` where the only person's form is `{}`), which the validator reads as "required unless the call is a person's form"; it reads no other use of `if`. A call with `silent` is the own function, given `silent` with the other arguments, so the journal records the call as silent. Where a menu - item does what the command does (the nine camera tiles of `view_set`, Select All and Deselect All of - `object_select`, Auto-Arrange, Auto-Orient, Refresh Plugins), its tile is one of the command's `own_forms`: + item does what the command does (the nine camera actions of `view_set`, Select All and Deselect All of + `object_select`, Auto-Arrange, Auto-Orient, Refresh Plugins), its action is one of the command's `own_forms`: an automated call of it runs the command's own function and replies as any call, and a person's pick runs the same function in place, on the UI thread, showing what the item showed. A - person's pick of a tile that collects a value (Go to layer, Go to tab) runs in place too, given the tile's - call; an automated call of it is the command's own. + person's pick of an action that collects a value (Go to layer, Go to tab) runs in place too, given the + action's call; an automated call of it is the command's own. -The palette and the menus call `NativeCommands::run(key, args)`: it checks the arguments, runs the command +The Speed Dial and the menus call `NativeCommands::run(key, args)`: it checks the arguments, runs the command with a person's context and returns the notice for `notify_result()`, or an Error holding the message when the arguments are refused, the command refuses the call (`ToolFailure`) or it fails without a notice. Any other exception is the command's defect, not an answer to show a person: `run()` logs it with the command's key and lets it through to the application's handler (`GUI_App::OnExceptionInMainLoop()`), which treats it as one from any other event handler, so running out of memory still ends the app there. -Two tiles collect a value in the Speed Dial's second phase and have no dialog: Go to tab and Go to layer, the -tiles `go_to_tab` and `go_to_layer` of `view_set`, whose `input` tokens are `tab` and `percent`. The page sends -the value under the token, and the tile passes it on under its command's argument (`input_arg`: +Two actions collect a value in the Speed Dial's second phase and have no dialog: Go to tab and Go to layer, +the actions `go_to_tab` and `go_to_layer` of `view_set`, whose `input` tokens are `tab` and `percent`. The page +sends the value under the token, and the action passes it on under its command's argument (`input_arg`: `layer_percent` for `percent`; `tab` keeps its name), so `{"percent": 50}` runs `view_set {layer_percent: 50}`; a page id that a word of `view_set`'s `tab` names (`kTabWords`) is given as that word, the Device tab's -`monitor` as `device`. Go to Plate is the tile `plate_goto` of `plate_select`, with `{plate: 0}`: the first +`monitor` as `device`. Go to Plate is the action `plate_goto` of `plate_select`, with `{plate: 0}`: the first plate, as the menu item did when given none, and the plate family of the Speed Dial calls the command with each plate. @@ -2387,58 +2392,58 @@ plate. (`{items, offset, total}`). It can filter by group, lists settings only when asked, and keeps the actions whose id, title, group, source or description holds its `text`, including the English aliases. Each entry has `id`, the English `title` and `group`, `kind`, `description`, `command` (the -catalog key) for a command's tile, its `input_schema` when it takes arguments, and `completes: "export"` +catalog key) for a command's action, its `input_schema` when it takes arguments, and `completes: "export"` for a command whose effect lands in the background. Built-in ids look like `orca_command::orca`. `action_search` gives `describe()` no text. An agent's query is a few words ("delete object"), which no action holds as one text, so `rank_actions()` (McpToolsActions.cpp) scores the listing with the `match_score()` every other search uses: a word matches where a word of what the action is called, or of its description, starts with it. An action is called by its key, its title and its -group, as the palette shows one by group and title: Delete Selected is the Object group's delete, +group, as the Speed Dial shows one by group and title: Delete Selected is the Object group's delete, though its own title names no object. The actions matching more of the words come first, then those -matching more of them in what they are called, then the shorter key, which is the plainer tile: -the tile `obj_delete` before `obj_delete_all`. The key is scored without the `orca_command:` +matching more of them in what they are called, then the shorter key, which is the plainer action: +the action `obj_delete` before `obj_delete_all`. The key is scored without the `orca_command:` and `:orca` around it, which would make "orca" and "command" match every built-in. `tool_search` ranks its `actions` with the same function, so the query that found an action there finds it, and the rest, here. Its `actions` are the actions that are no command (plates, recent projects, plugin -scripts and pages): a command's tile carries its key (`describe()`'s `command`), and the command is among +scripts and pages): a command's action carries its key (`describe()`'s `command`), and the command is among `tool_search`' commands already, so it appears there once. `action_run {id, args}` also takes the key alone (`plate_add`) when only one action has it, as agents and the commands' own messages write it. It resolves the id on the UI thread with `ActionRegistry::find_live()`, which first re-materialises the families whose membership follows live state (plates, recent projects, the -Design tab's tiles; settings are not, being thousands), so the call after one that added a plate, opened a -sketch or switched the tab finds the tiles of the app as it is then, and no longer one that is gone. The +Design tab's actions; settings are not, being thousands), so the call after one that added a plate, opened a +sketch or switched the tab finds the actions of the app as it is then, and no longer one that is gone. The Speed Dial's own picks run from the snapshot it was opened with. An unknown id returns up to three close ids, scored by edit distance against both the full id and its key, a key that contains the request -(`delete_all` in the tile id `obj_delete_all`) counting as closest, and says where to find an action or a -command (see Tool catalog); the id or key of a Design tile that is not live says instead that the tile is -there only while the Design tab is shown in its mode with the CAD feature on, and names the call that runs its +(`delete_all` in the action id `obj_delete_all`) counting as closest, and says where to find an action or a +command (see Tool catalog); the id or key of a Design tab action that is not live says instead that the action +is there only while the Design tab is shown in its mode with the CAD feature on, and names the call that runs its command from any tab, with a folded item's arguments (`tool_call {"tool": "sketch_pattern", "args": {"type": "linear"}}`), or, in a run started with the feature off, that it was off then and how a person turns it on, as `tool_call` does (`unknown_action()`). -A command's tile takes no `args`, or exactly its own, and a tile that collects a value takes that value alone -(`action_args_error()`); a Design command's own tile takes its command's arguments. To run a command with -other arguments an agent calls the command. `action_run` gives the tile's command what a person's pick gives -it (`tile_call_args()`), so the tile runs as a call with its arguments does: a tile that asks in a dialog asks, -and the reply is `blocked_by_dialog`. `action_run` is an automated call, so for the tiles that are the command's -own forms (the camera tiles, Select All and Deselect All, Auto-Arrange, Auto-Orient, Refresh Plugins) it -replies as the command does. The -command runs through a `Mcp::TileContext`, which is `action_run`'s own context except that a command rewriting -its journal entry does so inside `action_run`'s: the step is journaled as `action_run {"id": , "args": }` (`tile_journal_args()`), so a recorded session replays -through `action_run` and the replay is never refused for arguments the tile does not take; a Design command's -own tile, which takes its command's arguments, keeps the command's rewrite. The reply's `ran` is the resolved +A command's action takes no `args`, or exactly its own, and an action that collects a value takes that value +alone (`action_args_error()`); a Design command's own action takes its command's arguments. To run a command +with other arguments an agent calls the command. `action_run` gives the action's command what a person's pick +gives it (`action_call_args()`), so the action runs as a call with its arguments does: an action that asks in a +dialog asks, and the reply is `blocked_by_dialog`. `action_run` is an automated call, so for the actions that +are the command's own forms (the camera actions, Select All and Deselect All, Auto-Arrange, Auto-Orient, Refresh +Plugins) it replies as the command does. The +command runs through a `Mcp::ActionContext`, which is `action_run`'s own context except that a command rewriting +its journal entry does so inside `action_run`'s: the step is journaled as `action_run {"id": , +"args": }` (`action_journal_args()`), so a recorded session replays +through `action_run` and the replay is never refused for arguments the action does not take; a Design command's +own action, which takes its command's arguments, keeps the command's rewrite. The reply's `ran` is the resolved id, added only when the command ran. Any other action (a plugin's script or page, a plate's, a setting's, a recent project's) takes no arguments, so `args` other than `{}` are refused, saying so; it runs through -`ActionRegistry::run(id, args, record_stats=false)`, so agent runs never reorder the palette, and replies as a +`ActionRegistry::run(id, args, record_stats=false)`, so agent runs never reorder the Speed Dial, and replies as a command does. ### Commands that replace a dialog -A call with exactly a tile's arguments is the person's form and asks as the menu item does; any other call runs -from its arguments and opens nothing. Which tiles ask, what each asks, the call that does the same without +A call with exactly an action's arguments is the person's form and asks as the menu item does; any other call +runs from its arguments and opens nothing. Which actions ask, what each asks, the call that does the same without asking, and the commands that open a dialog whatever their arguments are in [mcp-tools.md](mcp-tools.md), When a call opens a dialog or a tool. A path is absolute, and an output takes `overwrite: true` to replace a file that exists; `path_argument()` resolves `{"path", "overwrite"?}` for the menu items that take one and turns @@ -2470,14 +2475,14 @@ objects on them. `filament_delete` takes a 1-based `filament_slot`, the last phy signed in, and `filament_sync_ams` with no printer, no AMS or no filament. A command whose effect its message does not carry sets `AppActionRunResult::reply`, a JSON object whose -fields an automated call's reply has and the palette never shows (`menu_reply()`): `object_order` replies with +fields an automated call's reply has and the Speed Dial never shows (`menu_reply()`): `object_order` replies with the new order (`order: [{object, name, plate}]`) and `descending`, `object_assemble` with the new object's `object` and `name`, `object_separate_instances` with the `objects` the instances are in, and `object_set_instances` with `object` and `instances`. A refusal after a dialog the person answered or read, which told them why, shows nothing more to the person, and a call learns it (`quiet_refusal()`): a cancelled rename is `not_renamed`, a save that wrote nothing `project_not_saved`. `object_arrange {}` and `object_auto_orient {}` say why they did nothing (no objects, or another background job running); their job -is the call's operation (see Worker jobs), so the call, and `action_run` of their tiles, returns once it is +is the call's operation (see Worker jobs), so the call, and `action_run` of their actions, returns once it is done. ### Making a feature reachable @@ -2504,21 +2509,21 @@ declared in the `McpTools*.cpp` of its place beside the commands of that place: For work that finishes later, call `ctx.begin_operation()`, wait with `poll_ui()`, and give the work an identity, as slicing and export do. Work on the UI job worker needs none of that: the call that starts it holds it as its operation (see Worker jobs). -3. Where a menu item does the job, the item is a tile of the command (`NativeCommands::tile()`), with the +3. Where a menu item does the job, the item is an action of the command (`NativeCommands::action()`), with the arguments that pick its variant and the section, title and icon the item has, and the command takes its person's form for it (`menu_command()`, `with_menu_item_forms()` or `with_person_form()`). An item that asks keeps its owner's asking path for that form; the call with arguments must not prompt, and refuses instead. An item with no argument form is a command that is not `listed`. -The command then appears in `tools/list`, in `tool_search`, its tiles in the palette, `action_search` and +The command then appears in `tools/list`, in `tool_search`, its actions in the Speed Dial, `action_search` and `action_run`, and its calls in replays. A new or changed command changes the command reference, `tests/data/command_catalog.json`: the `catalog_reference()` (`CommandCatalog.hpp`) of the catalog a run with the Design tab holds, every added -command in the order it was added with its key, English title, group, description, schema, examples, tiles, -whether it is listed and has a tile of its own, its access labels, guard, completion and the operations it +command in the order it was added with its key, English title, group, description, schema, examples, actions, +whether it is listed and has an action of its own, its access labels, guard, completion and the operations it names. It is where a reader outside the app sees every command, and the skill's list of the Speed Dial's -tiles is written from it (`tools/mcp/gen_skill_reference.py`). The unit test "the checked-in command reference +actions is written from it (`tools/mcp/gen_skill_reference.py`). The unit test "the checked-in command reference matches the catalog" fails until it is regenerated: run `slic3rutils_tests "[Reference]"` with `ORCA_UPDATE_COMMAND_REFERENCE=1` in the environment and check the file in. The test compares the file with its line ends made LF, since a checkout may turn them into CRLF, and a build without CAD does not check it. @@ -3634,7 +3639,7 @@ carries as `encode`, so the agent waits for the MP4 by that job's id. A recordin is encoded when the next `recording_stop` reports it; one nothing reports, a client's that ended with the endpoint, is not encoded. An agent can still encode any recording later with `recording_encode`. -**From the app.** The Speed Dial tiles Take Screenshot, Start Recording and Stop Recording (the tiles +**From the app.** The Speed Dial actions Take Screenshot, Start Recording and Stop Recording (the actions `take_screenshot`, `start_recording` and `stop_recording` of the commands `window_save_screenshot`, `recording_start` and `recording_stop`), which the Help menu also has, give a person screenshots and recordings without an agent: a PNG of the main window, and a recording of it for up to an hour. Both go in @@ -3792,7 +3797,7 @@ last. ## Print host uploads Sending G-code to a print host (OctoPrint, Moonraker, PrusaLink, Duet and the others in -`PrintHost::get_print_host()`) goes through the GUI's own dialog. `printer_send`, whose tile is +`PrintHost::get_print_host()`) goes through the GUI's own dialog. `printer_send`, whose Speed Dial action is `send_gcode` ("Send G-code to printer host", the dialog's title), runs `Ops::send_gcode_to_host()`, which calls `Plater::send_gcode_legacy()`, as the Print button does for such a printer: it opens the Send dialog, whose file name an agent @@ -3902,7 +3907,7 @@ directory, since the GUI changes it. wx ignores `OnExit()`'s return value, so `G ### Action Replay -File › Action Replay…, `window_open {window: "action_replay"}` and its Speed Dial tile (whose id is +File › Action Replay…, `window_open {window: "action_replay"}` and its Speed Dial action (whose id is `open_action_replay`) open `ActionReplayDialog`, where a person opens or writes a replay file, reads its steps and replays it whole or one step at a time. It is a `WebViewHostDialog` page (`resources/web/dialog/ActionReplay/`), modeless and one at a time (`MainFrame::show_action_replay()`). @@ -3931,7 +3936,7 @@ vendored unmodified in `resources/web/include/ace/` (its `src-min-noconflict` co modes, the language tools and the search box) and set up by `resources/web/dialog/js/code_editor.js`. The pages are `file://` URLs, so they load it with script tags, and nothing is loaded on demand: no workers, no snippets, the default commands that would load a file the repository doesn't ship (the -settings menu, error navigation, go to line, the command palette, the mode select) removed, the +settings menu, error navigation, go to line, Ace's own command palette, the mode select) removed, the completers set to the page's own as an array, and the theme applied as an object built from the host's theme tokens, never by name. Ace draws only the rows on screen, and brings indentation, bracket matching, folding, search and replace, multiple cursors and its own undo. Its own text (the search box, the @@ -3960,7 +3965,7 @@ with its own vars and output folder; a step whose effect can't be read (a plugin action, a nested replay too deep or unreadable) gets every flag. Flags only inform. A replacing step either checks unsaved changes itself (`project_new` and `calibration_generate_test` called with their arguments, `project_open` of a project) or goes through the app's own save question -(`close_with_confirm()`): a call of a tile's arguments, which asks as the tile does (`project_new {}`, +(`close_with_confirm()`): a call of an action's arguments, which asks as the action does (`project_new {}`, `project_open {}`, `calibration_generate_test {test}`), and `project_open` of a G-code file. When the project has unsaved changes and the steps to run hold a step of the first kind, or one of the second kind with a step that can answer a dialog, the dialog asks whether to save first. Yes saves; No lets the @@ -3995,8 +4000,8 @@ returned a job into a step with `"await": false` and on jobs it never saw start) and rewrites screenshot paths to `${out_dir}/`. It moves a recording's path there too (`recording_start` records the one it used), and an encode's `save_path`, and an encode's source when an earlier `recording_start` recorded it; another source stays where it is. A -`action_run` of a command's tile, named by its key or its full id, is rewritten as a call of that command, -inside the tile's `{id, args}`, so a recording started from the Start Recording tile moves the same way. +`action_run` of a command's action, named by its key or its full id, is rewritten as a call of that command, +inside the action's `{id, args}`, so a recording started from the Start Recording action moves the same way. A call that runs as a job is judged by its job's final result, not by its reply. `McpCore` tells the journal the job's id when it starts it (`Journal::job_started()`) and its result when the handler @@ -4249,7 +4254,7 @@ matrix arrays need and which the bundled Python lacks unless a file run's PEP 72 ### Run Script panel File › Run Script (the Global shortcut Ctrl+Shift+T, ⌘⇧T on macOS) and the command `script_toggle_panel`, whose -Speed Dial tile has the id `toggle_run_script_panel`, show or hide the Run Script panel (`RunScriptPanel`, page +Speed Dial action has the id `toggle_run_script_panel`, show or hide the Run Script panel (`RunScriptPanel`, page `resources/web/dialog/RunScript/`), a dock pane of the Plater under the 3D view and the sidebar, where a person edits a `.py` file in `# %%` cells and runs a cell, the whole file or a console line in a live session. Showing it selects Prepare when the current tab is @@ -4577,13 +4582,13 @@ sources, a Design command's title context, the schema of a two-form command) and describes and flags a replay's steps; `test_mcp_setup` the HTTP and stdio setups a client copies. In `tests/slic3rutils/`, the files of the same name hold the cases that need the GUI library: -`test_mcp_core` a context with no runtime and a tile's journal update; `test_mcp_protocol` the order of the +`test_mcp_core` a context with no runtime and an action's journal update; `test_mcp_protocol` the order of the process catalog's `tools/list` and the tool families the stdio bridge lists; `test_command_catalog` the process catalog itself: unique keys, the commands under their places' headings in the tool list's order, -which are listed, the Speed Dial's 129 tiles held as data in `tests/data/speed_dial_tiles.json` (tagged -`[SpeedDial]`: each found with its id, title, section, icon and input, every menu item's id a tile's key and no -command, every tile's arguments fitting its command's schema), the person's forms of the commands with tiles -and what a pick of a tile runs in place, the names of `retired_names.hpp`, which no command has, the +which are listed, the Speed Dial's 129 actions held as data in `tests/data/speed_dial_actions.json` (tagged +`[SpeedDial]`: each found with its id, title, section, icon and input, every menu item's id an action's key and +no command, every action's arguments fitting its command's schema), the person's forms of the commands with +actions and what a pick of an action runs in place, the names of `retired_names.hpp`, which no command has, the access labels (`preset_delete` and `plugin_uninstall` alone destructive), a tool list built without a runtime, each command's `id_args` against its schema, the history `undo` and `redo` take, and the command reference (tagged `[Reference]`): the checked-in file against the catalog, and that its entries hold what `tools/list` @@ -4614,7 +4619,7 @@ dialog's description, a web dialog rule's wx buttons and web view handles; budget, non-blocking push, finish, abort and failed frames, the video transform, overlays and frame repeats, captions and what they hide, the ffmpeg command and listings, the files recordings and encodes reserve, and the journal's recording paths; `test_mcp_tools` setting serialization, how a query ranks -the Speed Dial's actions, what `action_run` takes and journals for a tile, a call with a tile's arguments +the Speed Dial's actions, what `action_run` takes and journals for an action, a call with an action's arguments against one with more, `tool_search`' one inventory and its groups, the tool names of `retired_names.hpp` that are no command, and which arguments the journal leaves out; `test_mcp_config` the keys and effective values of the settings commands' targets, the names and places `preset_save` accepts, enum labels and descriptions, the @@ -4683,7 +4688,7 @@ back; `objects_state.json` (printable, Fix Model, Auto Drop), `objects_files.jso some objects, a ZIP's entries), `settings_targets.json` (`settings_list` and the targets of the settings commands), `presets_and_plate_map.json` (`preset_list`'s filters, a plate's filament map, a nozzle variant), `view_switches.json` (`view_set`'s switches, the sidebar and the legend, a plate's origin and size) and -`tiles_ask.json` (a call with a tile's arguments, the two tiles that collect a value, and the tiles +`actions_ask.json` (a call with an action's arguments, the two actions that collect a value, and the actions whose menu item is the command's function). The Python tests check what a replay cannot, a refusal: `tools/mcp/test_menu_items_refusals.py` and `test_additions_refusals.py` each refusal's reason, `test_person_forms.py` the person's forms and a pick that runs in place, `test_preferences.py` the diff --git a/docs/HLSD/mcp-tools.md b/docs/HLSD/mcp-tools.md index 5a0a431a27..93c26fffb0 100644 --- a/docs/HLSD/mcp-tools.md +++ b/docs/HLSD/mcp-tools.md @@ -4,13 +4,13 @@ OrcaSlicer's MCP server gives a client 118 commands, its MCP tools: for the app, the project, its objects, parts and plates, presets and settings, filaments, printers, plugins, the view and windows, recordings, -replays and scripts, and for driving the GUI itself. An agent calls them by name. A person's Speed Dial tiles +replays and scripts, and for driving the GUI itself. An agent calls them by name. A person's Speed Dial actions run them, Action Replay and recordings show them, and the journal records and replays them. A client that knows the app's menus can guess the command that does a menu item's job and the argument that picks the item, and can do from arguments what a person does through the item and its dialog. This document is that command set: how the commands are named and grouped, what each does and takes, which -menu items are tiles of which command, which calls ask in a dialog, and the behaviour a caller relies on +menu items are actions of which command, which calls ask in a dialog, and the behaviour a caller relies on across the commands. How the server serves them (the catalog, the guards, jobs, the journal, the operations layer) is in [mcp-server.md](mcp-server.md). @@ -23,8 +23,8 @@ Each place's commands are written in its family's file, `src/slic3r/GUI/Mcp/McpT and what a command does that a dialog or another interface does too is an operation of `src/slic3r/GUI/Operations/`. What every command takes and replies is in its description and input schema, which `tools/list` gives a client and `tool_search {tool}` gives for any command. -`tests/data/command_catalog.json` holds every command's schema, tiles, labels and examples as an agent sees -them, and `tests/data/speed_dial_tiles.json` the tiles as a person sees them. +`tests/data/command_catalog.json` holds every command's schema, actions, labels and examples as an agent sees +them, and `tests/data/speed_dial_actions.json` the actions as a person sees them. ## Naming @@ -39,8 +39,10 @@ them, and `tests/data/speed_dial_tiles.json` the tiles as a person sees them. the GUI has no name for the thing, the words are plain (`widget_list`, `dialog_answer`). A word the GUI uses for something else is avoided: the `script_` commands run Python, as the Run Script panel does. 3. **One job, one command, and one argument for its variants.** A menu item and the command that does its job - are one command, and the item is a tile of it. Where the GUI has an item for each variant, one argument - picks it: `format`, `shape`, `axis`, `type`, `mode`, `window`, `page`, `camera`. + are one command, and the item is one of its actions: a Speed Dial entry that runs the command with fixed + arguments. Most of a command's actions match a menu item; Go to tab... and Go to layer (percent) collect a + value in the Speed Dial and match none. Where the GUI has an item for each variant, one argument picks it: + `format`, `shape`, `axis`, `type`, `mode`, `window`, `page`, `camera`. 4. **An argument's name means one thing across the commands**, so what an agent learns from one holds for the next: @@ -99,8 +101,8 @@ them and `tool_call` runs them. |---|---|---| | `tool_search` | Find the command that does something, in one search, or read one command's description and schema; beside the commands, the best matches of the actions, the settings and the Python API | `query`, `group`; `tool` | | `tool_call` | Call any command by name, one `tools/list` shows or one it does not, as that command's own call | `tool`, `args` | -| `action_search` | Search what the Speed Dial runs: the commands' tiles, plates, recent projects, plugin scripts and pages, and settings on request | `query`, `group`, `include_settings` | -| `action_run` | Run one of those by its id, as a person's pick does | `id`; `args`: none, or exactly the tile's | +| `action_search` | Search what the Speed Dial runs: the commands' actions, plates, recent projects, plugin scripts and pages, and settings on request | `query`, `group`, `include_settings` | +| `action_run` | Run one of those by its id, as a person's pick does | `id`; `args`: none, or exactly the action's | ### The app @@ -380,13 +382,13 @@ lacks is refused in the same words by every command, which give the plates there ## When a call opens a dialog or a tool -One rule holds for every command: **a call whose arguments are exactly those of one of the command's tiles -is the person's form, and does what a person's pick of that tile does; any other call runs from its arguments -and opens nothing.** A command's own tile is `{}`. +One rule holds for every command: **a call whose arguments are exactly those of one of the command's actions +is the person's form, and does what a person's pick of that action does; any other call runs from its arguments +and opens nothing.** A command's own action is `{}`. - The person's form may ask in a dialog, as the menu item does, or act on the selection. An agent's call of it replies `blocked_by_dialog` where the item asks. -- Where the command's own function needs nothing more than a tile gives, `silent: true` runs it from its +- Where the command's own function needs nothing more than an action gives, `silent: true` runs it from its arguments without asking, with its defaults: `object_add_primitive {shape: "cube", silent: true}` adds the cube at its built-in size, where `{shape: "cube"}` asks for the size. Sixteen commands take `silent`: `project_open`, `project_import`, `project_new`, `project_save`, `project_export`, `object_add_primitive`, @@ -397,15 +399,15 @@ and opens nothing.** A command's own tile is `{}`. an argument, or refuses with the question as its reason: Split's Auto-Drop question (`keep_z`, else `auto_drop_question`), deleting part of a cut object, replacing an installed plugin (`overwrite`), the presets' unsaved changes (`preset_changes`). -- Where a menu item does just what the command does, its tile is the command's own form and a call of it - replies as any call: the camera tiles of `view_set`, Select All and Deselect All, Auto-Arrange, Auto-Orient +- Where a menu item does just what the command does, its action is the command's own form and a call of it + replies as any call: the camera actions of `view_set`, Select All and Deselect All, Auto-Arrange, Auto-Orient and Refresh Plugins. - A call of the person's form is refused while a modal dialog is open or another call's nested loop runs, unless that form opens nothing: `recording_stop {}` stops the recording wherever the command runs. -### The tiles that ask, and the call that does not +### The actions that ask, and the call that does not -| Command, called as its tile | It asks | The call that does not ask | +| Command, called as its action | It asks | The call that does not ask | |---|---|---| | `project_open {}` | the unsaved changes question, then the Open dialog | `path`, with `discard_changes` where the project has unsaved changes | | `project_import {}`, `project_import {archive: true}` | a file dialog; the archive, then its file list | `paths`, and `entries` for an archive | @@ -436,14 +438,14 @@ These open a dialog or a gizmo whatever their arguments, and the caller answers | `preset_migrate_filaments`, `app_check_for_updates` | the migration's dialog; the answer to the check | `dialog_answer` | | `object_add_text`, `object_add_svg` | none: the Text or SVG gizmo opens on the new part | the gizmo, through `widget_list` and the input commands | -### Every tile and the call it makes +### Every action and the call it makes -56 commands have tiles, 129 in all. A tile's id is `orca_command::orca`, under the key of the menu item -it was: a command's own tile under the command's key (eight: `undo`, `redo`, `plate_add`, `plate_delete`, -`plate_duplicate`, `plate_rename`, `filament_add`, `filament_delete`), any other under the item's id, which -`tests/data/speed_dial_tiles.json` lists. +56 commands have actions, 129 in all. An action's id is `orca_command::orca`, under the key of the menu +item it was: a command's own action under the command's key (eight: `undo`, `redo`, `plate_add`, +`plate_delete`, `plate_duplicate`, `plate_rename`, `filament_add`, `filament_delete`), any other under the +item's id, which `tests/data/speed_dial_actions.json` lists. -| Command | Its tiles, and the call each makes | +| Command | Its actions, and the call each makes | |---|---| | `undo` | Undo `{}` | | `redo` | Redo `{}` | @@ -502,26 +504,27 @@ it was: a command's own tile under the command's key (eight: `undo`, `redo`, `pl | `recording_start` | Start Recording `{}` | | `recording_stop` | Stop Recording `{}` | -Go to tab and Go to layer collect a value in the Speed Dial's second phase, which the tile passes on under -`tab` or `layer_percent`; `action_run` takes it under the tile's own name for it, `tab` or `percent`. Go to Plate goes to the first plate, as its menu item did, and the Speed Dial's plate -family calls `plate_select` with each plate. A tile of `object_order` reverses the order the objects already -have, as Order By does; `descending` says which way. +Go to tab and Go to layer collect a value in the Speed Dial's second phase, which the action passes on under +`tab` or `layer_percent`; `action_run` takes it under the action's own name for it, `tab` or `percent`. Go to +Plate goes to the first plate, as its menu item did, and the Speed Dial's plate family calls `plate_select` +with each plate. An action of `object_order` reverses the order the objects already have, as Order By does; +`descending` says which way. -## Tiles, titles, the journal and replays +## Actions, titles, the journal and replays -- A tile's id is what a person's pins and run counts are stored under, and the ids of the menu items a - released build stored stay the ids of tiles, whatever their command is called. The unit test "every Speed - Dial tile of today is still a tile" holds each one to its title, section, icon and value. -- A tile runs its command with its arguments, with the MCP server on or off. `action_run` takes no `args` for - a tile, or exactly the tile's, or the value of a tile that collects one, and journals the step as that - `action_run`, so a replay runs it again. -- A call of a command with exactly a tile's arguments is titled as that tile wherever a person is shown the - call: a job notice, a recording's caption, an Action Replay step. -- A tile picked by a person runs in place, on the UI thread, but for a long command's: Slice and Preview and - Slice All Plates start the slice as a job and show its result as a notification, where a call waits for +- An action's id is what a person's pins and run counts are stored under, and the ids of the menu items a + released build stored stay the ids of actions, whatever their command is called. The unit test "every Speed + Dial action of today is still a command's action" holds each one to its title, section, icon and value. +- An action runs its command with its arguments, with the MCP server on or off. `action_run` takes no `args` + for an action, or exactly the action's, or the value of an action that collects one, and journals the step + as that `action_run`, so a replay runs it again. +- A call of a command with exactly an action's arguments is titled as that action wherever a person is shown + the call: a job notice, a recording's caption, an Action Replay step. +- An action picked by a person runs in place, on the UI thread, but for a long command's: Slice and Preview + and Slice All Plates start the slice as a job and show its result as a notification, where a call waits for the result. -How the tiles are made and found is in mcp-server.md, Speed Dial catalog. +How the actions are made and found is in mcp-server.md, Speed Dial catalog. ## When a command may run @@ -628,7 +631,7 @@ The Design tab is a parametric CAD modeller inside OrcaSlicer, an optional compo feature is on. The MCP server gives a client 88 commands for it, in the command catalog's group `Design`. A client that knows a mainstream CAD program can guess the command, the argument that picks its variant and that argument's values, and can do from arguments what a person does with the tab's tools. The same commands -are what a person's Speed Dial tiles run while the tab is shown, what Action Replay and recordings show, and +are what a person's Speed Dial actions run while the tab is shown, what Action Replay and recordings show, and what the journal records and replays. No listing shows them: `tool_search`' description names each under its heading, `tool_search {tool}` gives its schema, and `tool_call` runs it. @@ -641,7 +644,7 @@ How the server holds them (the catalog with the CAD feature on, the gate) is in One table defines them all: `scripts/CAD/tool_atlas.json`. `scripts/CAD/gen_offer_table.py` writes `src/slic3r/GUI/CAD/DesignOffer.hpp` from it, and the commands' code is `src/slic3r/GUI/Mcp/McpToolsCad.cpp`. What every command takes and replies is in its entry's tool block, which the agent reads through -`tool_search {tool}`; `tests/data/command_catalog.json` holds every command's schema, tiles and examples as +`tool_search {tool}`; `tests/data/command_catalog.json` holds every command's schema, actions and examples as an agent sees them. ### Naming @@ -979,10 +982,10 @@ opens that item's tool for a person, as a pick of the item does; any other call that row as what four menu items act on: `feature_edit`, `rename_selected`, `feature_delete` and `sketch_constrain_selected`. - The reply is `{"result": {"interactive": true, "tool", "applies", "modal", "selection_kind", "busy", - "status"}}`: the command called, whether the menu item accepts the selection, whether a dialog the action - opened held the call until it was answered, the selection's kind, what the tab has open after the action, - and its status line. It claims nothing about what the action did, which may be to open a card, arm a - sketch tool, act at once, or say on the status line why it cannot. + "status"}}`: the command called, whether the menu item accepts the selection, whether a dialog the item's + handler opened held the call until it was answered, the selection's kind, what the tab has open after the + handler ran, and its status line. It claims nothing about what the handler did, which may be to open a + card, arm a sketch tool, act at once, or say on the status line why it cannot. - A command's description ends with the calls that open a tool, each with its menu item's name, so that a search for "rounded rectangle" or "polar array" finds the command. @@ -1055,36 +1058,36 @@ model and is refused while a sketch is open. `tool_atlas.json` has 127 entries. Each is one of these: -- **A command with a menu item**: the item's slot, key, action, accepts, mode, name, icon and hint, and the - command's tool block, under the command's name. 47 commands. -- **An argument-only command**: a tool block and no action. 36 commands: 35 have no menu item, and `measure`'s - item, which has no action, is shown disabled. -- **A menu-only command**: an action and no tool block. Five, under Menu items. +- **A command with a menu item**: the item's slot, key, handler (`action`), accepts, mode, name, icon and + hint, and the command's tool block, under the command's name. 47 commands. +- **An argument-only command**: a tool block and no handler. 36 commands: 35 have no menu item, and + `measure`'s item, which has no handler, is shown disabled. +- **A menu-only command**: a handler and no tool block. Five, under Menu items. - **A folded item**: a menu item that is no command. It keeps its id, which the menu, the keys, the toolbar, - the tiles and the GUI tests use, and names its command and the arguments that choose it: `"fold": {"into": - "sketch_draw", "args": {"type": "circle_center"}}`. 37 items, folded into eight commands. + the Speed Dial actions and the GUI tests use, and names its command and the arguments that choose it: + `"fold": {"into": "sketch_draw", "args": {"type": "circle_center"}}`. 37 items, folded into eight commands. - **A greyed item**: an item with neither, shown disabled. Two: Pattern on Curve (`pat_curve`), whose function is `pattern {type: "curve"}`, and Align to (`align_to`), which is not built. -That is 88 commands and 89 menu items with an action, each of which has a Speed Dial tile. +That is 88 commands and 89 menu items with a handler, each of which has a Speed Dial action. The right-click menu's rows and their order are ratified (`_ratified` in the atlas): a row's index is its address, and changing one is a breaking change. -### Tiles, titles, the journal and replays +### Actions, titles, the journal and replays -- Every entry with an action has a Speed Dial tile while the Design tab is shown, in its mode. A command's - own menu item's tile is under the command's key (`orca_command:sketch_trim:orca`); a folded item keeps its - tile under its own id (`orca_command:sk_array:orca`) with the item's title and icon. -- A pick of a folded item's tile runs its command with the item's arguments, with the MCP server on or off. - Its action shows an agent no arguments, and `action_run` takes none for it, or exactly the item's; that is +- Every entry with a handler has a Speed Dial action while the Design tab is shown, in its mode. A command's + own menu item's action is under the command's key (`orca_command:sketch_trim:orca`); a folded item keeps + its action under its own id (`orca_command:sk_array:orca`) with the item's title and icon. +- A pick of a folded item's action runs its command with the item's arguments, with the MCP server on or + off. It shows an agent no arguments, and `action_run` takes none for it, or exactly the item's; that is what the journal records, so a replay runs it again. -- A call of a command with a menu item's arguments is titled as that item's tile wherever a person is shown - the call: a job notice, a recording's caption, an Action Replay step (`replay_what_text()`). -- A folded tile that is not shown is named, when a call asks for it, with the call that runs it from any - tab: `tool_call {"tool": "sketch_pattern", "args": {"type": "linear"}}`. +- A call of a command with a menu item's arguments is titled as that item's action wherever a person is + shown the call: a job notice, a recording's caption, an Action Replay step (`replay_what_text()`). +- A folded item's action that is not shown is named, when a call asks for it, with the call that runs it + from any tab: `tool_call {"tool": "sketch_pattern", "args": {"type": "linear"}}`. - The MCP skill's reference (`tools/mcp/gen_skill_reference.py`) gives a command a row of its own only when - it has an action of its own, and one row per folded tile with its arguments. + it has an action of its own, and one row per folded item's action with its arguments. ### When a command may run diff --git a/docs/HLSD/scene-benchmark.md b/docs/HLSD/scene-benchmark.md index 21e4ec574c..f75b8075ff 100644 --- a/docs/HLSD/scene-benchmark.md +++ b/docs/HLSD/scene-benchmark.md @@ -14,7 +14,7 @@ can be pasted into an issue. ## What it does `run_scene_benchmark()` in `src/slic3r/GUI/SceneBenchmark.cpp` is reached from Help > -Benchmark 3D Scene, the command palette and Preferences > Graphics. After a confirmation +Benchmark 3D Scene, the Speed Dial and Preferences > Graphics. After a confirmation it starts a new project, which asks to save the current one if needed, loads the OrcaSliced Combo handy model and arranges it. A small dialog in a corner of the 3D view then shows the progress; every other window is disabled until the run ends, so a click diff --git a/resources/web/dialog/SpeedDial/speeddial.js b/resources/web/dialog/SpeedDial/speeddial.js index 056611a558..397ea32c25 100644 --- a/resources/web/dialog/SpeedDial/speeddial.js +++ b/resources/web/dialog/SpeedDial/speeddial.js @@ -99,7 +99,7 @@ var searchNeedle = ""; var searchTokens = []; var searchTokenRes = []; -// Palette phase: 'commands' (one unified search over actions/commands/settings, recents on empty +// The Speed Dial's phase: 'commands' (one unified search over actions/commands/settings, recents on empty // query), 'percent' ("Go to layer" second phase: enter a 0-100 percentage), 'tab' ("Go to tab..." // second phase: pick a notebook tab). var phase = "commands"; @@ -1493,7 +1493,7 @@ function run(a) { SendMessage({ command: "run_action", id: a.id, title: a.title, args: {} }); } -// Activate an entry in the main phase. Two-phase commands switch the palette to their input phase +// Activate an entry in the main phase. Two-phase commands switch the Speed Dial to their input phase // instead of running; everything else (including a setting jump, which is a plain action now) runs. function activateEntry(a) { if (!a) return; diff --git a/scripts/CAD/README.md b/scripts/CAD/README.md index 96cbe098b5..7d3a6bf788 100644 --- a/scripts/CAD/README.md +++ b/scripts/CAD/README.md @@ -50,9 +50,10 @@ compiled against it cannot drift apart: | `mate-glyph/emit_glyph_table.py` | `mate-glyph/bear_outline.json`, measured off `mate-glyph/bear.step` by `extract_outline.py` | the `kBear…` tables in `DesignSketchTool.cpp` | The atlas's `verbs` are one table for three things: the right-click menu (a verb with a `slot` has an -item there), the Speed Dial's Design tiles and the Design commands. Every verb but `align` is a command -whose key is its `id`. A verb with an `action` does what its menu item does when called with no -arguments, in the mode the item belongs to, and has a tile; one with a `tool` block also runs silently +item there), the Speed Dial's Design tab actions and the Design commands. Every verb but `align` is a +command whose key is its `id`. A verb with a handler (`action`) does what its menu item does when called +with no arguments, in the mode the item belongs to, and has an action of its own in the Speed Dial; one +with a `tool` block also runs silently with arguments, and the block holds what that form takes and does: its `access` (`read`, `change` or `sketch`, which decides what a busy Design tab lets through), `ok_false` (it reports a rejected rebuild in its reply), a `summary` of one sentence, @@ -60,10 +61,10 @@ in its reply), a `summary` of one sentence, `max`, `enum` and `description`; one with no default is required, and one whose default is null also takes null, unless `nullable` is false, which marks a param whose function reads a null as given), one to three `examples` and `ids` -(it takes or gives face and edge ids). Entries with no `slot` and no `action` are commands only, and -`modal` marks a verb whose action opens a dialog. `src/slic3r/GUI/Mcp/McpToolsCad.cpp` binds each block +(it takes or gives face and edge ids). Entries with no `slot` and no handler are commands only, and +`modal` marks a verb whose handler opens a dialog. `src/slic3r/GUI/Mcp/McpToolsCad.cpp` binds each block to the function that runs it (`kSilentForms`), and a unit test fails when a block has no function or a -function no block. The generator refuses an entry with neither an action nor a block, but `align`. +function no block. The generator refuses an entry with neither a handler nor a block, but `align`. `python3 scripts/CAD/gen_offer_table.py` rewrites the header and `--check` proves the checked-in one matches the atlas. The "Check CAD offer table" workflow diff --git a/scripts/CAD/gen_offer_table.py b/scripts/CAD/gen_offer_table.py index e3e6397ddf..b3fb3adb3d 100644 --- a/scripts/CAD/gen_offer_table.py +++ b/scripts/CAD/gen_offer_table.py @@ -5,8 +5,8 @@ python3 scripts/CAD/gen_offer_table.py --check # verify the checked-in header The map exists ONCE: the atlas is the only place a verb's row, key, icon, refusal string and -Design command are written down, so the menu the user sees, the Speed Dial's Design tiles and the -commands automation calls cannot drift from the table the code is compiled against. +Design command are written down, so the menu the user sees, the Speed Dial's Design tab actions and +the commands automation calls cannot drift from the table the code is compiled against. Output: src/slic3r/GUI/CAD/DesignOffer.hpp, checked in and never hand-edited. """ @@ -111,22 +111,22 @@ def faults(A): An unknown slot or selection would surface as a bare ValueError from .index() below, and a duplicate verb id would not surface at all: a verb is looked up by id (DesignPanel::mcp_run_verb, the catalog's command keys) and the first match taken, so the second item would be unreachable. - An entry with no menu item, no action and no tool block is nothing; an item with neither is greyed (Align to, - until it has a GUI path), and no command. + An entry with no menu item, no handler (`action`) and no tool block is nothing; an item with neither is + greyed (Align to, until it has a GUI path), and no command. A folded item (`fold`) is a way of calling the command `into` names with `args`: it keeps its row and - its action and has no block of its own, and its command is an entry with a block that is no folded - item. An entry with an action and a block may name the `args` that choose its own item. The arguments + its handler and has no block of its own, and its command is an entry with a block that is no folded + item. An entry with a handler and a block may name the `args` that choose its own item. The arguments that choose an item are ones its command takes, and choose that item only (Mcp::opened_item()): no two - items of one command with equal args and different actions, and no folded item with the args its + items of one command with equal args and different handlers, and no folded item with the args its command's own item takes, which a call with none also gives. A command's items are in one mode. - Every command, an entry with an action or a block that is no folded item, has a `section`, its heading in + Every command, an entry with a handler or a block that is no folded item, has a `section`, its heading in tool_search's index (SECTIONS); a folded or greyed item, which is no command, has none. - `feature_row` marks an item whose action acts on the selected row of the Feature list, which a call of its + `feature_row` marks an item whose handler acts on the selected row of the Feature list, which a call of its command takes as its target when nothing is picked in the view (Mcp::open_refusal()): only a command with a menu item - of its own has one, an entry with an action that is no folded item. + of its own has one, an entry with a handler that is no folded item. """ slot_ids = {s["id"] for s in A["slots"]} sel_ids = {s["id"] for s in A["selections"]} @@ -134,9 +134,9 @@ def faults(A): for v in A["verbs"]: vid = v["id"] if v["slot"] is None: - # A command only: no menu item, so no action the menu could run either. + # A command only: no menu item, so no handler the menu could run either. if v.get("action"): - errs.append(f"{vid}: an action needs a slot") + errs.append(f"{vid}: a handler (action) needs a slot") elif v["slot"] not in slot_ids: errs.append(f'{vid}: unknown slot {v["slot"]!r}') for a in v.get("accepts", []): @@ -147,9 +147,9 @@ def faults(A): seen.add(vid) block = v.get("tool") if v["slot"] is None and not v.get("action") and block is None: - errs.append(f"{vid}: neither a menu item, an action nor a tool block") + errs.append(f"{vid}: neither a menu item, a handler (action) nor a tool block") if v.get("modal") and not v.get("action"): - errs.append(f"{vid}: modal without an action") + errs.append(f"{vid}: modal without a handler (action)") command = (v.get("action") or block is not None) and "fold" not in v if not command and "section" in v: errs.append(f"{vid}: a folded or greyed item is no command and has no section") @@ -158,7 +158,7 @@ def faults(A): elif command and v["section"] not in SECTIONS: errs.append(f'{vid}: section {v["section"]!r} is not one of {list(SECTIONS)}') if v.get("feature_row") and (not v.get("action") or "fold" in v): - errs.append(f"{vid}: feature_row needs a menu item of its own: an action, and no fold") + errs.append(f"{vid}: feature_row needs a menu item of its own: a handler (action), and no fold") if block is not None: if block.get("access") not in ACCESS: errs.append(f'{vid}: tool access {block.get("access")!r} is not one of {sorted(ACCESS)}') @@ -175,7 +175,7 @@ def faults(A): errs.append(f'{vid}: closed must be true or false, not {block["closed"]!r}') if "args" in v: if not v.get("action") or block is None: - errs.append(f"{vid}: own args need an action and a tool block") + errs.append(f"{vid}: own args need a handler (action) and a tool block") elif same(v["args"], {}): errs.append(f"{vid}: own args {{}} are what a call with none gives") else: @@ -193,7 +193,7 @@ def faults(A): errs.append(f"{vid}: fold must be an object {{into, args}}, not {fold!r}") continue if not v.get("action"): - errs.append(f"{vid}: a fold needs an action, the item's own") + errs.append(f"{vid}: a fold needs a handler (action), the item's own") if v.get("tool") is not None: errs.append(f"{vid}: a folded item has no tool block: its command has it") into = by_id.get(fold.get("into")) @@ -219,7 +219,7 @@ def faults(A): if mode_of(other) != mode_of(v): errs.append(f"{vid}: in another mode than {other['id']}, folded into {into['id']} too") if same(other["fold"]["args"], args) and other.get("action") != v.get("action"): - errs.append(f"{vid}: the same args as {other['id']}, with another action") + errs.append(f"{vid}: the same args as {other['id']}, with another handler") folded.setdefault(into["id"], []).append(v) for s in sel_ids - set(ENUM): errs.append(f"selection {s!r} has no OfferSel enumerator") @@ -247,13 +247,13 @@ def main(): "// has ONE row index, that index is the same in every selection it appears in, and verbs that do", "// not apply are shown disabled in place with their reason rather than removed. Row order was", "// ratified 2026-07-31; changing an index is a breaking change to every user's muscle memory.", - "// An entry with an action or a tool block, and no fold_into, is a command of the catalog's group Design", + "// An entry with a handler or a tool block, and no fold_into, is a command of the catalog's group Design", "// (Mcp::register_cad_commands(), Mcp::is_design_command()), under its section in tool_search's index. A", "// call whose arguments are exactly those that choose one of its items opens that item's tool for a person", - "// (Mcp::opened_item()): none choose the entry's own item where it has an action, else the items folded into it", + "// (Mcp::opened_item()): none choose the entry's own item where it has a handler, else the items folded into it", "// with {}; a folded item's args, or the entry's own, choose that item. Any other call runs its tool block's", "// silent form. A folded item (fold_into) is no command: it is a way of calling the command it names. An item", - "// with neither an action nor a tool block is greyed, and no command. An entry with no menu item is a command only.", + "// with neither a handler nor a tool block is greyed, and no command. An entry with no menu item is a command only.", "#ifndef slic3r_GUI_DesignOffer_hpp_", "#define slic3r_GUI_DesignOffer_hpp_", "", @@ -298,7 +298,7 @@ def main(): "// of a tool, which only a rebuild refuses, as the Design tab's keys and menu do.", "enum class CadAccess { None, Read, Change, Sketch, Ui };", "", - "// One entry of the table. `action` routes to the code that already implements the verb:", + "// One entry of the table. Its handler (`action`) routes to the code that already implements the verb:", '// "key:S+E" -> m_keys_feature[SHIFT(\'E\')]', '// "key:L" -> m_keys_sketch[\'L\']', '// "fly:material#4" -> row 4 of the "material" feature flyout', @@ -324,7 +324,7 @@ def main(): " const char* family;", " const char* icon; // resources/images name, or nullptr — the offer draws it beside the item", " const char* hint; // what the verb does / what to click; shown on hover", - " bool modal; // its action opens a dialog that waits for an answer: a modal one, which holds", + " bool modal; // its handler opens a dialog that waits for an answer: a modal one, which holds", " // the call until it is answered, or Text's, which is modeless and does not", " CadAccess access; // its silent form's, None without one", " bool ok_false; // its silent form reports a rejected rebuild in its reply (ok false)", @@ -334,12 +334,12 @@ def main(): " const char* doc;", " const char* fold_into; // the id of the command this item is a variant of, or nullptr", " // The arguments that choose this item, as JSON text: a folded item's, or those that choose the own item of", - " // an entry with an action and a tool block as a call with none does; nullptr for none.", + " // an entry with a handler and a tool block as a call with none does; nullptr for none.", " const char* args;", " // The heading its command is listed under in tool_search's index (kDesignSections,", " // Mcp::design_command_index()); nullptr for an entry that is no command.", " const char* section;", - " // Its action acts on the selected row of the Feature list, which a call of its command, not a person's", + " // Its handler acts on the selected row of the Feature list, which a call of its command, not a person's", " // pick, takes as what the item is for while nothing is picked in the view (Mcp::open_refusal()).", " bool feature_row;", "};", @@ -393,8 +393,9 @@ def main(): in_menu = v["slot"] is not None # Every name is marked, an entry's with no menu item too: it is its command's title, which a person # sees translated in the Design context in the Action Replay window and a recording's caption, - # and on the tile of an entry with a menu item. A table with an unmarked name is refused, written or - # checked, since nothing at run time can tell (L_CONTEXT compiles to the bare string). + # and on the Speed Dial action of an entry with a menu item. A table with an unmarked name is + # refused, written or checked, since nothing at run time can tell (L_CONTEXT compiles to the bare + # string). name = tstr_design(v["name"]) if not (name.startswith('L_CONTEXT("') and name.endswith('", "Design")')): sys.exit(f'entry {v["id"]}: its name is not marked for translation in the Design context: {name}') @@ -446,7 +447,7 @@ def main(): blocks = sum(1 for v in A["verbs"] if v.get("tool")) folded = sum(1 for v in A["verbs"] if v.get("fold")) print(f"wrote {os.path.relpath(OUT, REPO)}: {len(A['verbs'])} entries, {len(in_menu)} in " - f"{len(slots)} rows, {wired} wired to existing actions, {blocks} with a silent form, " + f"{len(slots)} rows, {wired} with a handler, {blocks} with a silent form, " f"{folded} folded into their commands") return 0 diff --git a/scripts/CAD/test_gen_offer_table.py b/scripts/CAD/test_gen_offer_table.py index 67e80b0d62..aca70bf870 100644 --- a/scripts/CAD/test_gen_offer_table.py +++ b/scripts/CAD/test_gen_offer_table.py @@ -29,7 +29,7 @@ def block(params=None, **extra): def atlas(): """One slot, two selections, a command with a block and a menu item (paint), and a second item (tint), a command with - an action only; each under its heading.""" + a handler only; each under its heading.""" return { "slots": [{"id": "make", "label": "Make"}], "selections": [{"id": "none"}, {"id": "body_solid"}], @@ -47,9 +47,9 @@ def entry(A, vid): return next(v for v in A["verbs"] if v["id"] == vid) -def item(vid, action, **extra): +def item(vid, handler, **extra): v = {"id": vid, "name": vid.title(), "slot": "make", "key": None, "accepts": ["body_solid"], - "action": action, "icon": vid, "hint": "Do " + vid} + "action": handler, "icon": vid, "hint": "Do " + vid} v.update(extra) return v @@ -84,7 +84,7 @@ class Faults(unittest.TestCase): entry(A, "tint")["id"] = "anything" self.assertEqual(gen.faults(A), []) - def test_items_of_one_command_with_equal_args_and_one_action_pass(self): + def test_items_of_one_command_with_equal_args_and_one_handler_pass(self): A = atlas() entry(A, "tint")["fold"] = {"into": "paint", "args": {"shade": "blue"}} del entry(A, "tint")["section"] @@ -105,11 +105,11 @@ class Faults(unittest.TestCase): # --- a fold ---------------------------------------------------------------------------------- - def test_a_fold_on_an_entry_with_no_action(self): + def test_a_fold_on_an_entry_with_no_handler(self): A = atlas() del entry(A, "tint")["action"] entry(A, "tint")["fold"] = {"into": "paint", "args": {}} - self.assertFault(A, "tint", "fold needs an action") + self.assertFault(A, "tint", "fold needs a handler") def test_a_fold_on_an_entry_with_a_block(self): A = atlas() @@ -170,7 +170,7 @@ class Faults(unittest.TestCase): entry(A, "paint")["args"] = {"shade": "green"} self.assertFault(A, "paint", "'green'") - def test_two_items_of_one_command_with_equal_args_and_different_actions(self): + def test_two_items_of_one_command_with_equal_args_and_different_handlers(self): A = atlas() entry(A, "tint")["fold"] = {"into": "paint", "args": {"shade": "blue"}} A["verbs"].append(item("wash", "btn:wash", fold={"into": "paint", "args": {"shade": "blue"}})) @@ -188,15 +188,15 @@ class Faults(unittest.TestCase): entry(A, "tint")["fold"] = {"into": "paint", "args": {}} self.assertFault(A, "tint", "the args paint's own item takes") - def test_own_args_on_an_entry_with_no_action(self): + def test_own_args_on_an_entry_with_no_handler(self): A = atlas() A["verbs"].append({"id": "rinse", "name": "Rinse", "slot": None, "tool": block(), "args": {"shade": "red"}}) - self.assertFault(A, "rinse", "own args need an action and a tool block") + self.assertFault(A, "rinse", "own args need a handler (action) and a tool block") def test_own_args_on_an_entry_with_no_block(self): A = atlas() entry(A, "tint")["args"] = {"shade": "red"} - self.assertFault(A, "tint", "own args need an action and a tool block") + self.assertFault(A, "tint", "own args need a handler (action) and a tool block") def test_empty_own_args(self): A = atlas() @@ -248,7 +248,7 @@ class Faults(unittest.TestCase): entry(A, "paint")["feature_row"] = True self.assertEqual(gen.faults(A), []) - def test_feature_row_on_an_entry_with_no_action(self): + def test_feature_row_on_an_entry_with_no_handler(self): A = atlas() A["verbs"].append({"id": "rinse", "name": "Rinse", "section": "Solid", "slot": None, "tool": block(), "feature_row": True}) @@ -263,10 +263,10 @@ class Faults(unittest.TestCase): # --- entries and blocks ---------------------------------------------------------------------- - def test_an_entry_with_no_slot_no_action_and_no_block(self): + def test_an_entry_with_no_slot_no_handler_and_no_block(self): A = atlas() A["verbs"].append({"id": "nothing", "name": "Nothing", "slot": None}) - self.assertFault(A, "nothing", "neither a menu item, an action nor a tool block") + self.assertFault(A, "nothing", "neither a menu item, a handler (action) nor a tool block") def test_a_closed_that_is_no_boolean(self): A = atlas() diff --git a/scripts/CAD/tool_atlas.json b/scripts/CAD/tool_atlas.json index 09ea5aed56..4eb5e9f36f 100644 --- a/scripts/CAD/tool_atlas.json +++ b/scripts/CAD/tool_atlas.json @@ -1,6 +1,6 @@ { "_comment": [ - "Source of truth for the Design tab's table: the object-driven tool offer, its Speed Dial tiles and its", + "Source of truth for the Design tab's table: the object-driven tool offer, its Speed Dial actions and its", "commands (see docs/HLSD/design-tab.md).", "Every verb, the selections it accepts, the document state it needs, and its fixed", "compass address. Extracted from the code, not from memory:", diff --git a/scripts/operation_calls_baseline.txt b/scripts/operation_calls_baseline.txt index 94fa9f5691..58fe8f9949 100644 --- a/scripts/operation_calls_baseline.txt +++ b/scripts/operation_calls_baseline.txt @@ -6,9 +6,9 @@ # Generate candidates with: python3 scripts/check_operation_calls.py --print [src/slic3r/GUI/NativeCommands.cpp] -# The asking path of a command, its menu item's tile (MenuItems): the item's function calls the owner's method, which +# The asking path of a command, its menu item's action (MenuItems): the item's function calls the owner's method, which # asks the person what an operation would be told (project_open {}, project_save {save_as: true}, project_import -# {archive: true}, project_export with a tile's arguments, filament_sync_ams {}). +# {archive: true}, project_export with an action's arguments, filament_sync_ams {}). plater->load_project(); return NativeCommands::project_save_result(plater->save_project(true)); plater->import_zip_archive(); diff --git a/src/slic3r/GUI/ActionIds.hpp b/src/slic3r/GUI/ActionIds.hpp index 0476c1accc..65c367b7bc 100644 --- a/src/slic3r/GUI/ActionIds.hpp +++ b/src/slic3r/GUI/ActionIds.hpp @@ -2,8 +2,8 @@ #include -// The built-in action source's key and name, and the prefix of a command's tile id. No wx here: this header is part -// of the library libslic3r_automation, which is built without wx. +// The built-in action source's key and name, and the prefix of the id of a command's action. No wx here: this header +// is part of the library libslic3r_automation, which is built without wx. namespace Slic3r { namespace GUI { // Stable identity/display name of the built-in ("OrcaSlicer") action source. Shared by the native @@ -11,12 +11,12 @@ namespace Slic3r { namespace GUI { // action re-keys together. inline constexpr const char* kOrcaSourceKey = "orca"; inline constexpr const char* kOrcaSourceName = "OrcaSlicer"; -// The prefix of a catalog command's tile id, "orca_command::orca" (NativeCommands::make_action()). +// The prefix of the id of a catalog command's action, "orca_command::orca" (NativeCommands::make_action()). inline constexpr const char* kCommandPrefix = "orca_command"; -// The key inside a command's tile id, "orca_command::orca"; `id` itself when it has no colon, the name inside the -// id, which action_run takes in its place; empty for any other action's id. -inline std::string command_tile_key(const std::string& id) +// The key inside the id of a command's action, "orca_command::orca"; `id` itself when it has no colon, the name +// inside the id, which action_run takes in its place; empty for any other action's id. +inline std::string command_action_key(const std::string& id) { if (id.find(':') == std::string::npos) return id; diff --git a/src/slic3r/GUI/ActionRegistry.cpp b/src/slic3r/GUI/ActionRegistry.cpp index 35189512c5..c5ced9877a 100644 --- a/src/slic3r/GUI/ActionRegistry.cpp +++ b/src/slic3r/GUI/ActionRegistry.cpp @@ -68,7 +68,7 @@ std::vector cap_favourites(const std::vector& ids, siz return out; } -bool is_design_tile_id([[maybe_unused]] const std::string& id) +bool is_design_action_id([[maybe_unused]] const std::string& id) { #ifdef SLIC3R_CAD for (const DesignTool& t : kDesignTools) @@ -88,7 +88,7 @@ void prune_favourites(const std::vector& favs, const std::function< stored.push_back(id); if (shown.size() < ActionRegistry::kFavLimit) shown.push_back(id); - } else if (is_design_tile_id(id)) { + } else if (is_design_action_id(id)) { stored.push_back(id); } } @@ -339,7 +339,7 @@ constexpr const char* kPlateGotoPrefix = "orca_plate_goto"; constexpr const char* kRecentProjectPrefix = "orca_recent_project"; // Display context for a setting action's eyebrow, e.g. the "Process" in "Process : Quality : Layers". -// Keyed by the option's preset type so the palette reads like the settings sidebar tabs. Untranslated: +// Keyed by the option's preset type so the Speed Dial reads like the settings sidebar tabs. Untranslated: // the caller translates it for the displayed breadcrumb and keeps it for the English one. const char* setting_type_context(Preset::Type type) { @@ -608,12 +608,12 @@ void ActionRegistry::init() upsert(std::move(action)); } - // Built-in palette tiles (Save/Load, Preferences, Mode switch, Slice/Preview, Go to layer): the catalog's - // commands' own tiles and the items of their tiles, and no others. Register after plugins so the plugin ids win - // on any (unlikely) id collision - ids are distinct by prefix, so this is order-independent. The catalog (and + // Built-in Speed Dial actions (Save/Load, Preferences, Mode switch, Slice/Preview, Go to layer): the catalog's + // commands' own actions and the items of their actions, and no others. Register after plugins so the plugin ids + // win on any (unlikely) id collision - ids are distinct by prefix, so this is order-independent. The catalog (and // its thin AppAction adapter) lives in NativeCommands; the registry only stores and dispatches the result. - for (const NativeCommands::PaletteTile& t : NativeCommands::palette_tiles(NativeCommands::instance())) - upsert(t.tile != nullptr ? NativeCommands::make_action(*t.command, *t.tile) : NativeCommands::make_action(*t.command)); + for (const NativeCommands::SpeedDialAction& t : NativeCommands::speed_dial_actions(NativeCommands::instance())) + upsert(t.action != nullptr ? NativeCommands::make_action(*t.command, *t.action) : NativeCommands::make_action(*t.command)); } void ActionRegistry::relocalize_builtins() @@ -633,8 +633,8 @@ void ActionRegistry::relocalize_builtins() for (const std::string& id : stale) remove(id); - for (const NativeCommands::PaletteTile& t : NativeCommands::palette_tiles(NativeCommands::instance())) - upsert(t.tile != nullptr ? NativeCommands::make_action(*t.command, *t.tile) : NativeCommands::make_action(*t.command)); + for (const NativeCommands::SpeedDialAction& t : NativeCommands::speed_dial_actions(NativeCommands::instance())) + upsert(t.action != nullptr ? NativeCommands::make_action(*t.command, *t.action) : NativeCommands::make_action(*t.command)); } void ActionRegistry::refresh_source(const std::string& plugin_key, ActionChange change) @@ -979,7 +979,7 @@ void ActionRegistry::materialize_recent_project_actions() std::vector favs; load_persisted(stats, favs); - // app_config stores recents oldest-first; the palette shows newest-first. + // app_config stores recents oldest-first; the Speed Dial shows newest-first. std::vector recents = wxGetApp().app_config->get_recent_projects(); std::reverse(recents.begin(), recents.end()); @@ -1014,10 +1014,10 @@ void ActionRegistry::materialize_design_actions() { assert(wxThread::IsMain()); #ifdef SLIC3R_CAD - // The tiles act on the Design tab a person is looking at, so they are there only while it is shown, and + // The Design tab's actions work on the tab a person is looking at, so they are there only while it is shown, and // only those of the mode it is in, the tools its right-click menu offers there; none while the CAD feature - // is off, though the tab stays until a restart (Mcp::design_tiles()). The catalog holds the Design commands - // only when the CAD feature was on at startup. A folded item's tile runs its command with the item's arguments. + // is off, though the tab stays until a restart (Mcp::design_actions()). The catalog holds the Design commands + // only when the CAD feature was on at startup. A folded item's action runs its command with the item's arguments. const MainFrame* frame = wxTheApp ? wxGetApp().mainframe : nullptr; const DesignPanel* panel = frame != nullptr ? frame->shown_design_panel() : nullptr; std::unordered_set seen; @@ -1025,18 +1025,19 @@ void ActionRegistry::materialize_design_actions() nlohmann::json stats; std::vector favs; load_persisted(stats, favs); - for (const Mcp::DesignTile& tile : - Mcp::design_tiles(NativeCommands::instance(), panel->mcp_sketch_map_applies(), wxGetApp().is_enable_cad_feature())) { - std::unique_ptr action = tile.tile != nullptr ? NativeCommands::make_action(*tile.command, *tile.tile) : - NativeCommands::make_action(*tile.command); + for (const Mcp::DesignAction& design_action : + Mcp::design_actions(NativeCommands::instance(), panel->mcp_sketch_map_applies(), wxGetApp().is_enable_cad_feature())) { + std::unique_ptr action = design_action.action != nullptr ? + NativeCommands::make_action(*design_action.command, *design_action.action) : + NativeCommands::make_action(*design_action.command); const std::string id = action->id(); seed_from(stats, favs, id, *action); seen.insert(id); m_actions.insert_or_assign(id, std::shared_ptr(std::move(action))); } } - // Drop the tiles of a tab no longer shown, of the other mode, or of a CAD feature turned off. Their ids are - // command ids like any other tile's, so they are told apart by their group. + // Drop the actions of a tab no longer shown, of the other mode, or of a CAD feature turned off. Their ids are + // command ids like those of the other commands' actions, so they are told apart by their group. for (auto it = m_actions.begin(); it != m_actions.end();) { const AppAction& a = *it->second; if (a.kind == AppActionKind::Command && a.group_en == kDesignGroup && seen.count(it->first) == 0) @@ -1090,7 +1091,7 @@ nlohmann::json ActionRegistry::snapshot() assert(wxThread::IsMain()); // Settings and plates are first-class actions; make sure the current visible option set and the // live plate list are materialised before we serialise the pool (tabs_list is built by the time - // the palette opens). + // the Speed Dial opens). materialize_setting_actions(); materialize_live(); @@ -1120,7 +1121,7 @@ nlohmann::json ActionRegistry::snapshot() // as stored, not be re-derived from the frecency-sorted actions (that would // reorder the favourites bar). Drop pins with no live action (an option hidden by the // current mode, an unloaded plugin, a gone plate/project) and persist the pruned list. Order is - // preserved. A Design tile's pin is kept but not shown while its tile is not live (another tab, + // preserved. A Design tab action's pin is kept but not shown while the action is not live (another tab, // the other mode): the person pinned it to use in the Design tab. The bar is the first // kFavLimit live pins, so a pin it does not show never fills it. const std::vector favs = favourite_ids(); diff --git a/src/slic3r/GUI/ActionRegistry.hpp b/src/slic3r/GUI/ActionRegistry.hpp index ce1c9d78bd..e7976a4742 100644 --- a/src/slic3r/GUI/ActionRegistry.hpp +++ b/src/slic3r/GUI/ActionRegistry.hpp @@ -38,12 +38,12 @@ struct AppActionRunResult Level level = Level::Info; wxString message; // empty = "nothing worth showing" - // False when the command did nothing (no selection, no objects): the palette shows the message + // False when the command did nothing (no selection, no objects): the Speed Dial shows the message // at its level all the same, and automation reports the run as failed. bool done = true; // For automation only: a JSON object saying what the command did that its message does not // (the new object order, the object an Assemble made). An automated call's reply has its fields - // (NativeCommands::from_run_result()); the palette never shows it. + // (NativeCommands::from_run_result()); the Speed Dial never shows it. std::string reply; // The operation's refusal that `message` words in the UI's language, when the command ran an // operation that refused: automation replies with its English text and its code. @@ -90,13 +90,13 @@ struct AppAction // source name); Command sets a section label (e.g. "Commands", "Mode"). AppActionKind kind = AppActionKind::Plugin; std::string group; - // Second-phase input descriptor for the palette: "percent" (jump to layer by a 0-100 + // Second-phase input descriptor for the Speed Dial: "percent" (jump to layer by a 0-100 // value) or "tab" (pick a notebook tab). Empty = run immediately on activation. std::string input; // Tile pictogram: SVG base name under resources/images; empty renders a blank tile (commands // without a GUI icon, plugins). Set from NativeCommands / the setting's category icon. std::string icon; - // Settings mode required to edit this action (SettingActions only). The palette prompts before + // Settings mode required to edit this action (SettingActions only). The Speed Dial prompts before // running an action whose mode is above the user's current mode. comSimple for everything else. ConfigOptionMode required_mode = comSimple; // Description shown in the Speed Dial's footer strip (SettingActions: the localized tooltip). @@ -116,17 +116,17 @@ struct AppAction std::string help_url; // For automation (MCP, scripts): what the action does in English, the arguments it takes (a JSON // Schema; none for most actions) and whether its effect finishes after run() returns (an export that - // runs in the background). Not shown in the palette. + // runs in the background). Not shown in the Speed Dial. std::string automation_description; nlohmann::json input_schema; bool completes_in_background = false; - // The catalog key of a command's tile (NativeCommands), whose own function action_run runs; empty for - // every other action. + // For a command's action (NativeCommands), the catalog key of that command, whose own function action_run runs; + // empty for every other action. std::string command; - // The arguments a tile of `command` runs it with, an object that may be empty: an item of its tiles' args, to which a - // tile that collects a value (input) adds that value (tile_call_args(), CommandCatalog.hpp), or {} for the command's - // own tile outside the Design tab. Null for every other action, a Design command's own tile among them, which runs - // with the arguments it is given. + // The arguments an action of `command` runs it with, an object that may be empty: an item of its actions' args, to + // which an action that collects a value (input) adds that value (action_call_args(), CommandCatalog.hpp), or {} for + // the command's own action outside the Design tab. Null for every other action, a Design command's own action among + // them, which runs with the arguments it is given. nlohmann::json preset; virtual ~AppAction() = default; @@ -170,14 +170,14 @@ inline bool requires_mode_switch(ConfigOptionMode setting_mode, ConfigOptionMode // hand-edited config must never grow the stored list past `limit`, and a duplicated id must collapse to its first pin. std::vector cap_favourites(const std::vector& ids, size_t limit); -// Whether `id` is the id of a Design tab tile, that of an entry of the Design table with an action: a Design -// command's own tile, or a folded item's, which runs the command it is folded into. Such a tile is live only while -// that tab is shown, in its entry's mode. The Design table tells it apart, so it does even when the catalog holds -// no Design command (the CAD feature off at startup). A build without CAD has no table, and there it is never one. -bool is_design_tile_id(const std::string& id); +// Whether `id` is the id of a Design tab action, that of an entry of the Design table with a handler: a Design +// command's own action, or a folded item's, which runs the command it is folded into. Such an action is live only +// while that tab is shown, in its entry's mode. The Design table tells it apart, so it does even when the catalog +// holds no Design command (the CAD feature off at startup). A build without CAD has no table, and there it is never one. +bool is_design_action_id(const std::string& id); // The pins snapshot() keeps, in their order: `stored` gets those with a live action (`live`) and the Design -// tab's whose tile is not live now (is_design_tile_id()), which the person pinned in that tab and keeps when +// tab's whose action is not live now (is_design_action_id()), which the person pinned in that tab and keeps when // the Speed Dial opens elsewhere; `shown`, the bar, gets the first ActionRegistry::kFavLimit live ones. A live // pin past them stays stored and comes onto the bar once a pin before it is unpinned. Any other pin with no live // action is dropped. @@ -207,7 +207,7 @@ nlohmann::json action_json(const AppAction& a); // 2. Loader load/unload callbacks route through refresh_source()/refresh_capability(), // which upsert()/remove() actions. The registry keeps the only action list and // restores persisted user state as actions arrive. -// 3. Dynamic built-in families (settings, plates, recent projects, the Design tab's tiles) are +// 3. Dynamic built-in families (settings, plates, recent projects, the Design tab's actions) are // re-materialised at the top of snapshot(), because their membership follows live state (the current // configs, plate list, recents, the tab shown and its mode); all but settings also at the top of // describe() and of find_live(), an automated lookup by id. @@ -241,7 +241,7 @@ public: // Always-clean read surface. UI thread only. const AppAction* by_id(const std::string& id) const; // The action `id` as the app is now: by_id() after the families whose membership follows live state - // (plates, recent projects, the Design tab's tiles) are re-materialised, for a caller that may have + // (plates, recent projects, the Design tab's actions) are re-materialised, for a caller that may have // changed that state since the last snapshot() or describe(), such as an automated action_run after a // sketch was opened or the tab switched. Settings are not, being thousands: snapshot() and describe() // with include_settings materialise them. UI thread only. @@ -256,7 +256,7 @@ public: static constexpr size_t kFavStoredLimit = 100; // Dispatch + write-through (registry is the only thing that touches AppConfig). Automation passes - // record_stats = false so agent runs don't reorder the user's palette. + // record_stats = false so agent runs don't reorder the user's Speed Dial. AppActionRunResult run(const std::string& id, const nlohmann::json& args = nlohmann::json::object(), bool record_stats = true); // The catalog for agents: actions whose id, title, group, source or description contains `text` @@ -314,28 +314,28 @@ private: // (Re)materialise the current visible config settings as SettingActions from the live // searcher (respecting printer-tech + user-mode + visibility filtering), removing stale ones. - // Called at the top of snapshot(), so the palette always reflects the current configs, and by + // Called at the top of snapshot(), so the Speed Dial always reflects the current configs, and by // describe() when it is asked for settings. void materialize_setting_actions(); - // (Re)materialise one "Go to Plate N" action per live plate, so the palette lists every plate + // (Re)materialise one "Go to Plate N" action per live plate, so the Speed Dial lists every plate // directly on each spawn (no second-phase picker). FFF-editor only; SLA/gcode modes have no // plate UI, so nothing is materialised and stale ids are dropped. Run by materialize_live(). void materialize_plate_actions(); // (Re)materialise one "Open recent project " action per recent project file, so the - // palette lists every recent project and can load it by clicking. Keyed by file path (stable); + // Speed Dial lists every recent project and can load it by clicking. Keyed by file path (stable); // files that no longer exist are skipped and their stale ids dropped. Run by materialize_live(). void materialize_recent_project_actions(); - // (Re)materialise the Design tab's tiles: while the tab is shown with the CAD feature on, one per entry of the - // Design table with an action offered in the tab's mode (Mcp::design_tiles()), a Design command's own or a + // (Re)materialise the Design tab's actions: while the tab is shown with the CAD feature on, one per entry of the + // Design table with a handler offered in the tab's mode (Mcp::design_actions()), a Design command's own or a // folded item's, titled as the right-click menu names the entry (the "Design" context) with the entry's icon; // otherwise none. A build without CAD has none. void materialize_design_actions(); // The three families above whose membership follows live state and is cheap to rebuild: plates, recent - // projects and the Design tab's tiles. snapshot(), describe() and find_live() run it first. + // projects and the Design tab's actions. snapshot(), describe() and find_live() run it first. void materialize_live(); // Loader callbacks (marshalled to the UI thread) land here. refresh_source rebuilds diff --git a/src/slic3r/GUI/ActionReplayDialog.cpp b/src/slic3r/GUI/ActionReplayDialog.cpp index 3ae29a6ba2..debd99c793 100644 --- a/src/slic3r/GUI/ActionReplayDialog.cpp +++ b/src/slic3r/GUI/ActionReplayDialog.cpp @@ -125,18 +125,18 @@ std::pair replay_what_text(const json& what, const Com if (kind == "command") { const std::string key = what.value("key", ""); const auto* command = catalog.find(key); - // Titled as its tile is, so a Design command's step reads as the Design tab names its tool; a call that is - // a folded row's tile, as that row, with the value a tile that collects one was given. + // Titled as its action is, so a Design command's step reads as the Design tab names its tool; a call that is + // a folded item's action, as that item, with the value an action that collects one was given. const std::string args = what.contains("args") ? join(what["args"]) : std::string(); - if (what.contains("tile")) { - const auto [owner, tile] = find_tile(catalog, what.value("tile", "")); - if (tile != nullptr && owner == command) { - const std::string title = tile->at("title").get(); + if (what.contains("action")) { + const auto [owner, action] = find_command_action(catalog, what.value("action", "")); + if (action != nullptr && owner == command) { + const std::string title = action->at("title").get(); const char* context = title_context(*owner); return {into_u8(context != nullptr ? I18N::translate(title, context) : I18N::translate(title)), args}; } } - return {command != nullptr ? into_u8(NativeCommands::tile_title(*command)) : key, args}; + return {command != nullptr ? into_u8(NativeCommands::action_title(*command)) : key, args}; } if (kind == "recent_project" || kind == "preset") return {what.value("name", ""), {}}; @@ -637,7 +637,7 @@ json ActionReplayDialog::describe(const Mcp::Replay& replay) const flags.push_back(Mcp::flag_id(f)); json view{{"index", i + 1}, {"tool", step.tool}, - {"title", def != nullptr ? into_u8(NativeCommands::tile_title(*def)) : step.tool}, + {"title", def != nullptr ? into_u8(NativeCommands::action_title(*def)) : step.tool}, {"flags", std::move(flags)}, {"checks_result", d.checks_result}, {"optional", step.optional}, diff --git a/src/slic3r/GUI/ActionReplayDialog.hpp b/src/slic3r/GUI/ActionReplayDialog.hpp index 6c5be5b1bd..cb05d413ad 100644 --- a/src/slic3r/GUI/ActionReplayDialog.hpp +++ b/src/slic3r/GUI/ActionReplayDialog.hpp @@ -33,9 +33,9 @@ struct Replay; struct ReplayContext; } // namespace Mcp -// A replay step's main line in the Action Replay window and, for a command given arguments or a tile given the value +// A replay step's main line in the Action Replay window and, for a command given arguments or an action given the value // it collects, its second line, from describe_step()'s `what`, in the UI's language. A command, found in `catalog`, is -// titled as its own tile is, and a call that is one of its tiles (`what`'s `tile`) as that tile. +// titled as its own action is, and a call that is one of its actions (`what`'s `action`) as that action. std::pair replay_what_text(const nlohmann::json& what, const CommandCatalog& catalog); // The Action Replay window: a person opens or writes a replay file (the JSON list of tool calls an diff --git a/src/slic3r/GUI/CAD/DesignOffer.hpp b/src/slic3r/GUI/CAD/DesignOffer.hpp index 3b527a53f0..a3da664feb 100644 --- a/src/slic3r/GUI/CAD/DesignOffer.hpp +++ b/src/slic3r/GUI/CAD/DesignOffer.hpp @@ -5,13 +5,13 @@ // has ONE row index, that index is the same in every selection it appears in, and verbs that do // not apply are shown disabled in place with their reason rather than removed. Row order was // ratified 2026-07-31; changing an index is a breaking change to every user's muscle memory. -// An entry with an action or a tool block, and no fold_into, is a command of the catalog's group Design +// An entry with a handler or a tool block, and no fold_into, is a command of the catalog's group Design // (Mcp::register_cad_commands(), Mcp::is_design_command()), under its section in tool_search's index. A // call whose arguments are exactly those that choose one of its items opens that item's tool for a person -// (Mcp::opened_item()): none choose the entry's own item where it has an action, else the items folded into it +// (Mcp::opened_item()): none choose the entry's own item where it has a handler, else the items folded into it // with {}; a folded item's args, or the entry's own, choose that item. Any other call runs its tool block's // silent form. A folded item (fold_into) is no command: it is a way of calling the command it names. An item -// with neither an action nor a tool block is greyed, and no command. An entry with no menu item is a command only. +// with neither a handler nor a tool block is greyed, and no command. An entry with no menu item is a command only. #ifndef slic3r_GUI_DesignOffer_hpp_ #define slic3r_GUI_DesignOffer_hpp_ @@ -88,7 +88,7 @@ static const char* const kDesignSelectionIds[] = { // of a tool, which only a rebuild refuses, as the Design tab's keys and menu do. enum class CadAccess { None, Read, Change, Sketch, Ui }; -// One entry of the table. `action` routes to the code that already implements the verb: +// One entry of the table. Its handler (`action`) routes to the code that already implements the verb: // "key:S+E" -> m_keys_feature[SHIFT('E')] // "key:L" -> m_keys_sketch['L'] // "fly:material#4" -> row 4 of the "material" feature flyout @@ -114,7 +114,7 @@ struct DesignTool { const char* family; const char* icon; // resources/images name, or nullptr — the offer draws it beside the item const char* hint; // what the verb does / what to click; shown on hover - bool modal; // its action opens a dialog that waits for an answer: a modal one, which holds + bool modal; // its handler opens a dialog that waits for an answer: a modal one, which holds // the call until it is answered, or Text's, which is modeless and does not CadAccess access; // its silent form's, None without one bool ok_false; // its silent form reports a rejected rebuild in its reply (ok false) @@ -124,12 +124,12 @@ struct DesignTool { const char* doc; const char* fold_into; // the id of the command this item is a variant of, or nullptr // The arguments that choose this item, as JSON text: a folded item's, or those that choose the own item of - // an entry with an action and a tool block as a call with none does; nullptr for none. + // an entry with a handler and a tool block as a call with none does; nullptr for none. const char* args; // The heading its command is listed under in tool_search's index (kDesignSections, // Mcp::design_command_index()); nullptr for an entry that is no command. const char* section; - // Its action acts on the selected row of the Feature list, which a call of its command, not a person's + // Its handler acts on the selected row of the Feature list, which a call of its command, not a person's // pick, takes as what the item is for while nothing is picked in the view (Mcp::open_refusal()). bool feature_row; }; diff --git a/src/slic3r/GUI/CAD/DesignPanel.cpp b/src/slic3r/GUI/CAD/DesignPanel.cpp index 4c8e629a61..1a09ef64ae 100644 --- a/src/slic3r/GUI/CAD/DesignPanel.cpp +++ b/src/slic3r/GUI/CAD/DesignPanel.cpp @@ -1212,10 +1212,9 @@ DesignPanel::DesignPanel(wxWindow* parent) // --- Sketch group: plane + entity tools + Construction + Finish m_tb_sketch = new wxBoxSizer(wxHORIZONTAL); - // Sketch carries the most tools of any mode: pack it tight (no inter-icon gap) so the - // whole entity palette fits without crowding the right-hand actions. - // Same for the sketch bar: the drawing tools live in the offer. Only Delete selected stays, - // via sadd_bar. sadd() still runs so sk_key/fly: registrations and the flyout popups survive. + // The drawing tools live in the offer, so the SKETCH group's bar holds only Delete selected (sadd_bar). + // The other tool buttons are still made and sadd() hides them, so their sk_key/fly: registrations and + // the flyout popups survive. auto sadd = [](wxWindow* w) { w->Hide(); }; auto sadd_bar = [this](wxWindow* w) { m_tb_sketch->Add(w, 0, wxALIGN_CENTER_VERTICAL); }; m_tb_sketch->Add(caption(_L("SKETCH")), 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 8); @@ -1390,7 +1389,7 @@ DesignPanel::DesignPanel(wxWindow* parent) _L("Click a line or arc to extend it to the nearest entity; Esc exits")); // Constrain — grouped with the edit tools so it's easy to find (nde #13: it was buried // far-right next to Construction and went unnoticed). Commits the live sketch in place - // and drops into Constrain mode (geometric/dimensional palette). + // and drops into Constrain mode (the CONSTRAIN group's geometric and dimensional constraints). auto* b_constrain_sk = icon_btn("design_constrain", _L("Constrain — add geometric/dimensional relations")); b_constrain_sk->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { enter_constrain_inline(); }); @@ -6255,7 +6254,7 @@ void DesignPanel::on_check_interference() void DesignPanel::on_mass_properties() { // This bounds check is not defensive padding — it is what makes the verb safe to fire from - // its Design command or Speed Dial tile, which have no offer menu to grey the item out. + // its Design command or Speed Dial action, which have no offer menu to grey the item out. if (m_sel_solid_body < 0 || m_sel_solid_body >= int(m_doc.bodies.size())) { set_status(StatusKind::Info, _L("Select a body to measure it")); return; @@ -6619,8 +6618,8 @@ void DesignPanel::run_offer_action(const char* action) } // Look a verb up by its id and dispatch it, as a Design command with no arguments does (a Speed -// Dial tile, or an agent's call). Unknown ids and entries whose action string is null (no GUI -// route) return false without touching anything. +// Dial action, or an agent's call). Unknown ids and entries whose handler is null (no GUI route) +// return false without touching anything. bool DesignPanel::mcp_run_verb(const char* verb_id) { if (!verb_id) return false; @@ -7164,7 +7163,7 @@ void DesignPanel::show_offer_menu(const wxPoint& screen_pos) } } - // --- Mate palette section (lukg part B) --- + // --- The offer's Mate section (lukg part B) --- // Fed by CadDocument::mate_options() so the offer can never disagree with the kernel about // which assembly mates a connector pair admits. Shown only when the document holds at least // two ENABLED CoordSys features: below that the whole section would be one permanently dead @@ -7229,7 +7228,7 @@ void DesignPanel::show_offer_menu(const wxPoint& screen_pos) // Hovering an item shows the RESULT, not a description of it (epic gap G3). preview() moves // the body on a throwaway copy of the document, so nothing is written until the click — - // the "commit nothing until you choose" behaviour the palette was asked for. + // the "commit nothing until you choose" behaviour the Mate section was asked for. auto drop_ghost = [this, &mate_ghost]() { if (!mate_ghost) return; m_viewport->clear_preview(); @@ -7240,7 +7239,7 @@ void DesignPanel::show_offer_menu(const wxPoint& screen_pos) menu.Bind(wxEVT_MENU_HIGHLIGHT, [this, cs_a, cs_b, opts, &mate_ghost, drop_ghost](wxMenuEvent& e) { const int i = e.GetMenuId() - (mate_base + 1); - // Off the palette (a verb item, the header, or nothing) — a stale ghost from the item + // Off the Mate items (a verb item, the header, or nothing) — a stale ghost from the item // you just left is worse than none, so it goes as soon as the cursor does. if (i < 0 || i >= int(opts.size()) || !opts[i].viable) { drop_ghost(); return; } std::string err; @@ -8721,7 +8720,7 @@ void DesignPanel::rename_feature(int f, const std::string& name) // Commit the live sketch in place, then enter Constrain mode on the just-committed sketch. // One-click bridge from the SKETCH toolbar: removes the "Finish -> find in tree -> select -> -// Constrain" friction, so the constraint palette + Trim/Extend are reachable mid-sketch. +// Constrain" friction, so the CONSTRAIN group's tools and Trim/Extend are reachable mid-sketch. bool DesignPanel::enter_constrain_inline() { // Synchronous: packages the live entities and constraints into a Sketch feature. diff --git a/src/slic3r/GUI/CAD/DesignPanel.hpp b/src/slic3r/GUI/CAD/DesignPanel.hpp index b7f4d1c801..d41296818f 100644 --- a/src/slic3r/GUI/CAD/DesignPanel.hpp +++ b/src/slic3r/GUI/CAD/DesignPanel.hpp @@ -185,12 +185,12 @@ public: // line), which is what a profile is drawn around, or -1 for the plane axis. static int default_revolve_axis_entity(const std::vector& ents); // The offer table's verbs without a right-click: a Design command with no arguments, a Speed Dial - // tile or an agent's call, fires one by id, so every verb is reachable — including the items with + // action or an agent's call, fires one by id, so every verb is reachable — including the items with // no keyboard shortcut, which are otherwise invisible to anything that parses key tables. int mcp_offer_selection_kind() const { return offer_selection_kind(); } // OfferSel as int // Whether the right-click menu offers the sketch's verbs now, not the model's (sketch_map_applies()). bool mcp_sketch_map_applies() const { return sketch_map_applies(); } - void mcp_run_action(const char* action) { run_offer_action(action); } // dispatch an action string + void mcp_run_action(const char* action) { run_offer_action(action); } // dispatch an entry's handler (`action`) // Defined out of line in DesignPanel.cpp: it needs kDesignTools, which this header deliberately // does not include (the table is generated and belongs to the offer-menu code). bool mcp_run_verb(const char* verb_id); @@ -468,8 +468,8 @@ private: // constraint to the in-canvas picked segment and re-solve in the kernel. void on_begin_constrain(int sel_override = -1); // Sketch-toolbar Constrain entry: commit the live sketch in place, then enter Constrain - // mode on it (so the constraint palette + Trim/Extend are reachable without leaving the - // sketch flow). Returns true if constrain mode was entered. + // mode on it (so the CONSTRAIN group's tools and Trim/Extend are reachable without leaving + // the sketch flow). Returns true if constrain mode was entered. bool enter_constrain_inline(); void apply_constraint(SketchConstraintType type); void apply_entity_constraint(SketchConstraintType type); // Fase 4.2 entity path @@ -564,7 +564,7 @@ private: // body has been moved. TriangleMesh ghost_from_bodies(const std::vector& per_body) const; // A mate makes no new geometry but it MOVES a body, and the moved assembly is the ghost worth - // showing. Used both by the Mate card and by hovering an item of the offer's mate palette. + // showing. Used both by the Mate card and by hovering an item of the offer's Mate section. bool show_mate_ghost(int kind, int cs_a, int cs_b, double offset, double angle_deg, bool flip, std::string& err); int resolve_extrude_sketch() const; diff --git a/src/slic3r/GUI/CommandCatalog.cpp b/src/slic3r/GUI/CommandCatalog.cpp index 134bf07d8c..4522d139b8 100644 --- a/src/slic3r/GUI/CommandCatalog.cpp +++ b/src/slic3r/GUI/CommandCatalog.cpp @@ -125,26 +125,26 @@ const char* completion_name(CommandCompletion completion) } // namespace -const nlohmann::json* tile_with_args(const NativeCommand& command, const nlohmann::json& args) +const nlohmann::json* action_with_args(const NativeCommand& command, const nlohmann::json& args) { - if (!command.tiles.is_array()) + if (!command.actions.is_array()) return nullptr; // A call with no arguments gives none, null as {}, as Mcp::opened_item() reads it. const nlohmann::json given = Mcp::person_form(args) ? nlohmann::json::object() : args; - // A tile that collects a value is called with that value besides its own arguments, never with these alone. - for (const nlohmann::json& tile : command.tiles) - if (tile.value("input", std::string()).empty() && tile.at("args") == given) - return &tile; + // An action that collects a value is called with that value besides its own arguments, never with these alone. + for (const nlohmann::json& action : command.actions) + if (action.value("input", std::string()).empty() && action.at("args") == given) + return &action; return nullptr; } -nlohmann::json tile_call_args(const nlohmann::json* tile, const nlohmann::json& args) +nlohmann::json action_call_args(const nlohmann::json* action, const nlohmann::json& args) { - if (tile == nullptr) + if (action == nullptr) return args; - nlohmann::json out = tile->at("args"); - const std::string input = tile->value("input", std::string()); - // Without the value the tile's args alone are given: action_run refuses such a call first (action_args_error()), + nlohmann::json out = action->at("args"); + const std::string input = action->value("input", std::string()); + // Without the value the action's args alone are given: action_run refuses such a call first (action_args_error()), // and the Speed Dial's second phase always collects the value. if (input.empty() || !args.is_object() || !args.contains(input)) return out; @@ -154,25 +154,25 @@ nlohmann::json tile_call_args(const nlohmann::json* tile, const nlohmann::json& for (const TabWord& w : kTabWords) if (value == w.page) value = w.word; - out[tile->value("input_arg", input)] = std::move(value); + out[action->value("input_arg", input)] = std::move(value); return out; } std::string call_title(const NativeCommand& command, const nlohmann::json& args) { - const nlohmann::json* tile = tile_with_args(command, args); - return tile != nullptr ? tile->at("title").get() : command.title; + const nlohmann::json* action = action_with_args(command, args); + return action != nullptr ? action->at("title").get() : command.title; } -std::pair find_tile(const CommandCatalog& catalog, const std::string& key) +std::pair find_command_action(const CommandCatalog& catalog, const std::string& key) { - if (const NativeCommand* command = catalog.find(key); command != nullptr && command->in_palette) + if (const NativeCommand* command = catalog.find(key); command != nullptr && command->has_own_action) return {command, nullptr}; for (const NativeCommand& command : catalog.commands()) - if (command.tiles.is_array()) - for (const nlohmann::json& tile : command.tiles) - if (tile.at("key") == key) - return {&command, &tile}; + if (command.actions.is_array()) + for (const nlohmann::json& action : command.actions) + if (action.at("key") == key) + return {&command, &action}; return {nullptr, nullptr}; } @@ -180,9 +180,9 @@ std::pair shown_title(const CommandCatalog& c const nlohmann::json& args) { if (command.key == "action_run" && args.is_object() && args.value("id", nlohmann::json()).is_string()) { - const auto [owner, tile] = find_tile(catalog, command_tile_key(args.at("id").get())); + const auto [owner, action] = find_command_action(catalog, command_action_key(args.at("id").get())); if (owner != nullptr) - return {tile != nullptr ? tile->at("title").get() : owner->title, owner}; + return {action != nullptr ? action->at("title").get() : owner->title, owner}; } return {call_title(command, args), &command}; } @@ -195,7 +195,7 @@ nlohmann::json command_reference(const NativeCommand& command) {"description", command.description}, {"input_schema", command.input_schema}, {"listed", command.listed}, - {"in_palette", command.in_palette}, + {"has_own_action", command.has_own_action}, {"read_only", command.read_only}, {"destructive", command.destructive}, {"idempotent", command.idempotent}, @@ -205,13 +205,13 @@ nlohmann::json command_reference(const NativeCommand& command) {"operations", command.operations}}; for (const auto& [name, value] : {std::pair{"icon", &command.icon}, {"input", &command.input}, - {"tile_group", &command.tile_group}}) + {"action_group", &command.action_group}}) if (!value->empty()) entry[name] = *value; if (!command.examples.is_null()) entry["examples"] = command.examples; - if (!command.tiles.is_null()) - entry["tiles"] = command.tiles; + if (!command.actions.is_null()) + entry["actions"] = command.actions; return entry; } diff --git a/src/slic3r/GUI/CommandCatalog.hpp b/src/slic3r/GUI/CommandCatalog.hpp index aa4b56b113..c4b7b6224a 100644 --- a/src/slic3r/GUI/CommandCatalog.hpp +++ b/src/slic3r/GUI/CommandCatalog.hpp @@ -17,7 +17,7 @@ namespace Slic3r { namespace GUI { // The group of the Design tab's commands (Mcp::register_cad_commands()), an untranslated msgid as every -// group is. Their tiles are the Speed Dial's only while the Design tab is shown. +// group is. Their actions are the Speed Dial's only while the Design tab is shown. inline constexpr const char* kDesignGroup = "Design"; // When a command's effect finishes. Immediate: it has finished by the time the call returns. Deferred: it @@ -40,17 +40,17 @@ struct NativeCommand // What tool_search filters by. Outside the Design tab, the English heading of the command's place // (NativeCommands::place_heading()): Objects, Plates, The app, the place its name starts with but for the two // screenshot commands, which are under Recordings, replays and scripts; a plugin's operation is in Plugins. A - // Design command's is kDesignGroup, an untranslated msgid, which is also the Speed Dial section of its own tile and - // of its tiles. + // Design command's is kDesignGroup, an untranslated msgid, which is also the Speed Dial section of its own action + // and of its actions. std::string group; - // The Speed Dial section of the command's own tile (in_palette), an untranslated msgid; empty where that tile is in - // `group`, as a Design command's is. - std::string tile_group; - // "percent"/"tab": the palette's second phase, which collects the value the command needs before it + // The Speed Dial section of the command's own action (has_own_action), an untranslated msgid; empty where that + // action is in `group`, as a Design command's is. + std::string action_group; + // "percent"/"tab": the Speed Dial's second phase, which collects the value the command needs before it // runs; "" to run at once. std::string input; std::string icon; // tile pictogram: an SVG base name under resources/images, or "" for a blank tile - std::string description; // English, for agents; not shown in the palette + std::string description; // English, for agents; not shown in the Speed Dial CommandCompletion completion = CommandCompletion::Immediate; // The command's function. With no arguments it does what a person's pick does; with arguments that a // dialog would otherwise ask for, it runs without asking. @@ -58,16 +58,16 @@ struct NativeCommand nlohmann::json input_schema = {{"type", "object"}, {"properties", nlohmann::json::object()}}; // Calls that document the command: [{title, calls: [{tool, args}], needs?}], or null. nlohmann::json examples; - // The tiles of the menu items folded into the command, [{key, title, group?, icon, description, args, input?, - // input_arg?}] (NativeCommands::tile()), or null: each, under the id of its key, runs the command with `args` + // The actions of the menu items folded into the command, [{key, title, group?, icon, description, args, input?, + // input_arg?}] (NativeCommands::action()), or null: each, under the id of its key, runs the command with `args` // (NativeCommands::make_action()). Its title is an untranslated msgid in title_context(), as the command's is. - // group is its Speed Dial section, an untranslated msgid; a Design tile has none and is in the command's group. - // input is the Speed Dial's token for the value its second phase collects ("percent", "tab"), which the tile - // passes on under input_arg, the command's argument, or under the token where it has no input_arg. - nlohmann::json tiles; + // group is its Speed Dial section, an untranslated msgid; a Design tab action has none and is in the command's + // group. input is the Speed Dial's token for the value its second phase collects ("percent", "tab"), which the + // action passes on under input_arg, the command's argument, or under the token where it has no input_arg. + nlohmann::json actions; // shown in tools/list: every command outside the Design tab that runs from its arguments, all but three menu items - bool listed = false; - bool in_palette = false; // a person can pick it: it has a tile of its own, under its key + bool listed = false; + bool has_own_action = false; // a person can pick it: it has an action of its own, under its key // The access labels sent as MCP's annotations. Clients act on them: Codex asks a person before every call // of a destructive command, and Claude Code runs read-only calls in parallel and retries idempotent ones. // read_only: it changes nothing in the app or the project; window_screenshot is, since its PNG replaces no file @@ -99,14 +99,14 @@ struct NativeCommand // The arguments that carry an expected object or part id, which the session journal leaves out. std::vector id_args; // The operations (GUI/Operations) the command reaches when it is given arguments, by function name. A - // palette command that takes arguments names them or is on the exception list of the catalog test. + // command in the Speed Dial that takes arguments names them or is on the exception list of the catalog test. std::vector operations; }; // The context a command's title is translated in, or nullptr for none: "Design" for a Design command, whose // title is its entry's name, which the Design table marks in that context for every entry (DesignOffer.hpp), with // a menu item or without, the context the Design tab's right-click menu translates an item's name in. Every place -// that shows a command's title translates it with this (NativeCommands::tile_title(), a recording's caption). +// that shows a command's title translates it with this (NativeCommands::action_title(), a recording's caption). inline const char* title_context(const NativeCommand& command) { return command.group == kDesignGroup ? "Design" : nullptr; @@ -125,26 +125,26 @@ inline constexpr TabWord kTabWords[] = {{"home", "home"}, {"design", "desi {"device", "monitor"}, {"multi_device", "multi_device"}, {"project", "project"}, {"calibration", "calibration"}}; -// The first of `command`'s tiles that collect no value (no input) whose args are `args`, compared as JSON values, a +// The first of `command`'s actions that collect no value (no input) whose args are `args`, compared as JSON values, a // null `args` as {}; nullptr when none is. -const nlohmann::json* tile_with_args(const NativeCommand& command, const nlohmann::json& args); +const nlohmann::json* action_with_args(const NativeCommand& command, const nlohmann::json& args); -// The arguments a pick of `tile`, an item of a command's tiles, runs its command with, given `args` (what -// action_run or the Speed Dial's second phase gives): the tile's args, and for a tile with an input the value `args` -// holds under that token, put under its input_arg, or under the token where it has none; a tab's page id that a word -// of kTabWords names is given as that word (the Device tab's monitor as device). For a command's own tile -// (`tile` null), `args` as they are, the call's own arguments. A person's pick, action_run and the description of a -// replay's step all run a tile with it. -nlohmann::json tile_call_args(const nlohmann::json* tile, const nlohmann::json& args); +// The arguments a pick of `action`, an item of a command's actions, runs its command with, given `args` (what +// action_run or the Speed Dial's second phase gives): the action's args, and for an action with an input the value +// `args` holds under that token, put under its input_arg, or under the token where it has none; a tab's page id that a +// word of kTabWords names is given as that word (the Device tab's monitor as device). For a command's own action +// (`action` null), `args` as they are, the call's own arguments. A person's pick, action_run and the description of a +// replay's step all run an action with it. +nlohmann::json action_call_args(const nlohmann::json* action, const nlohmann::json& args); // What a call of `command` with `args` is titled where a person is shown it (a recording's caption): the title of -// tile_with_args(), else the command's. Untranslated, in title_context(command). +// action_with_args(), else the command's. Untranslated, in title_context(command). std::string call_title(const NativeCommand& command, const nlohmann::json& args); -// What the reference says of a command: key, title, group, description, input_schema, listed, in_palette, the four +// What the reference says of a command: key, title, group, description, input_schema, listed, has_own_action, the four // access labels, guard ("inspect", "recover", "mutate"), completion ("immediate", "deferred") and operations; icon, -// input and tile_group when they are not empty, and examples and tiles when it has some. All of it is the command's -// English text and constants, never translated. +// input and action_group when they are not empty, and examples and actions when it has some. All of it is the +// command's English text and constants, never translated. nlohmann::json command_reference(const NativeCommand& command); // Commands that come and go while the app runs (plugin operations). Any thread. @@ -200,15 +200,15 @@ private: bool m_sealed = false; }; -// The command of `catalog` that has a tile under `key`, with that tile: the command `key` with nullptr when its -// own tile is (in_palette), else the command with the item of its `tiles` whose key is `key`; nullptrs when no +// The command of `catalog` that has an action under `key`, with that action: the command `key` with nullptr when its +// own action is (has_own_action), else the command with the item of its `actions` whose key is `key`; nullptrs when no // command added with add() has one. -std::pair find_tile(const CommandCatalog& catalog, const std::string& key); +std::pair find_command_action(const CommandCatalog& catalog, const std::string& key); // What a call of `command` with `args` is titled where a person is shown it (a recording's caption), and the command -// whose title_context() that title is translated in: for action_run of a command's tile in `catalog` (args.id, the -// tile's id or the key inside it), the tile's title and that command, the command's own title for its own tile; for any -// other call, call_title() and `command`. Untranslated. +// whose title_context() that title is translated in: for action_run of a command's action in `catalog` (args.id, the +// action's id or the key inside it), the action's title and that command, the command's own title for its own action; +// for any other call, call_title() and `command`. Untranslated. std::pair shown_title(const CommandCatalog& catalog, const NativeCommand& command, const nlohmann::json& args); diff --git a/src/slic3r/GUI/CommandTypes.hpp b/src/slic3r/GUI/CommandTypes.hpp index bd90b1c51d..03984003f4 100644 --- a/src/slic3r/GUI/CommandTypes.hpp +++ b/src/slic3r/GUI/CommandTypes.hpp @@ -12,7 +12,7 @@ #include // The types a command of the catalog (CommandCatalog.hpp) is called with and answers in, whichever front end -// calls it: a Speed Dial tile, an MCP tool or a plugin. No wx here: this header is part of the library +// calls it: a Speed Dial action, an MCP tool or a plugin. No wx here: this header is part of the library // libslic3r_automation, which is built without wx. namespace Slic3r { namespace GUI { diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 7c98d383de..cca1664999 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -5056,7 +5056,7 @@ void GUI_App::recreate_GUI(const wxString &msg_name) BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "recreate_GUI enter"; m_is_recreating_gui = true; - // The palette injects its translated strings once, at creation; drop the cached dialog so the + // The Speed Dial injects its translated strings once, at creation; drop the cached dialog so the // next open rebuilds it in the current locale (and can't outlive the old mainframe). if (m_speed_dial_dialog) { m_speed_dial_dialog->Destroy(); @@ -9369,7 +9369,7 @@ void GUI_App::open_preferences(PreferencesTab tab, const std::string& highlight_ return; } // Built-in Speed Dial command titles are copied from the catalog at init and don't follow a - // live locale switch; rebuild them in the new language before the GUI (and palette) rebuilds. + // live locale switch; rebuild them in the new language before the GUI and the Speed Dial rebuild. m_action_registry->relocalize_builtins(); } diff --git a/src/slic3r/GUI/Mcp/McpArguments.cpp b/src/slic3r/GUI/Mcp/McpArguments.cpp index 28615507c2..1c6db0e6ba 100644 --- a/src/slic3r/GUI/Mcp/McpArguments.cpp +++ b/src/slic3r/GUI/Mcp/McpArguments.cpp @@ -343,12 +343,12 @@ bool person_form(const json& args) { return args.is_null() || (args.is_object() std::vector person_forms(const NativeCommand& command) { std::vector forms; - if (command.in_palette) + if (command.has_own_action) forms.push_back(json::object()); - if (command.tiles.is_array()) - for (const json& tile : command.tiles) - if (tile.value("input", std::string()).empty()) - forms.push_back(tile.at("args")); + if (command.actions.is_array()) + for (const json& action : command.actions) + if (action.value("input", std::string()).empty()) + forms.push_back(action.at("args")); return forms; } @@ -383,8 +383,9 @@ json with_silent(json schema, const std::vector& person_args) "true runs the command without asking; it then needs " + needs + ", and what else the call leaves out takes its default."; text += only_none ? " A call with no arguments does what a person's pick does." : - has_none ? " A call with no arguments, or with exactly a tile's arguments, does what a person's pick of that tile does." : - " A call with exactly a tile's arguments does what a person's pick of that tile does."; + has_none ? " A call with no arguments, or with exactly a Speed Dial action's arguments, does what a person's pick of " + "that action does." : + " A call with exactly a Speed Dial action's arguments does what a person's pick of that action does."; schema["properties"]["silent"] = {{"type", "boolean"}, {"enum", {true}}, {"description", std::move(text)}}; if (!required.empty()) { schema["if"] = only_none ? json{{"minProperties", 1}} : json{{"not", {{"enum", person_args}}}}; diff --git a/src/slic3r/GUI/Mcp/McpArguments.hpp b/src/slic3r/GUI/Mcp/McpArguments.hpp index b323bca7ff..e68396b36e 100644 --- a/src/slic3r/GUI/Mcp/McpArguments.hpp +++ b/src/slic3r/GUI/Mcp/McpArguments.hpp @@ -27,17 +27,17 @@ std::string validate_arguments(const nlohmann::json& schema, const nlohmann::jso // Whether `args` is a call with no arguments: an object with no members, or null. A Design command and a menu // item's function do their person's form then (they ask, as a person's pick does). bool person_form(const nlohmann::json& args); -// The arguments of each of `command`'s person's forms: {} for its own tile (in_palette), and the args of each item -// of its tiles that collects no value (no input), in their order. +// The arguments of each of `command`'s person's forms: {} for its own action (has_own_action), and the args of each +// item of its actions that collects no value (no input), in their order. std::vector person_forms(const NativeCommand& command); // Whether `args`, null as {}, are a person's form of `command`: exactly the arguments of one of person_forms(). Such -// a call does what a person's pick of that tile does, and may ask; any other call is its silent form. +// a call does what a person's pick of that action does, and may ask; any other call is its silent form. bool person_form(const NativeCommand& command, const nlohmann::json& args); // `args` without `silent`, which only chooses the silent form. nlohmann::json silent_args(nlohmann::json args); // The schema of a two-form command from its silent form's `schema`: it gains the property `silent`, which // takes only true and asks for the silent form with its defaults, described by what that form still requires and by -// which calls are the person's forms (none, a tile's arguments, or both), and a top-level `required` list moves under +// which calls are the person's forms (none, an action's arguments, or both), and a top-level `required` list moves under // "then", with an "if" that holds for every call but the person's forms, `person_args` (never empty), so that a // person's form needs none of them: {"minProperties": 1} where the only one is the call with no arguments, else // {"not": {"enum": []}}. diff --git a/src/slic3r/GUI/Mcp/McpJournal.cpp b/src/slic3r/GUI/Mcp/McpJournal.cpp index e147a371f4..1f14ffcb2e 100644 --- a/src/slic3r/GUI/Mcp/McpJournal.cpp +++ b/src/slic3r/GUI/Mcp/McpJournal.cpp @@ -30,15 +30,15 @@ namespace { std::size_t serialized_size(const json& args) { return args.dump(-1, ' ', false, json::error_handler_t::replace).size(); } // The name a journaled call of `tool` with `args` runs under, and the arguments it runs with: the call's own, or, for -// action_run of a command's tile, by its full id or the key inside it, that key and the arguments inside the tile's -// {id, args}. A command's own tile is under its command's key, so a Design command's tile is rewritten as its command -// is; a tile of a menu item folded into a command is under a key of its own, and its call's arguments, none, the tile's own -// or the value it collects, hold no path to rewrite. +// action_run of a command's action, by its full id or the key inside it, that key and the arguments inside the action's +// {id, args}. A command's own action is under its command's key, so a Design command's action is rewritten as its +// command is; the action of a menu item folded into a command is under a key of its own, and its call's arguments, none, +// the action's own or the value it collects, hold no path to rewrite. std::pair called_command(const std::string& tool, json& args) { if (tool != "action_run" || !args.is_object() || !args.value("id", json()).is_string() || !args.value("args", json()).is_object()) return {tool, &args}; - const std::string key = command_tile_key(args["id"].get()); + const std::string key = command_action_key(args["id"].get()); if (key.empty()) return {tool, &args}; return {key, &args["args"]}; @@ -224,8 +224,8 @@ nlohmann::json Journal::to_replay(const std::string& name, nlohmann::json* left_ continue; // waits on a job the journal did not see start step["args"]["job"] = "${jobs." + it->second + "}"; } - // The name the step runs under and its arguments: action_run of a command's tile runs as the tile's key, with - // the arguments inside the tile's {id, args}, which the step keeps, so that its replay runs the tile again. + // The name the step runs under and its arguments: action_run of a command's action runs as the action's key, with + // the arguments inside the action's {id, args}, which the step keeps, so that its replay runs the action again. const auto [tool, called_args] = called_command(e.tool, step["args"]); nlohmann::json& args = *called_args; auto in_out_dir = [&](const char* key) { diff --git a/src/slic3r/GUI/Mcp/McpPersonContext.cpp b/src/slic3r/GUI/Mcp/McpPersonContext.cpp index 96b3982775..7acdabc4f8 100644 --- a/src/slic3r/GUI/Mcp/McpPersonContext.cpp +++ b/src/slic3r/GUI/Mcp/McpPersonContext.cpp @@ -26,7 +26,7 @@ namespace Slic3r { namespace GUI { namespace Mcp { namespace { // What a person is shown once a job they started ends: what the command says, its error, or that it finished. -// `title` is the command's, in the UI's language (NativeCommands::tile_title()). +// `title` is the command's, in the UI's language (NativeCommands::action_title()). AppActionRunResult ended_notice(const ToolResult& result, const std::string& title) { if (result.notice) @@ -76,7 +76,7 @@ ToolResult PersonContext::submit(const std::string& key, const nlohmann::json& a AutomationRuntime* const owner = &runtime(); const std::thread::id caller = std::this_thread::get_id(); auto refusal = std::make_shared>(); - const std::string title = into_u8(NativeCommands::tile_title(*command)); + const std::string title = into_u8(NativeCommands::action_title(*command)); const std::string job = owner->core().submit(*command, args, [owner, caller, refusal, title](const ToolResult& r) { // A refusal comes at once, on this thread: it is the reply. A job's result comes on the job's thread, // while the runtime still runs it, and is shown on the UI thread. diff --git a/src/slic3r/GUI/Mcp/McpPersonContext.hpp b/src/slic3r/GUI/Mcp/McpPersonContext.hpp index d05ec3bf0a..a0ff475eb3 100644 --- a/src/slic3r/GUI/Mcp/McpPersonContext.hpp +++ b/src/slic3r/GUI/Mcp/McpPersonContext.hpp @@ -10,8 +10,8 @@ #include #include -// The contexts a command runs with besides the MCP core's own: a person's pick, and a Speed Dial tile that -// action_run runs. No wx here, so that unit tests can include it (the slic3rutils tile case does). +// The contexts a command runs with besides the MCP core's own: a person's pick, and a Speed Dial action that +// action_run runs. No wx here, so that unit tests can include it (the slic3rutils ActionContext cases do). namespace Slic3r { namespace GUI { namespace Mcp { // A person's pick from the Speed Dial or a menu, on the UI thread and outside the automation runtime's dispatch @@ -41,18 +41,19 @@ public: void begin_operation() override {} }; -// What action_run runs a command's tile with: the context of action_run's own call, except that a command -// that rewrites its journal entry does so inside action_run's, as {"id": , "args": ...}, -// so that a replay runs the tile again through action_run. A tile of fixed arguments (an item of a command's tiles, a -// Design command's folded items among them, or a command's own tile outside the Design tab) records `tile_args` there in -// place of the command's rewrite: what action_run takes for it (tile_journal_args()). action_run refuses any other -// arguments for such a tile, and so would refuse the replay of a rewrite (object_arrange's adds the settings in -// force). A Design command's own tile, which takes its command's arguments, has none, and the command's rewrite stands. -class TileContext final : public ToolContext +// What action_run runs a command's action with: the context of action_run's own call, except that a command +// that rewrites its journal entry does so inside action_run's, as {"id": , "args": ...}, +// so that a replay runs the action again through action_run. An action of fixed arguments (an item of a command's +// actions, a Design command's folded items among them, or a command's own action outside the Design tab) records +// `action_args` there in place of the command's rewrite: what action_run takes for it (action_journal_args()). +// action_run refuses any other arguments for such an action, and so would refuse the replay of a rewrite +// (object_arrange's adds the settings in force). A Design command's own action, which takes its command's arguments, +// has none, and the command's rewrite stands. +class ActionContext final : public ToolContext { public: - TileContext(ToolContext& call, std::string action_id, nlohmann::json tile_args = nullptr) - : m_call(call), m_id(std::move(action_id)), m_tile_args(std::move(tile_args)) + ActionContext(ToolContext& call, std::string action_id, nlohmann::json action_args = nullptr) + : m_call(call), m_id(std::move(action_id)), m_action_args(std::move(action_args)) {} bool person() const override { return m_call.person(); } @@ -66,7 +67,7 @@ public: std::set lineage() const override { return m_call.lineage(); } void set_journal_args(nlohmann::json args) override { - m_call.set_journal_args({{"id", m_id}, {"args", m_tile_args.is_null() ? std::move(args) : m_tile_args}}); + m_call.set_journal_args({{"id", m_id}, {"args", m_action_args.is_null() ? std::move(args) : m_action_args}}); } void begin_operation() override { m_call.begin_operation(); } void works_in_dialog(std::uint64_t dialog) override { m_call.works_in_dialog(dialog); } @@ -75,7 +76,7 @@ public: private: ToolContext& m_call; std::string m_id; - nlohmann::json m_tile_args; + nlohmann::json m_action_args; }; }}} // namespace Slic3r::GUI::Mcp diff --git a/src/slic3r/GUI/Mcp/McpRecorder.cpp b/src/slic3r/GUI/Mcp/McpRecorder.cpp index 128ee47897..2e705c7389 100644 --- a/src/slic3r/GUI/Mcp/McpRecorder.cpp +++ b/src/slic3r/GUI/Mcp/McpRecorder.cpp @@ -901,7 +901,7 @@ void McpRecorder::call_started(uint64_t call, const NativeCommand& def, const js std::lock_guard lock(m_mutex); if (!m_rec || m_rec->ending || !m_rec->options.captions) return; - // A tile's call is captioned with the tile's title: action_run of it, or its command called with its arguments. + // An action's call is captioned with the action's title: action_run of it, or its command called with its arguments. const auto [title, titled] = shown_title(NativeCommands::instance(), def, args); const char* context = title_context(*titled); m_rec->board.call_started(call, title, safe_caption_detail(def.key, args), Clock::now(), context != nullptr ? context : ""); diff --git a/src/slic3r/GUI/Mcp/McpReplaySummary.cpp b/src/slic3r/GUI/Mcp/McpReplaySummary.cpp index 8c723a77d8..3588ee4cfa 100644 --- a/src/slic3r/GUI/Mcp/McpReplaySummary.cpp +++ b/src/slic3r/GUI/Mcp/McpReplaySummary.cpp @@ -149,23 +149,23 @@ json argument_texts(const json& args) return texts; } -// A call of command `key` with `args`, or of its tile `tile` (one of its tiles, which runs it with `args`): a call -// whose arguments are a tile's is that tile, `tile` or else the first with them (tile_with_args()). A tile that -// collects a value is described with the call's arguments, which hold that value. +// A call of command `key` with `args`, or of its action `action` (one of its actions, which runs it with `args`): a +// call whose arguments are an action's is that action, `action` or else the first with them (action_with_args()). An +// action that collects a value is described with the call's arguments, which hold that value. void describe_command(Builder& b, const CommandCatalog& catalog, const std::string& key, const json& args, - const json* tile = nullptr) + const json* action = nullptr) { json what{{"kind", "command"}, {"key", key}}; - if (tile == nullptr) + if (action == nullptr) if (const NativeCommand* command = catalog.find(key)) - tile = tile_with_args(*command, args); - if (tile != nullptr) - what["tile"] = tile->at("key"); - if ((tile == nullptr || !tile->value("input", std::string()).empty()) && args.is_object() && !args.empty()) + action = action_with_args(*command, args); + if (action != nullptr) + what["action"] = action->at("key"); + if ((action == nullptr || !action->value("input", std::string()).empty()) && args.is_object() && !args.empty()) what["args"] = argument_texts(args); b.d.what = std::move(what); - // What the command's tile does, as a person's pick of it: a calibration test's dialog, which then replaces the + // What the command's action does, as a person's pick of it: a calibration test's dialog, which then replaces the // project and changes the presets, and Load Project and New Project, which ask about unsaved changes. if (key == "calibration_generate_test") { b.flag(StepFlag::ReplacesProject); @@ -183,15 +183,15 @@ void describe_action(Builder& b, const CommandCatalog& catalog, const json& args { const std::string id = args.contains("id") && args["id"].is_string() ? args["id"].get() : std::string(); const json given = args.contains("args") ? args["args"] : json(); - // A command's tile, by its full id or by the key inside it, as action_run takes either: a folded item's tile runs its - // command with the item's arguments, and the value it collects when it has one, as a person's pick of it does. - if (const auto [command, tile] = find_tile(catalog, command_tile_key(id)); command != nullptr) { - describe_command(b, catalog, command->key, tile_call_args(tile, given), tile); + // A command's action, by its full id or by the key inside it, as action_run takes either: a folded item's action runs + // its command with the item's arguments, and the value it collects when it has one, as a person's pick of it does. + if (const auto [command, action] = find_command_action(catalog, command_action_key(id)); command != nullptr) { + describe_command(b, catalog, command->key, action_call_args(action, given), action); return; } const auto [prefix, middle] = split_action_id(id); if (prefix == kCommandPrefix) { - // A tile `catalog` does not hold (a Design tile of a run without the Design tab), by the key in its id. + // An action `catalog` does not hold (a Design tab action of a run without the Design tab), by the key in its id. describe_command(b, catalog, middle, given); } else if (prefix == "orca_recent_project") { b.d.what = {{"kind", "recent_project"}, {"name", file_name(middle)}}; @@ -208,15 +208,15 @@ void describe_action(Builder& b, const CommandCatalog& catalog, const json& args } } -// A command of `catalog` called as one of its tiles: with the arguments of a tile that runs it with them (a menu item -// folded into it), or with none, as its tile of its own (plate_delete). A command with a tile of its own that the tool -// list does not show (a Design command) is its tile's call whatever its arguments. Called so, it does what action_run -// of that tile does. -bool tile_command(const CommandCatalog& catalog, const std::string& tool, const json& args) +// A command of `catalog` called as one of its actions: with the arguments of an action that runs it with them (a menu +// item folded into it), or with none, as its action of its own (plate_delete). A command with an action of its own that +// the tool list does not show (a Design command) is its action's call whatever its arguments. Called so, it does what +// action_run of that action does. +bool action_command(const CommandCatalog& catalog, const std::string& tool, const json& args) { const NativeCommand* command = catalog.find(tool); - return command != nullptr && (tile_with_args(*command, args) != nullptr || - (command->in_palette && (!command->listed || person_form(args)))); + return command != nullptr && (action_with_args(*command, args) != nullptr || + (command->has_own_action && (!command->listed || person_form(args)))); } std::optional read_text(const fs::path& path) @@ -325,7 +325,7 @@ json describe_call(const CommandCatalog& catalog, const std::string& tool, const describe_action(b, catalog, args); return b.d.what; } - if (tile_command(catalog, tool, args)) { + if (action_command(catalog, tool, args)) { Builder b; describe_command(b, catalog, tool, args); return b.d.what; @@ -363,7 +363,7 @@ StepDescription describe_step(const CommandCatalog& catalog, const ReplayStep& s describe_nested(b, catalog, args, ctx, depth); return b.done(); } - if (tile_command(catalog, tool, args)) { + if (action_command(catalog, tool, args)) { describe_command(b, catalog, tool, args); return b.done(); } diff --git a/src/slic3r/GUI/Mcp/McpReplaySummary.hpp b/src/slic3r/GUI/Mcp/McpReplaySummary.hpp index b8211a8cc9..46bd02fe79 100644 --- a/src/slic3r/GUI/Mcp/McpReplaySummary.hpp +++ b/src/slic3r/GUI/Mcp/McpReplaySummary.hpp @@ -26,8 +26,8 @@ struct StepDescription { std::vector flags; // no duplicates, in enum order // What the step acts on: {"kind":"files","names":[...]} | {"kind":"settings","pairs":[...]} - // | {"kind":"command","key":k,"args"?:["name: value", ...]} (a file by its name), or with "tile":t in place of - // "args" for a call with the arguments of k's tile t (NativeCommand::tiles) | {"kind":"recent_project","name":n} + // | {"kind":"command","key":k,"args"?:["name: value", ...]} (a file by its name), or with "action":a in place of + // "args" for a call with the arguments of k's action a (NativeCommand::actions) | {"kind":"recent_project","name":n} // | {"kind":"preset","name":n} | {"kind":"plates","plates":"current"|"all"|index} // | {"kind":"replay","steps":n} | {"kind":"value","text":t} | null. nlohmann::json what; @@ -42,10 +42,10 @@ struct StepDescription // Describes `step` of `replay`, substituting its arguments leniently over `ctx`; a file counts as // written inside the output folder when it is inside ctx.out_dir. A step that calls a command of `catalog` as one -// of its tiles (with exactly a tile's arguments, or with none where it has a tile of its own, or, for one the tool -// list does not show, a Design command, with any) is described as action_run of that tile is. A step's flags come -// from the command it runs and its arguments, whether it calls the command or action_run of its tile (an export flags -// writes_file either way). A replay_run step is described by +// of its actions (with exactly an action's arguments, or with none where it has an action of its own, or, for one the +// tool list does not show, a Design command, with any) is described as action_run of that action is. A step's flags +// come from the command it runs and its arguments, whether it calls the command or action_run of its action (an export +// flags writes_file either way). A replay_run step is described by // the steps of its inline replay, or of its file when `path` reads and parses, each in the nested // run's own context (its vars merged with the step's `vars`, its own replay and output folders); // past `depth` 4, or when the file doesn't read or parse, it gets every flag, "checked" and diff --git a/src/slic3r/GUI/Mcp/McpServerInfo.cpp b/src/slic3r/GUI/Mcp/McpServerInfo.cpp index 30baba1dc2..4cc8ba461f 100644 --- a/src/slic3r/GUI/Mcp/McpServerInfo.cpp +++ b/src/slic3r/GUI/Mcp/McpServerInfo.cpp @@ -32,8 +32,8 @@ const char* kInstructions = "Acting on project data by index and name, JSON in and out; prefer these:\n" "- Commands are named place first, then verb (object_mirror); tool_search {group:\"Objects\"} lists a place's " "commands.\n" - "- A call with exactly one Speed Dial tile's arguments (project_export {format:\"gcode\"}) may ask in a dialog or " - "act on the selection, as a person's pick of it does. Any other call, with silent: true where a " + "- A call with exactly a Speed Dial action's arguments (project_export {format:\"gcode\"}) may ask in a dialog or " + "act on the selection, as a person's pick does. Any other call, with silent: true where a " "schema takes it, runs from its arguments; a dialog it still opens (preset_export's always) is in its " "description.\n" "- Which setting does what: settings_get {query} (a few words, no type) searches the settings being edited; each " @@ -44,8 +44,8 @@ const char* kInstructions = "has plates and outside for items.\n" "- Paths are absolute; an output replaces a file only with overwrite: true.\n" "Driving the GUI, for what those do not reach or to see what a person sees:\n" - "- action_run runs a Speed Dial entry by id from action_search: a tile as a call with its arguments does; a plate, " - "a recent project, a plugin's script or page as a person's pick does.\n" + "- action_run runs a Speed Dial action by id from action_search: a command's as a call with its arguments does; a " + "plate, a recent project, a plugin's script or page as a person's pick does.\n" "- widget_list lists widgets, menus, 3D toolbar items, gizmos, ImGui items and web page elements with refs; " "widget_click / widget_set_value / keyboard_press / mouse_gesture act on its refs (good across later listings) or " "on the locators its description lists.\n" diff --git a/src/slic3r/GUI/Mcp/McpTools.hpp b/src/slic3r/GUI/Mcp/McpTools.hpp index 9bd07f2cee..8bd57bb860 100644 --- a/src/slic3r/GUI/Mcp/McpTools.hpp +++ b/src/slic3r/GUI/Mcp/McpTools.hpp @@ -139,10 +139,10 @@ NativeCommand reaching(std::vector operations, NativeCommand comman NativeCommand mutate_tool(std::string name, std::string title, std::string description, nlohmann::json schema, CommandFn handler, bool destructive = false); // A command made from menu items (NativeCommandMenuItems.hpp): NativeCommands::ui_command(), listed, with `description` and -// the items as its `tiles`. `fn` does what the menu item a call's variant argument names does, as a person's pick of that item +// the items as its `actions`. `fn` does what the menu item a call's variant argument names does, as a person's pick of that item // does: on the targets the call names (McpTargets.hpp) where the command takes them, else on what is selected. A menu item // with no argument form is no command of the tool list: its declaration sets listed false. -NativeCommand menu_command(std::string name, std::string title, std::string description, nlohmann::json schema, nlohmann::json tiles, +NativeCommand menu_command(std::string name, std::string title, std::string description, nlohmann::json schema, nlohmann::json actions, std::function fn); // What a command made from menu items replies to a call, which a pick does not show: `reply`. AppActionRunResult menu_reply(const nlohmann::json& reply); @@ -205,24 +205,24 @@ nlohmann::json search_commands(const CommandCatalog& catalog, const nlohmann::js // The Speed Dial actions of `listed` (ActionRegistry::describe()'s items: id, title, group, description) // that `words` (of query_words()) describe, best first: those matching more of the words, then those // matching more of them in what the action is called (the name inside its id, its title and its group), -// then the shorter name, which is the plainer tile (obj_delete before obj_delete_all). action_search +// then the shorter name, which is the plainer action (obj_delete before obj_delete_all). action_search // and tool_search both rank with it, so one query finds the same actions through either. nlohmann::json rank_actions(const nlohmann::json& listed, const std::vector& words); -// Why action_run refuses `args` for `action`, or empty when it does not: a tile that collects a value (input) takes -// exactly that value, a command's own tile takes its command's arguments, which the command checks, an item of a -// command's tiles (a folded item's, with a preset) takes none or exactly its preset, and every other action (a +// Why action_run refuses `args` for `action`, or empty when it does not: an action that collects a value (input) takes +// exactly that value, a command's own action takes its command's arguments, which the command checks, an item of a +// command's actions (a folded item's, with a preset) takes none or exactly its preset, and every other action (a // plugin's script or page, a plate's, a setting's or a recent project's) takes none. std::string action_args_error(const AppAction& action, const nlohmann::json& args); -// The arguments action_run's journal step keeps for a command's tile of fixed arguments (AppAction::preset), run with -// `args`, which action_run accepted: what it takes for that tile, the tile's own arguments, or for a tile that collects -// a value, `args` (that value alone). Null for an action without a preset, a Design command's own tile among them, -// which takes its command's arguments and keeps the command's rewrite of them (Mcp::TileContext). -nlohmann::json tile_journal_args(const AppAction& action, const nlohmann::json& args); +// The arguments action_run's journal step keeps for a command's action of fixed arguments (AppAction::preset), run with +// `args`, which action_run accepted: what it takes for that action, the action's own arguments, or for an action that +// collects a value, `args` (that value alone). Null for an action without a preset, a Design command's own action among +// them, which takes its command's arguments and keeps the command's rewrite of them (Mcp::ActionContext). +nlohmann::json action_journal_args(const AppAction& action, const nlohmann::json& args); // What action_run answers for `id`, an action id or the name inside one, that no action of the app's state has: -// for a Design tab tile's, when that tile is there and the tool_call that runs it from any tab (its command, with -// the item's arguments for a folded item's tile), or, when `catalog` leaves the tile's command out +// for a Design tab action's, when that action is there and the tool_call that runs it from any tab (its command, with +// the item's arguments for a folded item's action), or, when `catalog` leaves the action's command out // (CommandCatalog::leave_out()), why; for any other, where an action or a command is found. std::string unknown_action(const std::string& id, const CommandCatalog& catalog); diff --git a/src/slic3r/GUI/Mcp/McpToolsActions.cpp b/src/slic3r/GUI/Mcp/McpToolsActions.cpp index 78ccf22cf5..f4f3aa236c 100644 --- a/src/slic3r/GUI/Mcp/McpToolsActions.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsActions.cpp @@ -79,7 +79,7 @@ const AppAction& find_action(ActionRegistry& actions, std::string& id) std::string action_args_error(const AppAction& action, const json& args) { - // A tile that collects a value takes that value alone, as the Speed Dial's second phase gives it. + // An action that collects a value takes that value alone, as the Speed Dial's second phase gives it. if (!action.input.empty()) return args.is_object() && args.size() == 1 && args.contains(action.input) ? std::string() : @@ -87,8 +87,8 @@ std::string action_args_error(const AppAction& action, const json& args) "\": ...} (its input_schema)"; if (person_form(args)) return {}; - // A command's tile runs its command with the tile's arguments, which it takes as well as none; other arguments are - // the command's to take. + // A command's action runs its command with the action's arguments, which it takes as well as none; other arguments + // are the command's to take. if (!action.preset.is_null()) { if (args == action.preset) return {}; @@ -98,13 +98,13 @@ std::string action_args_error(const AppAction& action, const json& args) return "The action " + action.id() + " runs " + action.command + " with " + action.preset.dump() + ": run it without args or with exactly those, or call " + action.command + " with other arguments"; } - // A Design command's own tile takes the command's arguments, which the command checks. + // A Design command's own action takes the command's arguments, which the command checks. if (!action.command.empty()) return {}; return "The action " + action.id() + " takes no arguments: run it without args"; } -json tile_journal_args(const AppAction& action, const json& args) +json action_journal_args(const AppAction& action, const json& args) { if (action.preset.is_null()) return nullptr; @@ -113,26 +113,26 @@ json tile_journal_args(const AppAction& action, const json& args) std::string unknown_action(const std::string& id, const CommandCatalog& catalog) { - // A Design tile is no action while it is not live (ActionRegistry::materialize_design_actions()); its + // A Design tab action is in the registry only while it is live (ActionRegistry::materialize_design_actions()); its // command is in the catalog, unless the catalog was built with the CAD feature off. - const std::string tile = id.find(':') != std::string::npos ? id : AppAction::compose_id(kCommandPrefix, id, kOrcaSourceKey); - if (is_design_tile_id(tile)) { - if (const std::string* why = catalog.left_out(short_id(tile))) - return id + " is a Design tab tile, and " + *why; - // A folded item's tile is a call of the command it is folded into with the item's arguments, written as the + const std::string action_id = id.find(':') != std::string::npos ? id : AppAction::compose_id(kCommandPrefix, id, kOrcaSourceKey); + if (is_design_action_id(action_id)) { + if (const std::string* why = catalog.left_out(short_id(action_id))) + return id + " is a Design tab action, and " + *why; + // A folded item's action is a call of the command it is folded into with the item's arguments, written as the // rest of the call is, a space after each colon and comma. - const auto [command, folded] = find_tile(catalog, short_id(tile)); - std::string call = "{\"tool\": \"" + (command != nullptr ? command->key : short_id(tile)) + "\""; + const auto [command, folded] = find_command_action(catalog, short_id(action_id)); + std::string call = "{\"tool\": \"" + (command != nullptr ? command->key : short_id(action_id)) + "\""; if (folded != nullptr && !folded->at("args").empty()) { std::string args; for (const auto& [name, value] : folded->at("args").items()) args += (args.empty() ? "" : ", ") + json(name).dump() + ": " + value.dump(); call += ", \"args\": {" + args + "}"; } - return id + " is a Design tab tile, there only while the Design tab is shown in its mode (a sketch's or the model's) " + return id + " is a Design tab action, there only while the Design tab is shown in its mode (a sketch's or the model's) " "with the CAD feature on; tool_call " + call + "} runs its command from any tab"; } - // The name may be a command's that has no tile, which tool_call runs. + // The name may be a command's that has no action, which tool_call runs. return "Unknown action id " + id + "; find an action with action_search, or a command with tool_search"; } @@ -148,7 +148,7 @@ json rank_actions(const json& listed, const std::vector& words) for (const json& action : listed) { // The name inside the id, without the source and plugin every built-in id shares: "orca" and // "command" would match them all. The group is part of what the action is called, as the - // palette shows one by group and title: Delete Selected is the Object group's delete, though + // Speed Dial shows one by group and title: Delete Selected is the Object group's delete, though // its own title names no object. const std::string name = short_id(action.value("id", std::string())); const std::pair score = match_score(words, @@ -227,13 +227,13 @@ void register_action_tools(CommandCatalog& catalog) NativeCommand run = mutate_tool( "action_run", L("Run a Speed Dial action"), "Run one action by the id action_search returned (orca_command:view_front:orca, or the name inside it, view_front), " - "with args, the command's arguments, when it takes some (its input_schema). A command's tile (action_search names " - "the command) runs the command as a call with the tile's arguments does: a tile that asks in a dialog asks, and " - "the call returns blocked_by_dialog; answer it with dialog_answer, or, for a native one it can't press (a file " - "picker), register dialog_auto_answer before the call. Such a tile takes no args, or exactly its own; to run a " + "with args, the command's arguments, when it takes some (its input_schema). A command's action (action_search names " + "the command) runs the command as a call with the action's arguments does: an action that asks in a dialog asks, " + "and the call returns blocked_by_dialog; answer it with dialog_answer, or, for a native one it can't press (a file " + "picker), register dialog_auto_answer before the call. Such an action takes no args, or exactly its own; to run a " "command without asking, call it with its arguments (an absolute path skips a file dialog). Go to layer and Go to " - "tab take their value alone ({\"percent\": 50}, {\"tab\": \"preview\"}), and a Design command's own tile takes the " - "command's arguments. An action that starts a background job (obj_arrange, obj_orient) completes when the job " + "tab take their value alone ({\"percent\": 50}, {\"tab\": \"preview\"}), and a Design command's own action takes " + "the command's arguments. An action that starts a background job (obj_arrange, obj_orient) completes when the job " "ends. An action that does nothing (no object selected) is an error. Some commands add what they did to the reply " "(the order object_order leaves, the object object_assemble made). The other actions (plates, recent projects, " "plugin scripts and pages, settings) run only here.", @@ -243,22 +243,22 @@ void register_action_tools(CommandCatalog& catalog) [](const json& args, ToolContext& ctx) { std::string id = arg_string(args, "id"); json command_args = args.contains("args") ? args["args"] : json::object(); - std::string key; // the command of a command's tile - json tile_args; // what its journal step keeps for a tile of fixed arguments - AppActionRunResult result; // of any other action + std::string key; // the command of a command's action + json action_args; // what its journal step keeps for an action of fixed arguments + AppActionRunResult result; // of any other action ctx.run_ui([&]() -> json { ActionRegistry& actions = registry_or_fail(); const AppAction& action = find_action(actions, id); if (const std::string err = action_args_error(action, command_args); !err.empty()) throw ToolFailure(err); - key = action.command; - tile_args = tile_journal_args(action, command_args); + key = action.command; + action_args = action_journal_args(action, command_args); if (key.empty()) { result = actions.run(id, command_args, /*record_stats=*/false); } else { - // What a person's pick of the tile runs its command with, which the journal records. - const json* tile = find_tile(NativeCommands::instance(), short_id(id)).second; - command_args = tile_call_args(tile, command_args); + // What a person's pick of the action runs its command with, which the journal records. + const json* command_action = find_command_action(NativeCommands::instance(), short_id(id)).second; + command_args = action_call_args(command_action, command_args); } return json(); }); @@ -266,20 +266,20 @@ void register_action_tools(CommandCatalog& catalog) settle(ctx); return NativeCommands::from_run_result(id, result); } - // A command's tile runs the command's own function, as a call of the command does, inside action_run's + // A command's action runs the command's own function, as a call of the command does, inside action_run's // journal entry. const NativeCommand* command = NativeCommands::find(key); if (command == nullptr) throw ToolFailure("Unknown command " + key); if (const std::string err = argument_error(*command, command_args); !err.empty()) throw ToolFailure("Invalid arguments for " + key + ": " + err); - TileContext tile(ctx, id, tile_args); - ToolResult reply = command->run(command_args, tile); + ActionContext action_ctx(ctx, id, action_args); + ToolResult reply = command->run(command_args, action_ctx); if (!reply.is_error && reply.data.is_object()) reply.data["ran"] = id; return reply; }); - // Its tiles upload G-code to a print host (printer_send) and sync presets with the cloud account (preset_sync). + // Its actions upload G-code to a print host (printer_send) and sync presets with the cloud account (preset_sync). run.open_world = true; catalog.add(run); } diff --git a/src/slic3r/GUI/Mcp/McpToolsApi.cpp b/src/slic3r/GUI/Mcp/McpToolsApi.cpp index 33329be7e6..6fd92dc974 100644 --- a/src/slic3r/GUI/Mcp/McpToolsApi.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsApi.cpp @@ -49,7 +49,7 @@ json editor_tool_catalog(const CommandCatalog& catalog) args[name] = std::move(arg); } tools.push_back( - {{"name", def.key}, {"title", into_u8(NativeCommands::tile_title(def))}, {"args", std::move(args)}}); + {{"name", def.key}, {"title", into_u8(NativeCommands::action_title(def))}, {"args", std::move(args)}}); } return tools; } @@ -102,7 +102,7 @@ json catalog_hits(const json& ranked, const std::string& use) } // The Speed Dial's actions that are no command (plates, recent projects, plugin scripts and pages) and settings -// matching `words` (of `query`), for tool_search. A command's tile is left out: the command is among the +// matching `words` (of `query`), for tool_search. A command's action is left out: the command is among the // commands already. A catalog that can't be read yet (startup, before the main window) is left out. UI thread. json ui_catalog_hits(const std::vector& words, const std::string& query) { @@ -239,7 +239,7 @@ json search_commands(const CommandCatalog& catalog, const json& args) return {{"total", items.size()}, {"names", std::move(items)}}; } // A command is called by its key; its title, a person's name for it, counts as its text. Among equal - // matches a listed command comes first: the typed tools are what an agent calls, and many tiles run one. + // matches a listed command comes first: the typed tools are what an agent calls, and many Speed Dial actions run one. const std::vector words = query_words(query); std::vector, const NativeCommand*>> scored; for (const auto& def : all) { diff --git a/src/slic3r/GUI/Mcp/McpToolsApp.cpp b/src/slic3r/GUI/Mcp/McpToolsApp.cpp index cbf06d27c3..6d0884b9b9 100644 --- a/src/slic3r/GUI/Mcp/McpToolsApp.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsApp.cpp @@ -410,12 +410,12 @@ void register_app_tools(CommandCatalog& catalog, [[maybe_unused]] bool cad) })); // Undo and Redo act on the shown tab's history, as the Edit menu's do; history names one for automation, which acts - // whatever tab is shown. Each has a tile of its own, in the Speed Dial's section Commands. + // whatever tab is shown. Each has an action of its own, in the Speed Dial's section Commands. const json history = object_schema( {{"history", enum_prop({"design", "project"}, "The history: design, the Design tab's (with the CAD feature on), or project. " "Default: the Design tab's while it is shown, else the project's.")}}); // A person's pick does what the Edit menu's item does, and shows nothing where it would be greyed. An automated - // call, action_run of the tile included, acts on the history MenuItems::undo_redo() picks: the Design tab's through its + // call, action_run of its action included, acts on the history MenuItems::undo_redo() picks: the Design tab's through its // gate, whose refusals say why, and the project's as the Edit menu's item does. const auto history_command = [&history](std::string key, std::string title, std::string icon, std::string description, bool redo) { NativeCommand command = menu_command(std::move(key), std::move(title), std::move(description), history, json(), @@ -426,9 +426,9 @@ void register_app_tools(CommandCatalog& catalog, [[maybe_unused]] bool cad) command.run = [picked, automated = std::move(command.run)](const json& args, ToolContext& ctx) { return ctx.person() ? picked(args, ctx) : automated(args, ctx); }; - command.in_palette = true; - command.tile_group = L("Commands"); - command.icon = std::move(icon); + command.has_own_action = true; + command.action_group = L("Commands"); + command.icon = std::move(icon); return command; }; NativeCommand undo = history_command( @@ -472,41 +472,43 @@ void register_app_tools(CommandCatalog& catalog, [[maybe_unused]] bool cad) catalog.add(std::move(redo)); // ---- The app's commands made from the Help and Plugins menus' items ---- - using NativeCommands::tile; + using NativeCommands::action; NativeCommand web_page = menu_command( "app_open_web_page", L("Open a web page"), "Open one of OrcaSlicer's web pages in the default web browser, as its menu item does: wiki, the OrcaSlicer wiki; " "youtube, the OrcaSlicer YouTube channel; plugin_hub, the plugin hub's page, where a person picks a plugin to install. " "Nothing opens in OrcaSlicer.", object_schema({{"page", enum_prop({"wiki", "youtube", "plugin_hub"}, "The page.")}}, {"page"}), - json::array({tile("open_wiki", L("Open Wiki"), L("Help"), "link_wiki_img", {{"page", "wiki"}}, "Open the OrcaSlicer wiki in the browser."), - tile("open_youtube", L("Open YouTube Channel"), L("Help"), "", {{"page", "youtube"}}, - "Open the OrcaSlicer YouTube channel in the browser."), - tile("install_plugin", L("Install Plugin"), L("Plugins"), "", {{"page", "plugin_hub"}}, - "Open the plugin hub's page in the default web browser, where a person picks a plugin to install; " - "nothing opens in OrcaSlicer.")}), + json::array({action("open_wiki", L("Open Wiki"), L("Help"), "link_wiki_img", {{"page", "wiki"}}, + "Open the OrcaSlicer wiki in the browser."), + action("open_youtube", L("Open YouTube Channel"), L("Help"), "", {{"page", "youtube"}}, + "Open the OrcaSlicer YouTube channel in the browser."), + action("install_plugin", L("Install Plugin"), L("Plugins"), "", {{"page", "plugin_hub"}}, + "Open the plugin hub's page in the default web browser, where a person picks a plugin to install; " + "nothing opens in OrcaSlicer.")}), [](const json& args) { return MenuItems::open_web_page(arg_string(args, "page")); }); // The browser it opens reaches the network. web_page.open_world = true; catalog.add(std::move(web_page)); const std::string updates = "Check for a newer OrcaSlicer."; NativeCommand check_updates = menu_command("app_check_for_updates", L("Check for Updates"), updates, object_schema({}), - json::array({tile("help_check_updates", L("Check for Updates"), L("Help"), "refresh", - json::object(), updates)}), + json::array({action("help_check_updates", L("Check for Updates"), L("Help"), "refresh", + json::object(), updates)}), [](const json&) { return MenuItems::check_for_updates(); }); // It asks the update server. check_updates.open_world = true; catalog.add(std::move(check_updates)); const std::string folder = "Open the configuration folder in the file manager."; catalog.add(menu_command("app_show_config_folder", L("Show Configuration Folder"), folder, object_schema({}), - json::array({tile("help_open_config_folder", L("Show Configuration Folder"), L("Help"), "open_project", - json::object(), folder)}), + json::array({action("help_open_config_folder", L("Show Configuration Folder"), L("Help"), "open_project", + json::object(), folder)}), [](const json&) { return MenuItems::show_config_folder(); })); const std::string benchmark = "Time the 3D views on a test model. It asks first (Start or Cancel), then replaces the project with " "the OrcaSliced Combo as New Project does, which may ask about unsaved changes, slices it and shows " "the results."; catalog.add(menu_command("app_benchmark_3d_scene", L("Benchmark 3D Scene"), benchmark, object_schema({}), - json::array({tile("help_benchmark_3d_scene", L("Benchmark 3D Scene"), L("Help"), "", json::object(), benchmark)}), + json::array({action("help_benchmark_3d_scene", L("Benchmark 3D Scene"), L("Help"), "", json::object(), + benchmark)}), [](const json&) { return MenuItems::benchmark_3d_scene(); })); } diff --git a/src/slic3r/GUI/Mcp/McpToolsCad.cpp b/src/slic3r/GUI/Mcp/McpToolsCad.cpp index 8b1c5bf0cc..ecb6a08f32 100644 --- a/src/slic3r/GUI/Mcp/McpToolsCad.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsCad.cpp @@ -1,5 +1,5 @@ // The Design tab's commands. The Design table (kDesignTools, generated from scripts/CAD/tool_atlas.json) -// declares every one, its menu item, action, access, tool block and the items folded into it; kSilentForms binds a +// declares every one, its menu item, handler, access, tool block and the items folded into it; kSilentForms binds a // block to the function that runs it. register_cad_commands() makes a command of each entry that is one // (is_design_command()): a call with the arguments that choose one of its items does what that menu item does // (opened_item(), open_tool()), and any other has run_cad_tool() run its silent form on the UI thread, through the @@ -55,7 +55,7 @@ #include "slic3r/GUI/CAD/DesignPanel.hpp" #include "slic3r/GUI/CAD/DesignCanvas.hpp" #include "slic3r/GUI/CAD/DesignSketchTool.hpp" -#include "slic3r/GUI/CAD/DesignOffer.hpp" // the Design table: every command's menu item, action and tool block +#include "slic3r/GUI/CAD/DesignOffer.hpp" // the Design table: every command's menu item, handler and tool block #include "libslic3r/CAD/CadDocument.hpp" #include "libslic3r/CAD/SketchEngine.hpp" @@ -163,7 +163,7 @@ const char* const kGenerationNote = // How a silent form whose entry has ok_false reports a rebuild the kernel rejects. const char* const kFailureNote = "A rejected rebuild is reported in the reply: ok is false or error is not empty."; -// The rest of the description of a command whose entry has an action and no silent form, after its hint and +// The rest of the description of a command whose entry has a handler and no silent form, after its hint and // before mode_note(). const char* const kOpensToolNote = "It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open " @@ -176,7 +176,7 @@ const char* const kSilentNote = "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design " "tab's menu item does, as a person's pick does."; -// The mode an entry with an action runs in, as the Design tab's right-click menu offers it (offered_in_mode()). +// The mode an entry with a handler runs in, as the Design tab's right-click menu offers it (offered_in_mode()). // A sketch being constrained counts as open, and refuses sketch_finish and sketch_cancel: the tab's own Confirm // and Cancel buttons end it. A call that takes no arguments runs only there; `no_arguments` words it for the call // with no arguments of a command that also runs from arguments, whose argument form may run in the other mode @@ -198,7 +198,7 @@ const char* const kCadOffNote = "tool_call runs no Design command now: they need "off and restarts OrcaSlicer, or starts it with --cad."; // Why a catalog built with the CAD feature off leaves out the Design commands, after "Unknown tool: ; " -// or a tile's " is a Design tab tile, and " (unknown_action()). +// or an action's " is a Design tab action, and " (unknown_action()). const char* const kCadOffAtStartup = "the CAD feature was off when OrcaSlicer started: a person turns it on in " "Preferences > Features and restarts OrcaSlicer, or starts it with --cad"; @@ -3973,14 +3973,14 @@ CadRun find_silent_form(const std::string& id) return nullptr; } -// Runs `run`, a tool's handler, with its failure as the call's error: the handler's own refusal with its code, +// Runs `run`, a silent form or undo and redo, with its failure as the call's error: its own refusal with its code, // a kernel exception as "OCCT: ...", and any other as -32000. json run_guarded(const std::function& run) { try { return run(); } catch (const ToolFailure&) { - throw; // a handler's own refusal, code included + throw; // its own refusal, code included } catch (const Standard_Failure& ex) { // derives from std::exception, so it comes first throw ToolFailure(std::string("OCCT: ") + (*ex.what() ? ex.what() : "failure"), {{"code", -32000}}); } catch (const std::exception& ex) { @@ -3988,7 +3988,7 @@ json run_guarded(const std::function& run) } } -// Why a menu-only entry (a btn: or fly: action) is refused for a selection it does not accept. +// Why a menu-only entry (a btn: or fly: handler) is refused for a selection it does not accept. // TRN Refusal of a Design tab tool picked for a selection its right-click menu item is greyed for (Constrain // sketch with a face selected). const char* const kDoesNotApply = L("This tool does not apply to what is selected"); @@ -4016,16 +4016,16 @@ uint32_t reported_kinds(bool sketching) return bits; } -// Item `item`'s action, for a call of `command` that opens it (opened_item()), as a person's pick of the item or its -// tile runs it: past cad_gate() with no access of its own, so that only a rebuild refuses it, as the Design tab's -// keys and menu are refused by nothing; each tool decides for itself what an open card means to it. The action -// runs in place, so a modal dialog it opens holds the call, which the core reports as blocked by that dialog. It -// is refused, as open_refusal() says, in the mode the item does not belong to, where the right-click menu does not -// offer it, and for a btn: or fly: action a selection the menu greys the item for. The reply claims nothing about -// what the action did, which may be to open a card, start a sketch tool, act at once or tell the person why it +// Item `item`'s handler, for a call of `command` that opens it (opened_item()), as a person's pick of the item or of +// its Speed Dial action runs it: past cad_gate() with no access of its own, so that only a rebuild refuses it, as the +// Design tab's keys and menu are refused by nothing; each tool decides for itself what an open card means to it. The +// handler runs in place, so a modal dialog it opens holds the call, which the core reports as blocked by that dialog. +// It is refused, as open_refusal() says, in the mode the item does not belong to, where the right-click menu does not +// offer it, and for a btn: or fly: handler a selection the menu greys the item for. The reply claims nothing about +// what the handler did, which may be to open a card, start a sketch tool, act at once or tell the person why it // cannot: it says what the tab shows after it, its busy reason (a card, a dialog or a sketch now open) and its // status line. Its `tool` is the command called. A call that is not a person's pick, made while a row of the Feature -// list is selected and nothing is picked in the view, targets that row: an item whose action acts on it (feature_row) +// list is selected and nothing is picked in the view, targets that row: an item whose handler acts on it (feature_row) // is not refused for the selection then, and applies. A person's pick keeps the menu's rule, which greys the item. json open_tool(const DesignTool& item, const char* command, const json& args, bool person) { @@ -4038,8 +4038,8 @@ json open_tool(const DesignTool& item, const char* command, const json& args, bo throw *refused; const bool text_was_open = panel->mcp_text_dialog_open(); panel->mcp_run_verb(item.id); - // A dialog the action opened held the call until it was answered, unless the action opened the Text dialog, - // which is modeless: the call returns with it open. A Text dialog open before the action is not its dialog. + // A dialog the handler opened held the call until it was answered, unless the handler opened the Text dialog, + // which is modeless: the call returns with it open. A Text dialog open before the handler ran is not its dialog. const bool modal = item.modal && !(panel->mcp_text_dialog_open() && !text_was_open); std::string why; const bool busy = panel->mcp_busy(false, false, why); @@ -4082,7 +4082,7 @@ std::string opening_calls(const DesignTool& t) calls + "."; } -// The command of the Design table's entry `t`, which has an action, a tool block or both, and is no folded item. +// The command of the Design table's entry `t`, which has a handler, a tool block or both, and is no folded item. NativeCommand design_command(const DesignTool& t) { const json doc = t.doc != nullptr ? json::parse(t.doc) : json(); @@ -4108,17 +4108,17 @@ NativeCommand design_command(const DesignTool& t) return run_cad_tool(entry->id, silent_args(args)); }, [entry](const json& args) { return opened_item(*entry, args) != nullptr; }); - c.in_palette = t.action != nullptr; - c.icon = t.icon != nullptr ? t.icon : ""; - // The items folded into the command keep their tiles, each a call of the command with the item's arguments, and - // say what a pick does as a command with an action only does. + c.has_own_action = t.action != nullptr; + c.icon = t.icon != nullptr ? t.icon : ""; + // The items folded into the command keep their actions, each a call of the command with the item's arguments, + // and say what a pick does as a command with a handler only does. for (const DesignTool& item : kDesignTools) if (item.fold_into != nullptr && std::strcmp(item.fold_into, t.id) == 0) - c.tiles.push_back({{"key", item.id}, - {"title", item.name}, - {"icon", item.icon != nullptr ? item.icon : ""}, - {"description", std::string(item.hint) + ". " + kOpensToolNote + " " + mode_note(item)}, - {"args", json::parse(item.args)}}); + c.actions.push_back({{"key", item.id}, + {"title", item.name}, + {"icon", item.icon != nullptr ? item.icon : ""}, + {"description", std::string(item.hint) + ". " + kOpensToolNote + " " + mode_note(item)}, + {"args", json::parse(item.args)}}); if (doc.is_null()) { c.description = std::string(t.hint) + ". " + kOpensToolNote + " " + mode_note(t); return c; @@ -4164,16 +4164,16 @@ const DesignTool* opened_item(const DesignTool& entry, const json& args) bool offered_in_mode(const DesignTool& t, bool sketching) { return t.sketch_mode == sketching; } -std::vector design_tiles(const CommandCatalog& catalog, bool sketching, bool cad_on) +std::vector design_actions(const CommandCatalog& catalog, bool sketching, bool cad_on) { - std::vector tiles; - if (!cad_on) return tiles; + std::vector actions; + if (!cad_on) return actions; for (const DesignTool& t : kDesignTools) { if (t.action == nullptr || !offered_in_mode(t, sketching)) continue; - const auto [command, tile] = find_tile(catalog, t.id); - if (command != nullptr && command->group == kDesignGroup) tiles.push_back({command, tile}); + const auto [command, action] = find_command_action(catalog, t.id); + if (command != nullptr && command->group == kDesignGroup) actions.push_back({command, action}); } - return tiles; + return actions; } std::optional open_refusal(const DesignTool& t, bool sketching, int kind, bool row_target) @@ -4181,14 +4181,14 @@ std::optional open_refusal(const DesignTool& t, bool sketching, int if (!offered_in_mode(t, sketching)) return ToolFailure(t.sketch_mode ? kSketchTool : kModelTool, {{"code", -32000}, {"mode", t.sketch_mode ? "sketch" : "model"}}); - // The item's action acts on the Feature list's selected row, and says itself what it cannot do with it. + // The item's handler acts on the Feature list's selected row, and says itself what it cannot do with it. if (row_target && t.feature_row) return std::nullopt; - const std::string action(t.action); + const std::string handler(t.action); const bool applies = (t.accepts & offer_bit(OfferSel(kind))) != 0; // Only an item that accepts a kind the tab can report in its mode is greyed for the others; one that accepts none // (Boolean's items take two bodies, Rib a sketch line) opens as its toolbar button does, whatever is selected. - const bool greyable = (action.rfind("btn:", 0) == 0 || action.rfind("fly:", 0) == 0) && + const bool greyable = (handler.rfind("btn:", 0) == 0 || handler.rfind("fly:", 0) == 0) && (t.accepts & reported_kinds(t.sketch_mode)) != 0; if (applies || !greyable) return std::nullopt; @@ -4233,7 +4233,7 @@ DesignPanel* cad_gate(CadAccess access, const json& args) // load it, as showing the tab would, before anything reads or writes the document. panel->hydrate_from_model(); - // Stale-id guard, checked here rather than in each handler. + // Stale-id guard, checked here rather than in each command's function. // // Global face and edge ids are indices into TopExp::MapShapes, valid only against the // topology that produced them. Every dress-up rewrites those maps, so the natural way to @@ -4246,7 +4246,7 @@ DesignPanel* cad_gate(CadAccess access, const json& args) // So a caller may pass back the "generation" it got from describe_design or body_describe, // and a mismatch is refused instead of silently obeyed. Optional by design: a call without it // is not checked, and supplying it is what buys the guarantee. One check here rather than one - // per handler, so a command added later cannot forget it. + // per command, so a command added later cannot forget it. // // The type is checked first, as a caller that skips the schema (run_cad_tool() called directly) may // pass any: a bare get() on `"generation": "x"` would surface as an internal error instead @@ -4373,7 +4373,7 @@ void register_cad_commands(CommandCatalog& catalog) void leave_out_cad_commands(CommandCatalog& catalog) { - // A folded item's id too, which is no command but names a tile. + // A folded item's id too, which is no command but names an action. for (const DesignTool& t : kDesignTools) if (t.action != nullptr || t.doc != nullptr) catalog.leave_out(t.id, kCadOffAtStartup); diff --git a/src/slic3r/GUI/Mcp/McpToolsCad.hpp b/src/slic3r/GUI/Mcp/McpToolsCad.hpp index fa5870a9f9..4fa81f4632 100644 --- a/src/slic3r/GUI/Mcp/McpToolsCad.hpp +++ b/src/slic3r/GUI/Mcp/McpToolsCad.hpp @@ -1,9 +1,9 @@ #pragma once // The Design tab's commands, one per entry of its table (kDesignTools, DesignOffer.hpp, generated from -// scripts/CAD/tool_atlas.json) that has an action or a tool block and is no folded item (is_design_command()): its +// scripts/CAD/tool_atlas.json) that has a handler or a tool block and is no folded item (is_design_command()): its // tools, sketches, features, measurements and edits, which an agent finds with tool_search (group Design) and -// runs with tool_call, and a person picks as Speed Dial tiles while the Design tab is shown, those of the mode it +// runs with tool_call, and a person picks as Speed Dial actions while the Design tab is shown, those of the mode it // is in. A call with exactly the arguments that choose one of the command's items (opened_item()) does what that // right-click menu item does, in the mode the item belongs to (open_refusal()); any other call, or one with // silent: true, runs the entry's tool block's silent form. They run on the UI thread through the GUI's own @@ -64,19 +64,20 @@ NativeCommand cad_command(std::string key, std::string title, nlohmann::json sch std::function opens = {}); // Adds the Design commands to `catalog`, one per entry of kDesignTools that is a command (is_design_command()): -// its id as the key, its name as the title, and its icon. An entry with an action is in the palette, and an item -// folded into a command is one of the command's `tiles`, with the item's id as its key, its name, icon and args, and -// as its description its hint and what a pick does (a tile is materialised only while the Design tab is shown in -// its entry's mode, ActionRegistry::materialize_design_actions()). One with a block is read_only for Read access, -// and its description is the block's summary, details and, for a silent form that reports a rejected rebuild in -// its reply, how that shows, then the other calls that open a tool, each with its item's name; its examples are the -// block's and its schema cad_input_schema() of it, through with_silent() when a call with no arguments opens a -// tool. One with an action only takes no arguments, and its description is its hint and what the call does. +// its id as the key, its name as the title, and its icon. An entry with a handler has an action of its own +// (has_own_action), and an item folded into a command is one of the command's `actions`, with the item's id as its +// key, its name, icon and args, and as its description its hint and what a pick does (an action is materialised +// only while the Design tab is shown in its entry's mode, ActionRegistry::materialize_design_actions()). One with a +// block is read_only for Read access, and its description is the block's summary, details and, for a silent form +// that reports a rejected rebuild in its reply, how that shows, then the other calls that open a tool, each with its +// item's name; its examples are the block's and its schema cad_input_schema() of it, through with_silent() when a +// call with no arguments opens a tool. One with a handler only takes no arguments, and its description is its hint +// and what the call does. // undo and redo are the shared commands of NativeCommands.cpp and not among them. void register_cad_commands(CommandCatalog& catalog); // Records in `catalog`, built with the CAD feature off, that it leaves out the keys register_cad_commands() -// adds, and the ids of the items folded into them, which name tiles, because the feature was off when OrcaSlicer +// adds, and the ids of the items folded into them, which name actions, because the feature was off when OrcaSlicer // started and how a person turns it on (CommandCatalog::leave_out()). void leave_out_cad_commands(CommandCatalog& catalog); @@ -115,13 +116,13 @@ DesignPanel* cad_gate(CadAccess access, const nlohmann::json& args); // The Design table's entry `id`, or nullptr. const DesignTool* find_design_tool(const std::string& id); -// Whether entry `t` is a command of the catalog: it has an action or a tool block, and is no folded item +// Whether entry `t` is a command of the catalog: it has a handler or a tool block, and is no folded item // (DesignTool::fold_into), which is a way of calling the command it is folded into. bool is_design_command(const DesignTool& t); // The item whose tool a call of `entry`'s command with `args` opens, or nullptr when the call runs. A call with no -// arguments (null or {}) opens `entry`'s own item where it has an action, else the first item folded into it with -// {}; any other opens `entry`'s item where it has an action and its own args equal `args`, else the first item +// arguments (null or {}) opens `entry`'s own item where it has a handler, else the first item folded into it with +// {}; any other opens `entry`'s item where it has a handler and its own args equal `args`, else the first item // folded into it whose args equal `args`. Arguments are compared as JSON values, as they reach the command's // function: `generation`, `silent` or any other argument beside the choosing ones makes the call run. const DesignTool* opened_item(const DesignTool& entry, const nlohmann::json& args); @@ -129,32 +130,32 @@ const DesignTool* opened_item(const DesignTool& entry, const nlohmann::json& arg // Whether the Design tab offers entry `t` in the mode it is in, `sketching` being the right-click menu's // DesignPanel::sketch_map_applies(): an entry of the sketch's vocabulary in a sketch, one of the model's // outside it, as the menu offers them. A sketch in Constrain mode is a sketch to the menu, though the tab's keys -// there are the model's. Only then is its tile shown and its person's form run. +// there are the model's. Only then is its Speed Dial action shown and its person's form run. bool offered_in_mode(const DesignTool& t, bool sketching); -// A Speed Dial tile of the Design tab: `command`'s own (`tile` null), or the item of command->tiles that a menu item -// folded into it has. -struct DesignTile +// A Speed Dial action of the Design tab: `command`'s own (`action` null), or the item of command->actions that a menu +// item folded into it has. +struct DesignAction { const NativeCommand* command; - const nlohmann::json* tile; + const nlohmann::json* action; }; -// The Speed Dial tiles the Design tab has while it is shown in the mode `sketching` names (as offered_in_mode() -// takes it): one per entry of the Design table with an action offered in that mode, in the table's order, whose +// The Speed Dial actions the Design tab has while it is shown in the mode `sketching` names (as offered_in_mode() +// takes it): one per entry of the Design table with a handler offered in that mode, in the table's order, whose // command `catalog` holds: a folded item's runs the command it is folded into with the item's args. None while the // CAD feature is off (`cad_on` false): the tab stays until a restart, but cad_gate() would refuse every pick of -// its tiles. -std::vector design_tiles(const CommandCatalog& catalog, bool sketching, bool cad_on); +// its actions. +std::vector design_actions(const CommandCatalog& catalog, bool sketching, bool cad_on); -// Why the person's form of entry `t` is refused before its action runs, or nothing: `t` is not offered in the +// Why the person's form of entry `t` is refused before its handler runs, or nothing: `t` is not offered in the // tab's mode (offered_in_mode()), and the message says which mode it belongs to and what to do; or `t`'s -// action is a btn: or fly: one, which the menu greys for a selection it does not accept, `t` accepts a kind the +// handler is a btn: or fly: one, which the menu greys for a selection it does not accept, `t` accepts a kind the // tab reports as the selection in its mode, and selection `kind` (OfferSel as int) is not one it accepts, and the // details name the selection and those it accepts. An item that accepts no kind the tab reports there opens as its -// toolbar button does, and a key: action runs whatever is selected, as its key does. With `row_target`, a call that -// targets the Feature list's selected row (nothing picked in the view), an item whose action acts on that row -// (DesignTool::feature_row) is not refused for the selection: its action says itself what it cannot do. The message +// toolbar button does, and a key: handler runs whatever is selected, as its key does. With `row_target`, a call that +// targets the Feature list's selected row (nothing picked in the view), an item whose handler acts on that row +// (DesignTool::feature_row) is not refused for the selection: its handler says itself what it cannot do. The message // is a msgid, the code -32000. std::optional open_refusal(const DesignTool& t, bool sketching, int kind, bool row_target = false); diff --git a/src/slic3r/GUI/Mcp/McpToolsCommon.cpp b/src/slic3r/GUI/Mcp/McpToolsCommon.cpp index a5b388416b..c2c3c16c54 100644 --- a/src/slic3r/GUI/Mcp/McpToolsCommon.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsCommon.cpp @@ -88,12 +88,12 @@ NativeCommand mutate_tool(std::string name, std::string title, std::string descr return d; } -NativeCommand menu_command(std::string name, std::string title, std::string description, json schema, json tiles, +NativeCommand menu_command(std::string name, std::string title, std::string description, json schema, json actions, std::function fn) { NativeCommand d = NativeCommands::ui_command(std::move(name), std::move(title), {}, std::move(schema), std::move(fn)); d.description = std::move(description); - d.tiles = std::move(tiles); + d.actions = std::move(actions); d.listed = true; return d; } diff --git a/src/slic3r/GUI/Mcp/McpToolsConfig.cpp b/src/slic3r/GUI/Mcp/McpToolsConfig.cpp index e79c21ad6c..73999c1481 100644 --- a/src/slic3r/GUI/Mcp/McpToolsConfig.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsConfig.cpp @@ -1011,8 +1011,8 @@ AppActionRunResult filament_delete_command(const json& args) return filament_reply(format_wxstr(_L("Deleted filament slot %1%."), deleted.value().filament_slot), std::move(reply)); } -// filament_sync_ams: with no arguments, as its tile, the sync dialog's run, which asks and warns; with mode, the sync -// with that choice of the dialog, which opens nothing. Reply: each slot's preset and colour afterwards. +// filament_sync_ams: with no arguments, as its Speed Dial action, the sync dialog's run, which asks and warns; with +// mode, the sync with that choice of the dialog, which opens nothing. Reply: each slot's preset and colour afterwards. AppActionRunResult sync_ams_command(const json& args) { if (!args.contains("mode")) @@ -3312,63 +3312,64 @@ void register_config_tools(CommandCatalog& catalog) [](const json& args, ToolContext& ctx) { return ToolResult::ok(ctx.run_ui([&] { return list_plates(args); })); })); // The plate commands made from menu items: each acts on the plate the call names, else on the current plate, as its item - // does, and its reply names the plate. A command named as its item is that item's tile, in the Speed Dial's section + // does, and its reply names the plate. A command named as its item is that item's action, in the Speed Dial's section // `section`. - const auto own_tile = [](NativeCommand command, std::string section, std::string icon) { - command.in_palette = true; - command.tile_group = std::move(section); - command.icon = std::move(icon); + const auto own_action = [](NativeCommand command, std::string section, std::string icon) { + command.has_own_action = true; + command.action_group = std::move(section); + command.icon = std::move(icon); return command; }; const std::string plates_after = "plates (each plate afterwards: index, name and objects, how many stand on it) and current " "(the current plate)"; - catalog.add(own_tile(menu_command("plate_add", L("Add Plate"), "Add a plate.", object_schema({}), json(), - [](const json&) { return MenuItems::plate_add(); }), - L("Plate"), "toolbar_add_plate")); + catalog.add(own_action(menu_command("plate_add", L("Add Plate"), "Add a plate.", object_schema({}), json(), + [](const json&) { return MenuItems::plate_add(); }), + L("Plate"), "toolbar_add_plate")); catalog.add(reaching({"delete_plate"}, - own_tile(menu_command("plate_delete", L("Delete Plate"), - "Delete a plate (plate, else the current one), as Delete Plate does. The objects on it " - "stay in the project, outside the plates, and the plates after it move down one. The " - "only plate is refused. One undo step. Reply: plate (the index it had), " + - plates_after + ".", - object_schema({{"plate", plate_prop}}), json(), plate_delete_command), - L("Plate"), "delete"))); + own_action(menu_command("plate_delete", L("Delete Plate"), + "Delete a plate (plate, else the current one), as Delete Plate does. The objects on it " + "stay in the project, outside the plates, and the plates after it move down one. The " + "only plate is refused. One undo step. Reply: plate (the index it had), " + + plates_after + ".", + object_schema({{"plate", plate_prop}}), json(), plate_delete_command), + L("Plate"), "delete"))); catalog.add(reaching({"duplicate_plate"}, - own_tile(menu_command("plate_duplicate", L("Duplicate Plate"), - "Add a plate with a copy of each object on the plate (plate, else the current one), " - "placed on it as on that plate, as Duplicate Current Plate does. The new " - "plate comes last, and the current plate stays current. Refused when the project " - "holds as many plates as it can, and while slicing. One undo step. Reply: plate (the " - "plate copied), new_plate (the new plate's index), " + - plates_after + ".", - object_schema({{"plate", plate_prop}}), json(), plate_duplicate_command), - L("Plate"), "menu_copy"))); - // The name dialog's name, which every call but the tile's gives. - NativeCommand rename = own_tile(menu_command("plate_rename", L("Rename Plate"), - "Name a plate (plate, else the current one), as its name icon does: a plate other " - "than the current one is made current first. name \"\" leaves it unnamed. With no " - "arguments, as its tile, the name dialog asks for the current plate's name " - "(blocked_by_dialog), and a cancelled dialog renames nothing, which the call is " - "told. The name is one undo step; the name the plate has already changes nothing, " - "the current plate included. Reply: plate and name.", - object_schema({{"plate", plate_prop}, - {"name", prop("string", "The plate's name, in place of the name dialog.")}}, - {"name"}), - json(), plate_rename_command), - L("Plate"), "plate_name_edit"); + own_action(menu_command("plate_duplicate", L("Duplicate Plate"), + "Add a plate with a copy of each object on the plate (plate, else the current one), " + "placed on it as on that plate, as Duplicate Current Plate does. The new " + "plate comes last, and the current plate stays current. Refused when the project " + "holds as many plates as it can, and while slicing. One undo step. Reply: plate (the " + "plate copied), new_plate (the new plate's index), " + + plates_after + ".", + object_schema({{"plate", plate_prop}}), json(), plate_duplicate_command), + L("Plate"), "menu_copy"))); + // The name dialog's name, which every call but the action's gives. + NativeCommand rename = own_action(menu_command("plate_rename", L("Rename Plate"), + "Name a plate (plate, else the current one), as its name icon does: a plate other " + "than the current one is made current first. name \"\" leaves it unnamed. With no " + "arguments, as its Speed Dial action, the name dialog asks for the current plate's " + "name (blocked_by_dialog), and a cancelled dialog renames nothing, which the call " + "is told. The name is one undo step; the name the plate has already changes " + "nothing, the current plate included. Reply: plate and name.", + object_schema({{"plate", plate_prop}, + {"name", prop("string", "The plate's name, in place of " + "the name dialog.")}}, + {"name"}), + json(), plate_rename_command), + L("Plate"), "plate_name_edit"); rename.input_schema = with_silent(std::move(rename.input_schema), person_forms(rename)); catalog.add(reaching({"rename_plate", "select_plate"}, std::move(rename))); catalog.add(reaching( {"set_plate_locked"}, menu_command("plate_lock", L("Toggle Plate Lock"), "Lock or unlock a plate (plate, else the current one), as its lock icon does: locked true locks it and false " - "unlocks it; without locked it toggles, as its tile does. An arrange of every plate leaves a locked one as " - "it is. One undo step, none when the plate is in that state already. Reply: plate, locked, and changed " - "(false when it was so already).", + "unlocks it; without locked it toggles, as its Speed Dial action does. An arrange of every plate leaves a " + "locked one as it is. One undo step, none when the plate is in that state already. Reply: plate, locked, and " + "changed (false when it was so already).", object_schema({{"plate", plate_prop}, {"locked", prop("boolean", "true locks the plate, false unlocks it. Default: the other state.")}}), - json::array({NativeCommands::tile("plate_toggle_lock", L("Toggle Plate Lock"), L("Plate"), "lock_normal", json::object(), - "Lock or unlock the current plate.")}), + json::array({NativeCommands::action("plate_toggle_lock", L("Toggle Plate Lock"), L("Plate"), "lock_normal", + json::object(), "Lock or unlock the current plate.")}), plate_lock_command))); catalog.add(reaching( {"select_plate"}, @@ -3376,12 +3377,12 @@ void register_config_tools(CommandCatalog& catalog) "Make a plate the current one, as a click on it does: plate; without it, the current plate stays current. " "An index the project lacks is an error. Reply: plate.", object_schema({{"plate", plate_prop}}), - json::array({NativeCommands::tile("plate_goto", L("Go to Plate"), L("Plate"), "go_next_plate", {{"plate", 0}}, - "Make the first plate the current one.")}), + json::array({NativeCommands::action("plate_goto", L("Go to Plate"), L("Plate"), "go_next_plate", {{"plate", 0}}, + "Make the first plate the current one.")}), plate_select_command))); // ---- The presets and settings commands made from menu items ---- - using NativeCommands::tile; + using NativeCommands::action; const std::string preset_file = "a preset .json, a .zip of them, an .orca_printer, .orca_filament or .orca_bundle, or a .gcode"; const std::string imported = "and the message names the presets imported, replaced and kept; a .gcode loads the settings it was " "sliced with."; @@ -3393,9 +3394,9 @@ void register_config_tools(CommandCatalog& catalog) object_schema({{"path", MenuItems::input_file(preset_file.c_str())}, {"on_conflict", enum_prop({"skip", "overwrite"}, "What happens to a preset that exists already. Default skip.")}}, {"path"}), - json::array({tile("import_configs", L("Import Configs"), L("Import"), "menu_open", json::object(), - "Import presets from the file a dialog asks for. preset_import with a path imports " + preset_file + - " without a dialog, " + imported)}), + json::array({action("import_configs", L("Import Configs"), L("Import"), "menu_open", json::object(), + "Import presets from the file a dialog asks for. preset_import with a path imports " + preset_file + + " without a dialog, " + imported)}), [](const json& args) { return MenuItems::import_configs(args); })); import_configs.input_schema = with_silent(std::move(import_configs.input_schema), person_forms(import_configs)); catalog.add(std::move(import_configs)); @@ -3409,16 +3410,16 @@ void register_config_tools(CommandCatalog& catalog) export_dialog + " Every call opens the dialog (blocked_by_dialog). With path, OK writes into that folder instead of " "asking for one, and a cancelled dialog is an error: nothing was exported.", object_schema({{"path", prop("string", "Absolute path of an existing folder, which the dialog's OK writes into.")}}), - json::array({tile("export_config", L("Export Preset Bundle"), L("Export"), "save", json::object(), - export_dialog + " preset_export with a folder as path has OK write there instead of asking for one.")}), + json::array({action("export_config", L("Export Preset Bundle"), L("Export"), "save", json::object(), + export_dialog + " preset_export with a folder as path has OK write there instead of asking for one.")}), [](const json& args) { return MenuItems::export_config(args); })); const std::string sync = "Synchronize user presets with the cloud account."; NativeCommand preset_sync = reaching({"sync_presets"}, menu_command("preset_sync", L("Sync Presets"), sync + " Refused while no account is signed in.", object_schema({}), - json::array({tile("sync_presets", L("Sync Presets"), L("Presets"), "printer_sync_ok", - json::object(), sync)}), + json::array({action("sync_presets", L("Sync Presets"), L("Presets"), "printer_sync_ok", + json::object(), sync)}), preset_sync_command)); // It reaches the cloud account. preset_sync.open_world = true; @@ -3426,8 +3427,8 @@ void register_config_tools(CommandCatalog& catalog) const std::string migrate = "Migrate legacy user filament presets."; catalog.add(menu_command("preset_migrate_filaments", L("Migrate Filament Presets"), migrate, object_schema({}), - json::array({tile("help_migrate_filament_presets", L("Migrate Filament Presets"), L("Help"), "", - json::object(), migrate)}), + json::array({action("help_migrate_filament_presets", L("Migrate Filament Presets"), L("Help"), "", + json::object(), migrate)}), [](const json&) { return MenuItems::migrate_filament_presets(); })); // The Mode menu items; titles are L("...")-marked here so xgettext extracts them. @@ -3441,20 +3442,20 @@ void register_config_tools(CommandCatalog& catalog) static const ModeMenuItem mode_menu_items[] = {{"mode_simple", L("Mode: Simple"), "simple", "Simple"}, {"mode_advanced", L("Mode: Advanced"), "advanced", "Advanced"}, {"mode_expert", L("Mode: Expert"), "expert", "Expert"}}; - json mode_tiles = json::array(); + json mode_actions = json::array(); for (const ModeMenuItem& item : mode_menu_items) - mode_tiles.push_back(tile(item.key, item.title, L("Mode"), "advanced", {{"mode", item.mode}}, - std::string("Switch the settings view to ") + item.name + " mode.")); + mode_actions.push_back(action(item.key, item.title, L("Mode"), "advanced", {{"mode", item.mode}}, + std::string("Switch the settings view to ") + item.name + " mode.")); catalog.add(menu_command("settings_set_mode", L("Set the settings mode"), "Switch the settings view to Simple, Advanced or Expert mode, which decides which settings the settings " "pages show.", object_schema({{"mode", enum_prop({"simple", "advanced", "expert"}, "The mode.")}}, {"mode"}), - std::move(mode_tiles), [](const json& args) { return MenuItems::set_mode(arg_string(args, "mode")); })); + std::move(mode_actions), [](const json& args) { return MenuItems::set_mode(arg_string(args, "mode")); })); const std::string developer = "Turn Developer mode on or off."; NativeCommand developer_mode = menu_command("settings_toggle_developer_mode", L("Toggle Developer Mode"), developer, object_schema({}), - json::array({tile("toggle_developer_mode", L("Toggle Developer Mode"), L("Mode"), - "advanced", json::object(), developer)}), + json::array({action("toggle_developer_mode", L("Toggle Developer Mode"), L("Mode"), + "advanced", json::object(), developer)}), [](const json&) { return MenuItems::toggle_developer_mode(); }); // A menu item with no argument form: tool_search finds it and tool_call runs it, the tool list does not show it. developer_mode.listed = false; @@ -3465,34 +3466,34 @@ void register_config_tools(CommandCatalog& catalog) // Dial's section Filament. const std::string slot_buttons = "Refused for a printer that has one filament per extruder, which shows no + and - buttons."; catalog.add(reaching({"add_filament_slot"}, - own_tile(menu_command("filament_add", L("Add Filament Slot"), - "Add a filament slot, as the + button above the filament list does. It takes the next " - "colour and the last slot's preset (change them with preset_select filament_slot and " - "project_set_settings filament_colour). It goes after the physical slots: mixed " - "filaments move up by one, and objects on them follow. " + - slot_buttons + " Reply: filament_slot (the new slot) and filament_slots (how many the " - "project has).", - object_schema({}), json(), filament_add_command), - L("Filament"), "add_filament"))); + own_action(menu_command("filament_add", L("Add Filament Slot"), + "Add a filament slot, as the + button above the filament list does. It takes the next " + "colour and the last slot's preset (change them with preset_select filament_slot and " + "project_set_settings filament_colour). It goes after the physical slots: mixed " + "filaments move up by one, and objects on them follow. " + + slot_buttons + " Reply: filament_slot (the new slot) and filament_slots (how many the " + "project has).", + object_schema({}), json(), filament_add_command), + L("Filament"), "add_filament"))); catalog.add(reaching( {"delete_filament_slot"}, - own_tile(menu_command("filament_delete", L("Delete Filament Slot"), - "Delete a filament slot, as its Delete menu item does, the objects on it taking the first filament; " - "with merge_into, as its Merge with item does, the objects on it taking that slot. The slots after " - "it move down by one. The only physical slot and a mixed filament (project_get_settings " - "filament_is_mixed) are refused, and so is a merge into a mixed filament that mixes the slot. " + - slot_buttons + " Not in the undo history. Reply: filament_slot (the slot deleted), merged_into " - "(the slot its objects went to, as numbered afterwards) and filament_slots.", - object_schema({{"filament_slot", {{"type", "integer"}, - {"minimum", 1}, - {"description", "The 1-based filament slot. Default: the last " - "physical slot, as the - button."}}}, - {"merge_into", {{"type", "integer"}, - {"minimum", 1}, - {"description", "The 1-based slot the objects on it go to, as Merge " - "with does. Default: they take the first filament."}}}}), - json(), filament_delete_command), - L("Filament"), "delete_filament"))); + own_action(menu_command("filament_delete", L("Delete Filament Slot"), + "Delete a filament slot, as its Delete menu item does, the objects on it taking the first filament; " + "with merge_into, as its Merge with item does, the objects on it taking that slot. The slots after " + "it move down by one. The only physical slot and a mixed filament (project_get_settings " + "filament_is_mixed) are refused, and so is a merge into a mixed filament that mixes the slot. " + + slot_buttons + " Not in the undo history. Reply: filament_slot (the slot deleted), merged_into " + "(the slot its objects went to, as numbered afterwards) and filament_slots.", + object_schema({{"filament_slot", {{"type", "integer"}, + {"minimum", 1}, + {"description", "The 1-based filament slot. Default: the last " + "physical slot, as the - button."}}}, + {"merge_into", {{"type", "integer"}, + {"minimum", 1}, + {"description", "The 1-based slot the objects on it go to, as Merge " + "with does. Default: they take the first filament."}}}}), + json(), filament_delete_command), + L("Filament"), "delete_filament"))); NativeCommand mixed = reaching( {"add_mixed_filament"}, @@ -3541,13 +3542,13 @@ void register_config_tools(CommandCatalog& catalog) ams + " With mode, as the sync dialog's Synchronize now does with that choice, without the dialog: map maps " "each of the project's filaments to a slot, as the dialog's Mapping first does, which takes a project " "with objects; overwrite replaces the filament list with the slots' filaments. Called with no arguments, " - "as its tile, it opens the sync dialog where the project has objects (blocked_by_dialog), and a warning " - "where it cannot sync. With no printer connected, no AMS or no filament it is refused, saying so. Not in " - "the undo history. Reply: mode, filaments (each slot's preset and colour afterwards) and " + "as its Speed Dial action, it opens the sync dialog where the project has objects (blocked_by_dialog), and " + "a warning where it cannot sync. With no printer connected, no AMS or no filament it is refused, saying so. " + "Not in the undo history. Reply: mode, filaments (each slot's preset and colour afterwards) and " "mapped_to_generic (slots whose filament is unknown, mapped to a generic preset).", object_schema({{"mode", enum_prop({"map", "overwrite"}, "The sync dialog's choice: map or overwrite.")}}), - json::array({tile("sync_ams", L("Synchronize Filament List from AMS"), L("Printer"), "ams_fila_sync", json::object(), - ams)}), + json::array({action("sync_ams", L("Synchronize Filament List from AMS"), L("Printer"), "ams_fila_sync", json::object(), + ams)}), sync_ams_command)); // It reads the connected printer's AMS. sync_ams.open_world = true; @@ -3561,8 +3562,8 @@ void register_config_tools(CommandCatalog& catalog) "print host, or one that prints through the Bambu network or printer agents."; NativeCommand printer_send = reaching({"send_gcode_to_host"}, menu_command("printer_send", L("Send G-code to printer host"), send, object_schema({}), - json::array({tile("send_gcode", L("Send G-code to printer host"), - L("Slice & Export"), "printer", json::object(), send)}), + json::array({action("send_gcode", L("Send G-code to printer host"), + L("Slice & Export"), "printer", json::object(), send)}), [](const json&) { return MenuItems::send_gcode(); })); // It uploads to the printer's print host. printer_send.open_world = true; diff --git a/src/slic3r/GUI/Mcp/McpToolsPlugins.cpp b/src/slic3r/GUI/Mcp/McpToolsPlugins.cpp index afb4dd0465..8c91bc2d52 100644 --- a/src/slic3r/GUI/Mcp/McpToolsPlugins.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsPlugins.cpp @@ -270,7 +270,7 @@ ToolFailure plugin_refusal_after(const Ops::Refusal& refusal, const json& before void register_plugin_tools(CommandCatalog& catalog) { - using NativeCommands::tile; + using NativeCommands::action; const json plugin_prop = prop("string", "The plugin's key, as plugin_list gives it, or its name where one plugin has it."); NativeCommand list = inspect_tool( @@ -287,7 +287,7 @@ void register_plugin_tools(CommandCatalog& catalog) {"title": "List the plugins and how each stands", "calls": [{"tool": "plugin_list", "args": {}}]}])json"); catalog.add(std::move(list)); - // The file its dialog asks for, which every call but the tile's gives. + // The file its dialog asks for, which every call but the action's gives. const std::string replacing = "A plugin of that name installed already is replaced only with overwrite true; without it the " "call is refused with the question the dialog asks."; NativeCommand local = menu_command( @@ -298,10 +298,10 @@ void register_plugin_tools(CommandCatalog& catalog) object_schema({{"path", MenuItems::input_file("a .py or .whl plugin package")}, {"overwrite", prop("boolean", "Replace a plugin of that name installed already. Default false.")}}, {"path"}), - json::array({tile("install_local_plugin", L("Install Local Plugin"), L("Plugins"), "", json::object(), - "Install a plugin from the .py or .whl file a dialog asks for, as the Plugins dialog's Install local " - "plugin does, asking before it replaces one installed; plugin_install_local with a path installs that " - "file without a dialog. " + replacing)}), + json::array({action("install_local_plugin", L("Install Local Plugin"), L("Plugins"), "", json::object(), + "Install a plugin from the .py or .whl file a dialog asks for, as the Plugins dialog's Install local " + "plugin does, asking before it replaces one installed; plugin_install_local with a path installs that " + "file without a dialog. " + replacing)}), [](const json& args) { return MenuItems::install_local_plugin(args); }); local.input_schema = with_silent(std::move(local.input_schema), person_forms(local)); catalog.add(std::move(local)); @@ -385,8 +385,8 @@ void register_plugin_tools(CommandCatalog& catalog) refresh_command.cancellable = true; // It fetches the plugin hub's list. refresh_command.open_world = true; - refresh_command.tiles = - json::array({tile("refresh_plugins", L("Refresh Plugins"), L("Plugins"), "", json::object(), "Reload plugins.")}); + refresh_command.actions = + json::array({action("refresh_plugins", L("Refresh Plugins"), L("Plugins"), "", json::object(), "Reload plugins.")}); // A person's pick starts the refresh and returns, its notification saying how it went; a call waits for it. catalog.add(NativeCommands::with_menu_item_forms( std::move(refresh_command), [](const json&) { return MenuItems::refresh_plugins(); }, /*person_form_behind_dialogs=*/false, diff --git a/src/slic3r/GUI/Mcp/McpToolsProject.cpp b/src/slic3r/GUI/Mcp/McpToolsProject.cpp index 863dd05018..4e0314a935 100644 --- a/src/slic3r/GUI/Mcp/McpToolsProject.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsProject.cpp @@ -1,5 +1,5 @@ // project_new, project_open, project_import, project_save and project_export: the project's files in and out without -// file dialogs, and called as their menu items' tiles, with them. calibration_generate_test: the Calibration menu's +// file dialogs, and called as their menu items' actions, with them. calibration_generate_test: the Calibration menu's // tests, which start a new project. #include "slic3r/GUI/I18N.hpp" @@ -441,10 +441,10 @@ void register_project_tools(CommandCatalog& catalog) settle(ctx); return ToolResult::ok(out); })); - open.tiles = json::array({NativeCommands::tile("load_project", L("Load Project"), L("Commands"), "menu_open", json::object(), - "Open a project through the Open dialog (it asks first if the current project " - "has unsaved changes); project_open with a path opens that file without a " - "dialog.")}); + open.actions = json::array({NativeCommands::action("load_project", L("Load Project"), L("Commands"), "menu_open", json::object(), + "Open a project through the Open dialog (it asks first if the current project " + "has unsaved changes); project_open with a path opens that file without a " + "dialog.")}); catalog.add(NativeCommands::with_person_form(std::move(open), [](const json&) { return MenuItems::load_project(); })); NativeCommand import_ = reaching({"import_models"}, mutate_tool( @@ -517,18 +517,18 @@ void register_project_tools(CommandCatalog& catalog) settle(ctx); return ToolResult::ok(out); })); - import_.tiles = json::array( - {NativeCommands::tile("import_file", L("Import 3MF/STL/STEP/SVG/OBJ/AMF"), L("Import"), "menu_open", json::object(), - "Import models (3MF/STL/STEP/SVG/OBJ/AMF) through a file dialog, as one undo step; a project " - "file's settings are not loaded (project_open opens a project). project_import with paths adds " - "files' geometry without a dialog."), - NativeCommands::tile("import_zip_archive", L("Import ZIP Archive"), L("Import"), "menu_open", {{"archive", true}}, - "Import models from a ZIP archive (opens a file dialog).")}); - catalog.add(NativeCommands::with_person_form(std::move(import_), [](const json& tile_args) { - return tile_args.value("archive", false) ? MenuItems::import_zip_archive() : MenuItems::import_file(); + import_.actions = json::array( + {NativeCommands::action("import_file", L("Import 3MF/STL/STEP/SVG/OBJ/AMF"), L("Import"), "menu_open", json::object(), + "Import models (3MF/STL/STEP/SVG/OBJ/AMF) through a file dialog, as one undo step; a project " + "file's settings are not loaded (project_open opens a project). project_import with paths adds " + "files' geometry without a dialog."), + NativeCommands::action("import_zip_archive", L("Import ZIP Archive"), L("Import"), "menu_open", {{"archive", true}}, + "Import models from a ZIP archive (opens a file dialog).")}); + catalog.add(NativeCommands::with_person_form(std::move(import_), [](const json& action_args) { + return action_args.value("archive", false) ? MenuItems::import_zip_archive() : MenuItems::import_file(); })); - // New Project's menu item is its tile: with no arguments it asks as the item does. + // New Project's menu item is its action: with no arguments it asks as the item does. NativeCommand project_new = reaching({"new_project"}, mutate_tool( "project_new", L("New Project"), "Start a new, empty project. Called with no arguments, it asks as New Project does, about the unsaved changes " @@ -562,9 +562,9 @@ void register_project_tools(CommandCatalog& catalog) settle(ctx); return ToolResult::ok(out); })); - project_new.tiles = json::array({NativeCommands::tile("new_project", L("New Project"), L("Commands"), "menu_open", json::object(), - "Runs project_new with no arguments, as New Project does: a new, empty " - "project, after asking about the unsaved changes if there are any.")}); + project_new.actions = json::array({NativeCommands::action("new_project", L("New Project"), L("Commands"), "menu_open", json::object(), + "Runs project_new with no arguments, as New Project does: a new, empty " + "project, after asking about the unsaved changes if there are any.")}); catalog.add(NativeCommands::with_person_form(std::move(project_new), [](const json&) { if (Plater* plater = wxGetApp().plater()) plater->new_project(); @@ -723,7 +723,7 @@ void register_project_tools(CommandCatalog& catalog) return ToolResult::ok(out); }); // The Calibration menu's items, each the dialog of its test. The tab strip's calib_sf glyph is drawn white for the dark - // tab bar and vanishes on the palette's light tile, so each item borrows the matching settings-group icon instead. + // tab bar and vanishes on the Speed Dial's light tile, so each item borrows the matching settings-group icon instead. struct CalibrationMenuItem { const char* key; @@ -748,22 +748,22 @@ void register_project_tools(CommandCatalog& catalog) CalibKind::InputShapingDamp}, {"calib_vfa", L("VFA Calibration"), "param_speed", "vfa", CalibKind::VFA}, }; - calibration.tiles = json::array(); + calibration.actions = json::array(); for (const CalibrationMenuItem& item : calibration_menu_items) - calibration.tiles.push_back(NativeCommands::tile(item.key, item.title, L("Calibration"), item.icon, {{"test", item.test}}, - std::string("Open the ") + item.title + - " dialog; calibration_generate_test with the test's parameters, or " - "silent, runs it with no dialog.")); - catalog.add(NativeCommands::with_person_form(std::move(calibration), [](const json& tile_args) { - const std::string test = tile_args.at("test"); + calibration.actions.push_back(NativeCommands::action(item.key, item.title, L("Calibration"), item.icon, {{"test", item.test}}, + std::string("Open the ") + item.title + + " dialog; calibration_generate_test with the test's parameters, or " + "silent, runs it with no dialog.")); + catalog.add(NativeCommands::with_person_form(std::move(calibration), [](const json& action_args) { + const std::string test = action_args.at("test"); for (const CalibrationMenuItem& item : calibration_menu_items) if (test == item.test) return MenuItems::calib(item.kind); return AppActionRunResult{AppActionRunResult::Level::Error, from_u8("Unknown test \"" + test + "\""), false}; })); - // Save Project's and Save Project As's menu items are its tiles: with no arguments, or with save_as alone, it saves as the - // item does. + // Save Project's and Save Project As's menu items are its actions: with no arguments, or with save_as alone, it saves as + // the item does. NativeCommand save = reaching({"save_project_as"}, mutate_tool( "project_save", L("Save Project"), "Save the project. Called with no arguments, it saves as Save Project does: to the project's file (reply: ran, " @@ -797,22 +797,22 @@ void register_project_tools(CommandCatalog& catalog) settle(ctx); return ToolResult::ok({{"path", path_to_utf8(*path)}, {"bytes", fs::file_size(*path)}}); })); - save.tiles = json::array( - {NativeCommands::tile("save_project", L("Save Project"), L("Commands"), "menu_save", json::object(), - "Runs project_save with no arguments, as Save Project does: to the project's file, or through a " - "file dialog when it has none."), - NativeCommands::tile("save_project_as", L("Save Project As"), L("Commands"), "menu_save", {{"save_as", true}}, - "Save the project as a .3mf file through the save dialog. project_save with a path saves there " - "without a dialog; a name ending in .gcode.3mf is refused (project_export {format: \"sliced_3mf\"} " - "writes that).")}); - save = NativeCommands::with_person_form(std::move(save), [](const json& tile_args) { - if (tile_args.value("save_as", false)) + save.actions = json::array( + {NativeCommands::action("save_project", L("Save Project"), L("Commands"), "menu_save", json::object(), + "Runs project_save with no arguments, as Save Project does: to the project's file, or through a " + "file dialog when it has none."), + NativeCommands::action("save_project_as", L("Save Project As"), L("Commands"), "menu_save", {{"save_as", true}}, + "Save the project as a .3mf file through the save dialog. project_save with a path saves there " + "without a dialog; a name ending in .gcode.3mf is refused (project_export {format: \"sliced_3mf\"} " + "writes that).")}); + save = NativeCommands::with_person_form(std::move(save), [](const json& action_args) { + if (action_args.value("save_as", false)) return MenuItems::save_project_as(); if (Plater* plater = wxGetApp().plater()) return NativeCommands::project_save_result(plater->save_project(false)); return AppActionRunResult{AppActionRunResult::Level::Succeeded}; }); - // Every call but the two tiles' requires path, and a call with path skips the file dialog: silent has nothing to add. + // Every call but the two actions' requires path, and a call with path skips the file dialog: silent has nothing to add. save.input_schema["properties"]["silent"]["description"] = "Goes with path, which every call but {} and {save_as: true} requires, and adds nothing to it: a call with path skips " "the file dialog already."; @@ -947,41 +947,43 @@ void register_project_tools(CommandCatalog& catalog) return ToolResult::ok(reply); }))); // The File > Export menu items, each with the dialog it asks for the file or folder in. - export_.tiles = json::array({ - NativeCommands::tile("export_gcode", L("Export G-code"), L("Slice & Export"), "custom-gcode_gcode", {{"format", "gcode"}}, - "Export the current plate's G-code through the export dialog, in the background. project_export " - "with a path exports the sliced plate there without a dialog, and the call returns when the file " - "is written; a plate that is not sliced is refused (slice first)."), - NativeCommands::tile("export_sliced_file", L("Export Sliced File"), L("Slice & Export"), "save", {{"format", "sliced_3mf"}}, - "Export the current plate's sliced file (.gcode.3mf) through a file dialog; project_export with a " - "path writes there without one."), - NativeCommands::tile("export_all_sliced_file", L("Export All Sliced Files"), L("Slice & Export"), "save", - {{"format", "sliced_3mf"}, {"plates", "all"}}, - "Export every plate's sliced file into one .gcode.3mf through a file dialog; project_export with a " - "path writes there without one."), - NativeCommands::tile("export_3mf", L("Export 3MF"), L("Slice & Export"), "menu_save", {{"format", "3mf"}}, - "Export the model as a .3mf without slicing data, through a file dialog; project_export with a path " - "writes there without one."), - NativeCommands::tile("export_stl", L("Export STL"), L("Slice & Export"), "save", {{"format", "stl"}}, - "Export all objects as one STL through a file dialog; project_export with a path writes there " - "without one."), - NativeCommands::tile("export_stl_multi", L("Export All Objects as STLs"), L("Export"), "save", {{"format", "stl"}, {"per_object", true}}, - "Export each object as its own STL into the folder a dialog asks for; project_export with a folder " - "as path writes there without one."), - NativeCommands::tile("export_drc_single", L("Export All Objects as DRC (one file)"), L("Export"), "save", {{"format", "drc"}}, - "Export all objects as one Draco (.drc) file."), - NativeCommands::tile("export_drc_multi", L("Export All Objects as DRCs"), L("Export"), "save", {{"format", "drc"}, {"per_object", true}}, - "Export each object as its own Draco (.drc) file."), - NativeCommands::tile("export_toolpaths_obj", L("Export Toolpaths as OBJ"), L("Export"), "custom-gcode_gcode", - {{"format", "toolpaths_obj"}}, "Export the sliced toolpaths as an OBJ."), + export_.actions = json::array({ + NativeCommands::action("export_gcode", L("Export G-code"), L("Slice & Export"), "custom-gcode_gcode", {{"format", "gcode"}}, + "Export the current plate's G-code through the export dialog, in the background. project_export " + "with a path exports the sliced plate there without a dialog, and the call returns when the file " + "is written; a plate that is not sliced is refused (slice first)."), + NativeCommands::action("export_sliced_file", L("Export Sliced File"), L("Slice & Export"), "save", {{"format", "sliced_3mf"}}, + "Export the current plate's sliced file (.gcode.3mf) through a file dialog; project_export with a " + "path writes there without one."), + NativeCommands::action("export_all_sliced_file", L("Export All Sliced Files"), L("Slice & Export"), "save", + {{"format", "sliced_3mf"}, {"plates", "all"}}, + "Export every plate's sliced file into one .gcode.3mf through a file dialog; project_export with a " + "path writes there without one."), + NativeCommands::action("export_3mf", L("Export 3MF"), L("Slice & Export"), "menu_save", {{"format", "3mf"}}, + "Export the model as a .3mf without slicing data, through a file dialog; project_export with a path " + "writes there without one."), + NativeCommands::action("export_stl", L("Export STL"), L("Slice & Export"), "save", {{"format", "stl"}}, + "Export all objects as one STL through a file dialog; project_export with a path writes there " + "without one."), + NativeCommands::action("export_stl_multi", L("Export All Objects as STLs"), L("Export"), "save", + {{"format", "stl"}, {"per_object", true}}, + "Export each object as its own STL into the folder a dialog asks for; project_export with a folder " + "as path writes there without one."), + NativeCommands::action("export_drc_single", L("Export All Objects as DRC (one file)"), L("Export"), "save", {{"format", "drc"}}, + "Export all objects as one Draco (.drc) file."), + NativeCommands::action("export_drc_multi", L("Export All Objects as DRCs"), L("Export"), "save", + {{"format", "drc"}, {"per_object", true}}, + "Export each object as its own Draco (.drc) file."), + NativeCommands::action("export_toolpaths_obj", L("Export Toolpaths as OBJ"), L("Export"), "custom-gcode_gcode", + {{"format", "toolpaths_obj"}}, "Export the sliced toolpaths as an OBJ."), }); - catalog.add(NativeCommands::with_person_form(std::move(export_), [](const json& tile_args) { - const std::string format = tile_args.at("format"); - const bool per_object = tile_args.value("per_object", false); + catalog.add(NativeCommands::with_person_form(std::move(export_), [](const json& action_args) { + const std::string format = action_args.at("format"); + const bool per_object = action_args.value("per_object", false); if (format == "gcode") return MenuItems::export_gcode(); if (format == "sliced_3mf") - return MenuItems::export_sliced_file(tile_args.value("plates", std::string()) == "all"); + return MenuItems::export_sliced_file(action_args.value("plates", std::string()) == "all"); if (format == "3mf") return MenuItems::export_3mf(); if (format == "stl") diff --git a/src/slic3r/GUI/Mcp/McpToolsPython.cpp b/src/slic3r/GUI/Mcp/McpToolsPython.cpp index 6a809e3078..3364a7afe5 100644 --- a/src/slic3r/GUI/Mcp/McpToolsPython.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsPython.cpp @@ -452,8 +452,8 @@ void register_python_tools(CommandCatalog& catalog) const std::string panel = "Show or hide the Run Script panel, where a person writes and runs Python scripts cell by cell. Agents " "run Python with the script_run tool instead."; NativeCommand toggle_panel = menu_command("script_toggle_panel", L("Run Script"), panel, object_schema({}), - json::array({NativeCommands::tile("toggle_run_script_panel", L("Run Script"), - L("Commands"), "media_play", json::object(), panel)}), + json::array({NativeCommands::action("toggle_run_script_panel", L("Run Script"), + L("Commands"), "media_play", json::object(), panel)}), [](const json&) { return MenuItems::toggle_run_script_panel(); }); // A menu item with no argument form: tool_search finds it and tool_call runs it, the tool list does not show it. toggle_panel.listed = false; diff --git a/src/slic3r/GUI/Mcp/McpToolsRecord.cpp b/src/slic3r/GUI/Mcp/McpToolsRecord.cpp index 94e9c23b4e..87d6d809dd 100644 --- a/src/slic3r/GUI/Mcp/McpToolsRecord.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsRecord.cpp @@ -109,7 +109,7 @@ ToolResult start_encode(AutomationRuntime& runtime, const json& args) void register_record_tools(CommandCatalog& catalog) { - // The Speed Dial's Start Recording is its tile: with no arguments it opens the tile's dialog. + // The Speed Dial's Start Recording is its action: with no arguments it opens the action's dialog. NativeCommand start = record_tool( "recording_start", L("Start Recording"), "Record a video of OrcaSlicer until recording_stop: the main window with any modal dialog on it (target main), or " @@ -225,14 +225,14 @@ void register_record_tools(CommandCatalog& catalog) ctx.set_journal_args(std::move(recorded)); return ToolResult::ok(out); }); - start.tiles = json::array({NativeCommands::tile("start_recording", L("Start Recording"), L("Commands"), "recording_start", - json::object(), - "Runs recording_start with no arguments, as Start Recording does: the Start " - "Recording dialog, whose Start recording starts the person's recording, " - "which neither the end of a replay or script nor the server turning off ends.")}); + start.actions = json::array({NativeCommands::action("start_recording", L("Start Recording"), L("Commands"), "recording_start", + json::object(), + "Runs recording_start with no arguments, as Start Recording does: the Start " + "Recording dialog, whose Start recording starts the person's recording, " + "which neither the end of a replay or script nor the server turning off ends.")}); catalog.add(NativeCommands::with_person_form(std::move(start), [](const json&) { return NativeCommands::start_person_recording(); })); - // The Speed Dial's Stop Recording is its tile: with no arguments it stops as the tile does. + // The Speed Dial's Stop Recording is its action: with no arguments it stops as the action does. NativeCommand stop = record_tool("recording_stop", L("Stop Recording"), "Stop the running recording. Call it with silent: true for the report: it waits for the file and " "returns it with its seconds, frames captured and " @@ -267,11 +267,11 @@ void register_record_tools(CommandCatalog& catalog) } return ToolResult::ok(report); }); - stop.tiles = json::array({NativeCommands::tile("stop_recording", L("Stop Recording"), L("Commands"), "recording_stop", - json::object(), - "Runs recording_stop with no arguments, as Stop Recording does: it stops the " - "recording, whoever started it, and shows the person a notification naming its " - "file.")}); + stop.actions = json::array({NativeCommands::action("stop_recording", L("Stop Recording"), L("Commands"), "recording_stop", + json::object(), + "Runs recording_stop with no arguments, as Stop Recording does: it stops the " + "recording, whoever started it, and shows the person a notification naming its " + "file.")}); // The person's stop opens nothing: like the silent one, it stops a recording behind a dialog. stop = NativeCommands::with_person_form(std::move(stop), [](const json&) { return NativeCommands::stop_recording_in_app(); }, /*person_form_behind_dialogs=*/true); diff --git a/src/slic3r/GUI/Mcp/McpToolsScene.cpp b/src/slic3r/GUI/Mcp/McpToolsScene.cpp index b36d32e464..d307b80374 100644 --- a/src/slic3r/GUI/Mcp/McpToolsScene.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsScene.cpp @@ -4,9 +4,9 @@ // set the number of instances, make instances separate objects, split, assemble, order, mirror, centre, scale to fit, // drop and orient objects and change a part's type take their targets (McpTargets.hpp) and run their operations // (Operations/ObjectOps, ProjectOps); the others run their menu items' functions (NativeCommandMenuItems.hpp) on the selection. -// The object and part commands of menu items with no Speed Dial tile, which mark objects printable, turn their Auto Drop -// on or off, repair their meshes, clone them, reload them from their files and replace a part's mesh, take their targets -// and run their operations too. +// The object and part commands of menu items with no Speed Dial action, which mark objects printable, turn their Auto +// Drop on or off, repair their meshes, clone them, reload them from their files and replace a part's mesh, take their +// targets and run their operations too. #include "CanvasTarget.hpp" #include "slic3r/GUI/I18N.hpp" @@ -127,7 +127,7 @@ GLCanvas3D& object_canvas() return canvas; } -// What Deselect All does, for object_select {none: true} and a pick of its tile: the selection of `canvas` clears +// What Deselect All does, for object_select {none: true} and a pick of its action: the selection of `canvas` clears // and its open gizmo closes. UI thread. void clear_selection(GLCanvas3D& canvas) { @@ -135,8 +135,8 @@ void clear_selection(GLCanvas3D& canvas) canvas.set_as_dirty(); } -// What Select All does, for object_select {all: true} and a pick of its tile: every object of `canvas` selected, and the -// object list showing it. Refused while a gizmo of that canvas keeps its selection, where GLCanvas3D::select_all() +// What Select All does, for object_select {all: true} and a pick of its action: every object of `canvas` selected, and +// the object list showing it. Refused while a gizmo of that canvas keeps its selection, where GLCanvas3D::select_all() // would select nothing. UI thread. std::optional select_everything(GLCanvas3D& canvas) { @@ -1278,7 +1278,7 @@ AppActionRunResult separate_command(const json& args) } // object_split: the object the call names, else the object list's one selected row (split_row()), as the Split menu items -// read it. A call with a tile's arguments asks what Split asks (the Auto-Drop question, a message for an object of one +// read it. A call with an action's arguments asks what Split asks (the Auto-Drop question, a message for an object of one // piece); any other answers the question with keep_z, and is refused without it. The menu items told every refusal of theirs // as information. AppActionRunResult split_command(const json& args) @@ -1393,7 +1393,7 @@ json plate_objects(int sorted, bool all) return order; } -// object_order: the current plate, the plate the call names, or every plate with all. Its tile's call ({by}) shows +// object_order: the current plate, the plate the call names, or every plate with all. Its action's call ({by}) shows // the Prepare view and reverses an order the objects already have, as the plate menu's Order By does; any other call // with by is ascending unless descending says otherwise. With order, the plate's objects go in that order, as drags in // the object list put them. The menu item told a plate with no objects as information. @@ -1451,7 +1451,7 @@ AppActionRunResult mirror_command(const json& args) return menu_reply(targets_reply(plater.model(), found.value())); } -// object_center: the objects the call names, else the selection; on the plate each stands on, or on plate. Its tile's +// object_center: the objects the call names, else the selection; on the plate each stands on, or on plate. Its action's // call ({}) is Center on the selection. The menu item told a selection to make as information. AppActionRunResult center_command(const json& args) { @@ -1584,9 +1584,9 @@ json orient_reply(Plater& plater, const Ops::OrientObjectsArgs& op) return reply; } -// object_add_primitive: a call with the tile's arguments ({shape}) is Add Primitive, refused while an object is selected -// and asking for the size; any other adds the shape at its size, or the built-in one, whatever is selected, on plate, at -// position, named name, in one undo step (Ops::add_primitive()). +// object_add_primitive: a call with the action's arguments ({shape}) is Add Primitive, refused while an object is +// selected and asking for the size; any other adds the shape at its size, or the built-in one, whatever is selected, on +// plate, at position, named name, in one undo step (Ops::add_primitive()). AppActionRunResult add_primitive_command(const json& args) { const std::string shape = arg_string(args, "shape"); @@ -1620,10 +1620,10 @@ AppActionRunResult add_primitive_command(const json& args) // The object and part commands made from menu items: each acts on the targets it is given or, given none, on what is // selected in the Prepare view, as a person's pick of the item does. Those of the object's and part's menus read their // targets through resolve_targets() and run their operations; the handy models, Text and SVG run the menu item their -// variant argument names. Their tiles are the menu items, under the items' ids, titles, sections and icons. +// variant argument names. Their actions are the menu items, under the items' ids, titles, sections and icons. void register_object_menu_commands(CommandCatalog& catalog) { - using NativeCommands::tile; + using NativeCommands::action; const char* const object_section = L("Object"); // ---- Add Primitive and Add Handy models ---- (the Add menu; each creates a new object) @@ -1633,22 +1633,22 @@ void register_object_menu_commands(CommandCatalog& catalog) // A shape the plate may then turn toward the part-cooling fan. const std::string turned = " The shape may then be turned toward the part-cooling fan, so the size is along its own axes before that turn."; const auto primitive = [&turned](const char* key, const char* title, const char* icon, const char* shape, bool turns) { - return tile(key, title, L("Add Primitive"), icon, {{"shape", shape}}, - std::string("Add a ") + shape + " object to the current plate at the size its dialog asks for; fails while an " - "object is selected. object_add_primitive with a size, or silent, skips the " - "dialog." + - (turns ? turned : std::string())); + return action(key, title, L("Add Primitive"), icon, {{"shape", shape}}, + std::string("Add a ") + shape + " object to the current plate at the size its dialog asks for; fails while an " + "object is selected. object_add_primitive with a size, or silent, skips the " + "dialog." + + (turns ? turned : std::string())); }; - // With shape alone the size dialog asks, as the tiles do; a size or silent skips it. + // With shape alone the size dialog asks, as the actions do; a size or silent skips it. NativeCommand add_primitive = menu_command( "object_add_primitive", L("Add a primitive"), "Add a primitive shape (cube, cylinder, sphere, cone, disc or torus) as a new object, as Add Primitive does: on the " "current plate, or on plate, which becomes the current one; at position, in the bed coordinates object_list and " "object_transform use, else where Add Primitive puts it; named name, else after its shape. With a size, at that " - "size; with silent, at the shape's built-in size. With shape alone, as its tiles, the Primitive size dialog asks " - "for the size (blocked_by_dialog), unless a person turned that dialog off, and the call is refused while an object " - "is selected (part_add adds a shape to an object); any other call adds the object whatever is selected. One undo " - "step; the new object is selected. Reply: the object (objects, object), its plate and offset." + + "size; with silent, at the shape's built-in size. With shape alone, as its Speed Dial actions, the Primitive size " + "dialog asks for the size (blocked_by_dialog), unless a person turned that dialog off, and the call is refused " + "while an object is selected (part_add adds a shape to an object); any other call adds the object whatever is " + "selected. One undo step; the new object is selected. Reply: the object (objects, object), its plate and offset." + turned, object_schema({{"shape", enum_prop({"cube", "cylinder", "sphere", "cone", "disc", "torus"}, "The shape.")}, {"size", shape_size}, @@ -1674,21 +1674,21 @@ void register_object_menu_commands(CommandCatalog& catalog) {"orcasliced_combo", "Add the OrcaSliced Combo (the OrcaSliced model, the Orca Cube and its plug) to the current plate, " "then arrange the objects as the toolbar's Arrange does, which moves the others too."}}; std::vector models; - json handy_tiles = json::array(); + json handy_actions = json::array(); for (const MenuFactory::HandyModel& model : MenuFactory::handy_models()) { models.emplace_back(model.key); std::string description = std::string("Add the ") + model.label + " model to the current plate."; for (const auto& [key, text] : arranged) if (models.back() == key) description = text; - handy_tiles.push_back(tile("add_handy_" + models.back(), model.label, L("Add Handy models"), "", {{"model", model.key}}, - description)); + handy_actions.push_back(action("add_handy_" + models.back(), model.label, L("Add Handy models"), "", {{"model", model.key}}, + description)); } catalog.add(menu_command( "object_add_handy_model", L("Add a handy model"), "Add one of the test models OrcaSlicer ships to the current plate, as Add Handy models does; orca_cube and " "orcasliced_combo, of several files, then arrange the objects as the toolbar's Arrange does, which moves the others too.", - object_schema({{"model", enum_prop(models, "The model.")}}, {"model"}), std::move(handy_tiles), [](const json& args) { + object_schema({{"model", enum_prop(models, "The model.")}}, {"model"}), std::move(handy_actions), [](const json& args) { const std::string model = arg_string(args, "model"); const std::vector& all = MenuFactory::handy_models(); const auto it = std::find_if(all.begin(), all.end(), [&model](const MenuFactory::HandyModel& m) { return model == m.key; }); @@ -1698,7 +1698,8 @@ void register_object_menu_commands(CommandCatalog& catalog) const std::string text = "Add a text: a part on the selected object, or a new object when nothing is selected. It is created " "in the background (app_wait {for: \"idle\"} waits for it), and the Text gizmo opens on it."; catalog.add(menu_command("object_add_text", L("Text"), text, object_schema({}), - json::array({tile("add_primitive_text", L("Text"), L("Add Primitive"), "menu_obj_text", json::object(), text)}), + json::array({action("add_primitive_text", L("Text"), L("Add Primitive"), "menu_obj_text", json::object(), + text)}), [](const json&) { return MenuItems::add_primitive_text(); })); catalog.add(menu_command( @@ -1706,10 +1707,10 @@ void register_object_menu_commands(CommandCatalog& catalog) "Add an SVG as a new object, or as a part of the selected object. With a path, uses that file without a dialog; the " "part is created in the background (app_wait {for: \"idle\"} waits for it), and the SVG gizmo opens on it.", object_schema({{"path", MenuItems::input_file("an .svg file")}}), - json::array({tile("add_primitive_svg", L("SVG"), L("Add Primitive"), "menu_obj_svg", json::object(), - "Add an SVG as a new object, or as a part of the selected object, from the file a dialog asks for; " - "object_add_svg with a path uses that file without one. The part is created in the background " - "(app_wait {for: \"idle\"} waits for it), and the SVG gizmo opens on it.")}), + json::array({action("add_primitive_svg", L("SVG"), L("Add Primitive"), "menu_obj_svg", json::object(), + "Add an SVG as a new object, or as a part of the selected object, from the file a dialog asks for; " + "object_add_svg with a path uses that file without one. The part is created in the background " + "(app_wait {for: \"idle\"} waits for it), and the SVG gizmo opens on it.")}), [](const json& args) { return MenuItems::add_primitive_svg(args); })); // ---- Object ---- (the object's context menu and the Edit menu) @@ -1727,26 +1728,27 @@ void register_object_menu_commands(CommandCatalog& catalog) with_targets(object_schema({{"plate", {{"type", "integer"}, {"minimum", 0}, {"description", "Delete what stands on this plate."}}}, {"all", prop("boolean", "Delete every object. Default false: the targets.")}}), kEveryTarget, false), - json::array({tile("obj_delete", L("Delete Selected"), object_section, "delete", json::object(), "Delete the selected objects or parts."), - tile("obj_delete_all", L("Delete All Objects"), object_section, "delete", {{"all", true}}, "Delete all objects.")}), + json::array({action("obj_delete", L("Delete Selected"), object_section, "delete", json::object(), + "Delete the selected objects or parts."), + action("obj_delete_all", L("Delete All Objects"), object_section, "delete", {{"all", true}}, "Delete all objects.")}), delete_command); del.input_schema = with_silent(std::move(del.input_schema), person_forms(del)); catalog.add(reaching({"delete_objects"}, with_expected_ids(std::move(del)))); - // The Rename dialog's name, which every call but the tile's gives. + // The Rename dialog's name, which every call but the action's gives. NativeCommand rename = menu_command( "object_rename", L("Rename"), "Rename an object, or a part of it (object and part), or with neither the object or part selected in the Prepare " "view. With a name, skips the Rename dialog; an empty name, or one with characters a file name cannot hold, is " "refused. Reply: what was renamed, with its name (objects or parts).", with_targets(object_schema({{"name", prop("string", "The new name, in place of the Rename dialog.")}}, {"name"}), kObjects | kParts, true), - json::array({tile("obj_rename", L("Rename"), object_section, "", json::object(), - "Rename the selected object or part (select one) in the Rename dialog; object_rename with a name skips it.")}), + json::array({action("obj_rename", L("Rename"), object_section, "", json::object(), + "Rename the selected object or part (select one) in the Rename dialog; object_rename with a name skips it.")}), rename_command); rename.input_schema = with_silent(std::move(rename.input_schema), person_forms(rename)); catalog.add(reaching({"rename_object"}, with_expected_ids(std::move(rename)))); - // The count the dialog asks for, which every call but the tiles' gives; delta is the toolbar's + and -. + // The count the dialog asks for, which every call but the actions' gives; delta is the toolbar's + and -. NativeCommand instances = menu_command( "object_set_instances", L("Set the number of instances"), "Give an object this many instances (count), as Set Number of Instances does, or one more or one fewer (delta 1 " @@ -1761,20 +1763,20 @@ void register_object_menu_commands(CommandCatalog& catalog) {"enum", {1, -1}}, {"description", "1 adds an instance and -1 removes one, as the toolbar's + and - do."}}}}), kObjects, true), - json::array({tile("obj_set_instances", L("Set Number of Instances"), object_section, "instance_add", json::object(), - "Give the selected object the number of instances the dialog asks for, in one undo step; " - "object_set_instances with a count skips the dialog. New instances overlap; arrange " - "afterwards."), - tile("obj_instances_up", L("Increase Instances"), object_section, "instance_add", {{"delta", 1}}, - "Add an instance of the selected object."), - tile("obj_instances_down", L("Decrease Instances"), object_section, "instance_remove", {{"delta", -1}}, - "Remove an instance of the selected object.")}), + json::array({action("obj_set_instances", L("Set Number of Instances"), object_section, "instance_add", json::object(), + "Give the selected object the number of instances the dialog asks for, in one undo step; " + "object_set_instances with a count skips the dialog. New instances overlap; arrange " + "afterwards."), + action("obj_instances_up", L("Increase Instances"), object_section, "instance_add", {{"delta", 1}}, + "Add an instance of the selected object."), + action("obj_instances_down", L("Decrease Instances"), object_section, "instance_remove", {{"delta", -1}}, + "Remove an instance of the selected object.")}), instances_command); instances.input_schema = with_silent(std::move(instances.input_schema), person_forms(instances)); // Its silent form needs count or delta, which a schema of this server cannot require as one of two. instances.input_schema["properties"]["silent"]["description"] = - "true runs the command without asking; it then needs count or delta. A call with no arguments, or with exactly a " - "tile's arguments, does what a person's pick of that tile does."; + "true runs the command without asking; it then needs count or delta. A call with no arguments, or with exactly an " + "action's arguments, does what a person's pick of that action does."; catalog.add(reaching({"set_instance_count"}, with_expected_ids(std::move(instances)))); NativeCommand separate = menu_command( @@ -1784,14 +1786,14 @@ void register_object_menu_commands(CommandCatalog& catalog) "some of its instances. New objects are added last. Reply: the objects that hold those instances afterwards " "(objects): the object and its new objects, or the new object.", with_targets(with_targets(object_schema({}), kObjects, true), kInstances, false), - json::array({tile("obj_instances_to_objects", L("Set as Individual Objects"), object_section, "", json::object(), - "Make each instance of the selected object a separate object (object_select {objects: [n]}); with some " - "of its instances selected, only those. New objects are added last; the reply lists the objects that " - "hold those instances (objects).")}), + json::array({action("obj_instances_to_objects", L("Set as Individual Objects"), object_section, "", json::object(), + "Make each instance of the selected object a separate object (object_select {objects: [n]}); with some " + "of its instances selected, only those. New objects are added last; the reply lists the objects that " + "hold those instances (objects).")}), separate_command); catalog.add(reaching({"separate_instances"}, with_expected_ids(std::move(separate)))); - // The answer to Split's Auto-Drop question, which every call but the tiles' gives where the split asks it. + // The answer to Split's Auto-Drop question, which every call but the actions' gives where the split asks it. NativeCommand split = menu_command( "object_split", L("Split an object"), "Split an object into separate objects, or into parts of it, as Split > To Objects and To Parts do: the object named, " @@ -1800,7 +1802,7 @@ void register_object_menu_commands(CommandCatalog& catalog) "is refused, and into parts so is an object of several parts, whose part is selected to split it. Into objects, " "the object is removed and its pieces are added last and selected. Where some of them " "would float above the bed of an object that drops, keep_z answers the question Split asks (true keeps their " - "height, false lets them drop), and without it the call is refused (auto_drop_question); with only a tile's " + "height, false lets them drop), and without it the call is refused (auto_drop_question); with only an action's " "arguments Split asks it (blocked_by_dialog). One undo step. Reply: the new objects (objects) or the parts the " "part became (parts), with their indices afterwards, and object_count.", with_targets(object_schema({{"into", enum_prop({"objects", "parts"}, "Separate objects, or parts of the object.")}, @@ -1809,10 +1811,10 @@ void register_object_menu_commands(CommandCatalog& catalog) "lets them drop.")}}, {"into"}), kObjects, true), - json::array({tile("obj_split_objects", L("Split to Objects"), object_section, "menu_split_objects", {{"into", "objects"}}, - "Split the selected object into separate objects."), - tile("obj_split_parts", L("Split to Parts"), object_section, "menu_split_parts", {{"into", "parts"}}, - "Split the selected object into parts.")}), + json::array({action("obj_split_objects", L("Split to Objects"), object_section, "menu_split_objects", {{"into", "objects"}}, + "Split the selected object into separate objects."), + action("obj_split_parts", L("Split to Parts"), object_section, "menu_split_parts", {{"into", "parts"}}, + "Split the selected object into parts.")}), split_command); split.input_schema = with_silent(std::move(split.input_schema), person_forms(split)); catalog.add(reaching({"split_object"}, with_expected_ids(std::move(split)))); @@ -1826,9 +1828,9 @@ void register_object_menu_commands(CommandCatalog& catalog) "are refused. They are removed and the new object is added last and selected, so object indices change. One " "undo step. Reply: the new object's index (object) and name, and objects.", with_targets(object_schema({}), kObjects, false), - json::array({tile("obj_assemble", L("Assemble"), object_section, "", json::object(), - "Assemble two or more selected objects into one object of parts named Assembly. They are removed " - "and it is added last, so object indices change; the reply has its index (object) and name.")}), + json::array({action("obj_assemble", L("Assemble"), object_section, "", json::object(), + "Assemble two or more selected objects into one object of parts named Assembly. They are removed " + "and it is added last, so object indices change; the reply has its index (object) and name.")}), assemble_command)))); // The plate menu's Order By. @@ -1846,24 +1848,24 @@ void register_object_menu_commands(CommandCatalog& catalog) {"obj_order_by_height", L("Order by Height"), "height", "height"}, {"obj_order_by_size", L("Order by Size"), "size", "size (bounding box volume)"}, }; - json order_tiles = json::array(); + json order_actions = json::array(); for (const OrderMenuItem& item : order_menu_items) - order_tiles.push_back(tile(item.key, item.title, object_section, "", {{"by", item.by}}, - std::string("Order the current plate's objects by ") + item.what + - ", which sets the object list and print order, as the plate menu's Order By does. " - "Choosing the order they already have reverses it. Object indices change; the reply " - "lists the new order (order: [{object, name, plate}]) and descending.")); + order_actions.push_back(action(item.key, item.title, object_section, "", {{"by", item.by}}, + std::string("Order the current plate's objects by ") + item.what + + ", which sets the object list and print order, as the plate menu's Order By does. " + "Choosing the order they already have reverses it. Object indices change; the reply " + "lists the new order (order: [{object, name, plate}]) and descending.")); NativeCommand order = reaching( {"order_objects", "reorder_objects"}, menu_command("object_order", L("Order objects"), "Order the objects of a plate (the current one, or plate), or with all of every plate, by name, filament, " "height or size (bounding box volume), which sets the object list and print order, as the plate menu's " - "Order By does: ascending, or with descending true descending. Called with by alone, as its tiles, it shows " - "the Prepare view and, as Order By does, reverses the order the objects already have. With order in place " - "of by, the plate's objects go in the order given, as dragging them in the object list puts them: order " - "names each of the plate's objects once, by index, and anything else is refused; the other plates' objects " - "keep their order. One undo step; object indices change. Reply: the new order (order: [{object, name, " - "plate}]), and descending with by.", + "Order By does: ascending, or with descending true descending. Called with by alone, as its Speed Dial " + "actions, it shows the Prepare view and, as Order By does, reverses the order the objects already have. " + "With order in place of by, the plate's objects go in the order given, as dragging them in the object list " + "puts them: order names each of the plate's objects once, by index, and anything else is refused; the " + "other plates' objects keep their order. One undo step; object indices change. Reply: the new order (order: " + "[{object, name, plate}]), and descending with by.", object_schema({{"plate", {{"type", "integer"}, {"minimum", 0}, {"description", "Order this plate's objects. Default: the current plate."}}}, {"by", enum_prop({"name", "filament", "height", "size"}, "What to order by.")}, {"order", {{"type", "array"}, @@ -1873,7 +1875,7 @@ void register_object_menu_commands(CommandCatalog& catalog) "once, in the order wanted."}}}, {"descending", prop("boolean", "With by: descending order. Default false.")}, {"all", prop("boolean", "With by: order the objects of every plate. Default false: one plate's.")}}), - std::move(order_tiles), order_command)); + std::move(order_actions), order_command)); // The arguments are checked before the call reads the app. order.run = [run = std::move(order.run)](const json& args, ToolContext& ctx) { check_order_arguments(args); @@ -1890,7 +1892,8 @@ void register_object_menu_commands(CommandCatalog& catalog) "already rests on the bed is no error: moved false says that nothing moved. One undo step; the targets are left " "selected. Reply: what it acted on (objects, instances, parts) and moved.", with_targets(object_schema({}), kObjects | kParts, false), - json::array({tile("obj_drop", L("Drop to Bed"), object_section, "toolbar_flatten", json::object(), "Drop the selection onto the bed.")}), + json::array({action("obj_drop", L("Drop to Bed"), object_section, "toolbar_flatten", json::object(), + "Drop the selection onto the bed.")}), drop_command)))); catalog.add(reaching( @@ -1902,9 +1905,12 @@ void register_object_menu_commands(CommandCatalog& catalog) "of one instance or parts of one. Cut objects are refused. One undo step; the targets are left selected. Reply: what " "it mirrored (objects, instances, parts).", with_targets(object_schema({{"axis", enum_prop({"x", "y", "z"}, "The axis to mirror along.")}}, {"axis"}), kObjects | kParts, false), - json::array({tile("obj_mirror_x", L("Mirror X"), object_section, "menu_mirror_x", {{"axis", "x"}}, "Mirror the selection along X."), - tile("obj_mirror_y", L("Mirror Y"), object_section, "menu_mirror_y", {{"axis", "y"}}, "Mirror the selection along Y."), - tile("obj_mirror_z", L("Mirror Z"), object_section, "menu_mirror_z", {{"axis", "z"}}, "Mirror the selection along Z.")}), + json::array({action("obj_mirror_x", L("Mirror X"), object_section, "menu_mirror_x", {{"axis", "x"}}, + "Mirror the selection along X."), + action("obj_mirror_y", L("Mirror Y"), object_section, "menu_mirror_y", {{"axis", "y"}}, + "Mirror the selection along Y."), + action("obj_mirror_z", L("Mirror Z"), object_section, "menu_mirror_z", {{"axis", "z"}}, + "Mirror the selection along Z.")}), mirror_command)))); catalog.add(reaching( @@ -1913,13 +1919,14 @@ void register_object_menu_commands(CommandCatalog& catalog) "object_center", L("Center Selected on Plate"), "Centre objects on their plate, as Center does: those named, each plate's as one group on the plate it stands on (an " "object on no plate goes with the current plate's), or all on plate; with none named, what is selected in the " - "Prepare view as one group, on plate, or with no arguments, as its tile, on the current plate. A group moves as one, " - "its box to the plate's centre, its objects keeping their places relative to each other, so a group spread over " - "several plates and sent to plate may not fit on its bed. One undo step; the targets are left selected. Reply: " - "what it centred (objects, instances, parts) and the groups (plates: [{plate, objects}]).", + "Prepare view as one group, on plate, or with no arguments, as its Speed Dial action, on the current plate. A " + "group moves as one, its box to the plate's centre, its objects keeping their places relative to each other, so " + "a group spread over several plates and sent to plate may not fit on its bed. One undo step; the targets are " + "left selected. Reply: what it centred (objects, instances, parts) and the groups (plates: [{plate, objects}]).", with_targets(object_schema({{"plate", {{"type", "integer"}, {"minimum", 0}, {"description", "Centre them all on this plate."}}}}), kObjects, false), - json::array({tile("obj_center", L("Center Selected on Plate"), object_section, "", json::object(), "Center the selection on its plate.")}), + json::array({action("obj_center", L("Center Selected on Plate"), object_section, "", json::object(), + "Center the selection on its plate.")}), center_command)))); catalog.add(reaching( @@ -1931,13 +1938,14 @@ void register_object_menu_commands(CommandCatalog& catalog) "than a rectangle or a circle are refused. One undo step; the targets are left selected. Reply: what it scaled " "(objects, instances) and each instance's scale (scales: [{object, instance, scale}]).", with_targets(object_schema({}), kObjects, false), - json::array({tile("obj_fit_volume", L("Scale to Fit Print Volume"), object_section, "", json::object(), - "Scale the selection to fit the print volume.")}), + json::array({action("obj_fit_volume", L("Scale to Fit Print Volume"), object_section, "", json::object(), + "Scale the selection to fit the print volume.")}), scale_to_fit_command)))); // Auto-Orient waits for its job; a person's pick starts it in place, as the toolbar does. - const std::string orient_tile = "Auto-orient the selection, or every object when nothing is selected; the call returns when it is done."; - NativeCommand orient = reaching( + const std::string orient_action = "Auto-orient the selection, or every object when nothing is selected; the call returns when it " + "is done."; + NativeCommand orient = reaching( {"orient_objects"}, with_expected_ids(mutate_tool( "object_auto_orient", L("Auto-Orient"), @@ -1982,9 +1990,9 @@ void register_object_menu_commands(CommandCatalog& catalog) throw ToolFailure("The orientation did not finish within " + std::to_string(timeout.count()) + " s, so it was cancelled"); } }))); - orient.tiles = json::array({tile("obj_orient", L("Auto-Orient"), object_section, "toolbar_orient", json::object(), orient_tile)}); - // A person's pick of the tile starts the orientation in place and returns while it runs; an automated call of the - // tile's arguments is the command's own function, which waits and replies. Both are orient_objects() on the same + orient.actions = json::array({action("obj_orient", L("Auto-Orient"), object_section, "toolbar_orient", json::object(), orient_action)}); + // A person's pick of the action starts the orientation in place and returns while it runs; an automated call of the + // action's arguments is the command's own function, which waits and replies. Both are orient_objects() on the same // targets. catalog.add(NativeCommands::with_menu_item_forms( std::move(orient), @@ -2030,9 +2038,9 @@ void register_object_menu_commands(CommandCatalog& catalog) "Make the selected parts Center precise seams (seams keep their subtype), as Change Type does; not the object's last " "solid part, nor a text or SVG part. Parts are listed by type, so part indices change."}, }; - json type_tiles = json::array(); + json type_actions = json::array(); for (const TypeMenuItem& item : type_menu_items) - type_tiles.push_back(tile(item.key, item.title, object_section, "", {{"type", item.type}}, item.description)); + type_actions.push_back(action(item.key, item.title, object_section, "", {{"type", item.type}}, item.description)); catalog.add(reaching( {"change_part_type"}, with_expected_ids(menu_command( @@ -2050,7 +2058,7 @@ void register_object_menu_commands(CommandCatalog& catalog) "takes. Default: a seam keeps its own, another part becomes center.")}}, {"type"}), kParts, false), - std::move(type_tiles), part_type_command)))); + std::move(type_actions), part_type_command)))); } // What object_fix replies: what it repaired (objects whole, parts), and for each object or part in turn whether its mesh @@ -2084,8 +2092,8 @@ json fix_reply(const Model& model, const Ops::FixedModels& fixed) return reply; } -// The object and part commands of the GUI's menus that have no Speed Dial tile: Printable, Auto Drop, Fix Model, Clone, -// Reload from disk and Replace 3D file. Each reads its targets through resolve_targets() and runs its operation. +// The object and part commands of the GUI's menus that have no Speed Dial action: Printable, Auto Drop, Fix Model, +// Clone, Reload from disk and Replace 3D file. Each reads its targets through resolve_targets() and runs its operation. void register_object_tools(CommandCatalog& catalog) { NativeCommand printable = reaching( @@ -2496,24 +2504,24 @@ void register_scene_tools(CommandCatalog& catalog) settle(ctx); return ToolResult::ok(out); })); - select.tiles = json::array({NativeCommands::tile("select_all", L("Select All Objects"), L("Object"), "", {{"all", true}}, - "Select every object in the 3D view (the assemble view while it is shown, " - "else Prepare, switching to it), and reply with the selection; refused " - "while a gizmo that keeps its selection is open. A person's pick shows " - "Prepare and selects there."), - NativeCommands::tile("deselect_all", L("Deselect All"), L("Object"), "", {{"none", true}}, - "Clear the selection in the 3D view (the assemble view while it is shown, " - "else Prepare, switching to it), close the open gizmo, and reply with the " - "selection. A person's pick clears it where it is, switching no tab.")}); + select.actions = json::array({NativeCommands::action("select_all", L("Select All Objects"), L("Object"), "", {{"all", true}}, + "Select every object in the 3D view (the assemble view while it is shown, " + "else Prepare, switching to it), and reply with the selection; refused " + "while a gizmo that keeps its selection is open. A person's pick shows " + "Prepare and selects there."), + NativeCommands::action("deselect_all", L("Deselect All"), L("Object"), "", {{"none", true}}, + "Clear the selection in the 3D view (the assemble view while it is shown, " + "else Prepare, switching to it), close the open gizmo, and reply with the " + "selection. A person's pick clears it where it is, switching no tab.")}); // A person's pick runs in place, as its menu item did: Select All shows Prepare and select_everything() selects there, - // Deselect All is clear_selection() on the view shown, switching no tab. An automated call of either tile's + // Deselect All is clear_selection() on the view shown, switching no tab. An automated call of either action's // arguments is object_select's own function, which the two functions serve too, on the view shown, and replies // with the selection. catalog.add(NativeCommands::with_menu_item_forms( std::move(select), - [](const json& tile_args) { + [](const json& action_args) { Plater* plater = wxGetApp().plater(); - if (arg_bool(tile_args, "all", false)) { + if (arg_bool(action_args, "all", false)) { if (plater == nullptr) return AppActionRunResult{}; Ops::show_prepare_view(); @@ -2676,14 +2684,14 @@ void register_scene_tools(CommandCatalog& catalog) throw ToolFailure("The arrangement did not finish within " + std::to_string(timeout.count()) + " s, so it was cancelled"); } })); - arrange.tiles = json::array({NativeCommands::tile("obj_arrange", L("Auto-Arrange"), L("Object"), "toolbar_arrange", json::object(), - "Arrange all objects on the unlocked plates with the saved Arrange options, as " - "the toolbar does; the call waits for the arrangement and replies as " - "object_arrange does: the settings in force, the instances left off every " - "plate and the plates skipped. object_arrange with arguments also takes " - "options, one plate or fill bed.")}); + arrange.actions = json::array({NativeCommands::action("obj_arrange", L("Auto-Arrange"), L("Object"), "toolbar_arrange", json::object(), + "Arrange all objects on the unlocked plates with the saved Arrange options, as " + "the toolbar does; the call waits for the arrangement and replies as " + "object_arrange does: the settings in force, the instances left off every " + "plate and the plates skipped. object_arrange with arguments also takes " + "options, one plate or fill bed.")}); // A person's pick starts the arrangement in place as the toolbar does, and returns while it runs; an automated call - // of the tile's arguments is object_arrange's own function, which waits and replies. Both are Ops::start_arrange() + // of the action's arguments is object_arrange's own function, which waits and replies. Both are Ops::start_arrange() // on every unlocked plate with the panel's settings. catalog.add(NativeCommands::with_menu_item_forms( std::move(arrange), [](const json&) { return MenuItems::obj_arrange(); }, /*person_form_behind_dialogs=*/false, @@ -2703,7 +2711,7 @@ void register_scene_tools(CommandCatalog& catalog) object_schema({{"plates", {{"type", {"string", "integer"}}, {"description", "\"current\" (default), \"all\", or a plate index."}}}, {"timeout_s", {{"type", "integer"}, {"minimum", 10}, {"maximum", 7200}, {"description", "Stop waiting after this long (default 1800): the call fails, and the slice goes on unless job_cancel stops it."}}}, {"preview", prop("boolean", "Show the Preview tab, as every slice does: the argument of the Slice and " - "Preview and Slice All Plates tiles.")}}), + "Preview and Slice All Plates actions.")}}), [](const json& args, ToolContext& ctx) { const json plates_arg = args.value("plates", json("current")); auto ticket = std::make_shared(); @@ -2816,13 +2824,14 @@ void register_scene_tools(CommandCatalog& catalog) return ToolResult::ok(result); })); slice.budget_ms = 45000; - slice.tiles = json::array( - {NativeCommands::tile("slice_and_preview", L("Slice and Preview"), L("Slice & Export"), "media_play", {{"preview", true}}, - "Slice the current plate and show the Preview tab; the call waits for the result, and a pick starts " - "the slice as a job."), - NativeCommands::tile("slice_all", L("Slice All Plates"), L("Slice & Export"), "media_play", {{"plates", "all"}, {"preview", true}}, - "Slice every plate and show the Preview tab; the call waits for the results, and a pick starts the " - "slice as a job.")}); + slice.actions = json::array( + {NativeCommands::action("slice_and_preview", L("Slice and Preview"), L("Slice & Export"), "media_play", {{"preview", true}}, + "Slice the current plate and show the Preview tab; the call waits for the result, and a pick starts " + "the slice as a job."), + NativeCommands::action("slice_all", L("Slice All Plates"), L("Slice & Export"), "media_play", + {{"plates", "all"}, {"preview", true}}, + "Slice every plate and show the Preview tab; the call waits for the results, and a pick starts the " + "slice as a job.")}); catalog.add(std::move(slice)); NativeCommand cancel = mutate_tool( diff --git a/src/slic3r/GUI/Mcp/McpToolsView.cpp b/src/slic3r/GUI/Mcp/McpToolsView.cpp index 2350d07cde..bcd0dc6a7b 100644 --- a/src/slic3r/GUI/Mcp/McpToolsView.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsView.cpp @@ -265,10 +265,10 @@ Ops::Refusal no_bed_in_design() return Ops::Refusal{Ops::RefusalKind::Precondition, "no_bed_in_design", L("The Design tab has no bed to fit the view to.")}; } -// view_set's camera, and a pick of a camera tile: a named direction or a fit of the shown 3D view. On the Design tab +// view_set's camera, and a pick of a camera action: a named direction or a fit of the shown 3D view. On the Design tab // it points the Design view as its own controls do, `default` being its Home view and `sketch_normal` the sketch's N -// key. The refusal is the one a tile can reach, fit_bed on the Design tab; fit_selection and sketch_normal, which no -// tile gives, throw. UI thread. +// key. The refusal is the one an action can reach, fit_bed on the Design tab; fit_selection and sketch_normal, which no +// action gives, throw. UI thread. std::optional point_camera(Plater& plater, const std::string& cam) { #ifdef SLIC3R_CAD @@ -425,31 +425,31 @@ Ops::Outcome show_layer_percent(double percent) return Ops::show_layer_range(range); } -// A person's pick of one of view_set's tiles, in place on the UI thread as its menu item ran: for each argument the function -// a call's UI closure runs, and a refusal in the UI's language, Go to tab's as an error and the others, which say that -// the view has nothing to show it, as information. -AppActionRunResult picked_view(const json& tile_args) +// A person's pick of one of view_set's actions, in place on the UI thread as its menu item ran: for each argument the +// function a call's UI closure runs, and a refusal in the UI's language, Go to tab's as an error and the others, which say +// that the view has nothing to show it, as information. +AppActionRunResult picked_view(const json& action_args) { Plater* plater = wxGetApp().plater(); MainFrame* frame = wxGetApp().mainframe; if (plater == nullptr || frame == nullptr) return AppActionRunResult{}; - if (tile_args.contains("layout")) + if (action_args.contains("layout")) return MenuItems::reset_window_layout(); - if (tile_args.contains("projection")) + if (action_args.contains("projection")) return MenuItems::toggle_perspective(); - if (tile_args.contains("tab")) { - if (const std::optional refusal = show_tab(*frame, arg_string(tile_args, "tab"))) + if (action_args.contains("tab")) { + if (const std::optional refusal = show_tab(*frame, arg_string(action_args, "tab"))) return NativeCommands::refused(*refusal); return AppActionRunResult{AppActionRunResult::Level::Succeeded}; } - if (tile_args.contains("layer_percent")) { + if (action_args.contains("layer_percent")) { show_preview(*plater, *frame); - const Ops::Outcome shown = show_layer_percent(tile_args.at("layer_percent").get()); + const Ops::Outcome shown = show_layer_percent(action_args.at("layer_percent").get()); return shown ? AppActionRunResult{AppActionRunResult::Level::Succeeded} : NativeCommands::refused(shown.refusal(), AppActionRunResult::Level::Info); } - if (const std::optional refusal = point_camera(*plater, arg_string(tile_args, "camera"))) + if (const std::optional refusal = point_camera(*plater, arg_string(action_args, "camera"))) return NativeCommands::refused(*refusal, AppActionRunResult::Level::Info); repaint_shown_canvas(); return AppActionRunResult{AppActionRunResult::Level::Succeeded}; @@ -860,8 +860,8 @@ void register_view_tools(CommandCatalog& catalog) "navigator set the display switches of the View menu and of the 3D view's own menu; sidebar_collapsed and " "sidebar_width set the sidebar of Prepare and the Preview; in the Preview, legend_collapsed folds the legend and " "gcode_window shows the G-code window. Each is echoed as the app reads it back, and app_state's view gives them " - "under these names. A pick of a view tile runs the same code in place, so a camera tile turns the Design tab's " - "camera too.", + "under these names. A pick of a view action runs the same code in place, so a camera action turns the Design " + "tab's camera too.", object_schema({{"tab", prop("string", "Main window tab: " + tab_words + ", or the id of another page of the window " "(monitor_web, the web Device page where the app shows one, or a plugin's page).")}, {"canvas", enum_prop({"3d", "preview", "assemble"}, "3D view: Prepare's, the preview, or the assemble view (needs an object; leave it with 3d, as its Return button does).")}, @@ -1281,7 +1281,7 @@ void register_view_tools(CommandCatalog& catalog) {"view_iso", L("View: Isometric"), "iso"}, {"view_default", L("View: Default"), "default"}, {"view_fit_bed", L("Fit Bed to View"), "fit_bed"}}; - view.tiles = json::array(); + view.actions = json::array(); std::vector camera_forms; for (const CameraMenuItem& item : camera_menu_items) { const std::string camera = item.camera; @@ -1290,24 +1290,25 @@ void register_view_tools(CommandCatalog& catalog) does = "Turn the camera of the view shown to the default view and fit the plate; on the Design tab, its Home view."; else if (camera == "fit_bed") does = "Fit the build plate in the 3D view shown; refused on the Design tab, which has no bed to fit."; - view.tiles.push_back(NativeCommands::tile(item.key, item.title, L("View"), "", {{"camera", camera}}, does)); + view.actions.push_back(NativeCommands::action(item.key, item.title, L("View"), "", {{"camera", camera}}, does)); camera_forms.push_back({{"camera", camera}}); } - view.tiles.push_back(NativeCommands::tile("view_toggle_perspective", L("Toggle Perspective"), L("View"), "", {{"projection", "toggle"}}, - "Switch the 3D camera between perspective and orthographic.")); - view.tiles.push_back(NativeCommands::tile("reset_window_layout", L("Reset Window Layout"), L("View"), "toolbar_reset", - {{"layout", "default"}}, "Restore the default window layout.")); - view.tiles.push_back(NativeCommands::tile("go_to_tab", L("Go to tab..."), L("Commands"), "", json::object(), - "Switch to a main window tab.", "tab")); - view.tiles.push_back(NativeCommands::tile("go_to_layer", L("Go to layer (percent)"), L("Commands"), "height_range_layer", - json::object(), - "Show the Preview tab at a layer chosen as a percentage of the layer range; an error " - "while the Preview has no layers (slice first).", - "percent", "layer_percent")); - // A person's pick of any of these tiles runs in place (picked_view()): Toggle Perspective and Reset Window Layout - // their menu items, the camera tiles, Go to tab and Go to layer the camera, tab and layer functions view_set's UI closure - // runs for a call, so a camera tile turns the Design tab's camera too. An automated call of a camera tile, Go to tab - // or Go to layer is view_set's own function. + view.actions.push_back(NativeCommands::action("view_toggle_perspective", L("Toggle Perspective"), L("View"), "", + {{"projection", "toggle"}}, + "Switch the 3D camera between perspective and orthographic.")); + view.actions.push_back(NativeCommands::action("reset_window_layout", L("Reset Window Layout"), L("View"), "toolbar_reset", + {{"layout", "default"}}, "Restore the default window layout.")); + view.actions.push_back(NativeCommands::action("go_to_tab", L("Go to tab..."), L("Commands"), "", json::object(), + "Switch to a main window tab.", "tab")); + view.actions.push_back(NativeCommands::action("go_to_layer", L("Go to layer (percent)"), L("Commands"), "height_range_layer", + json::object(), + "Show the Preview tab at a layer chosen as a percentage of the layer range; an error " + "while the Preview has no layers (slice first).", + "percent", "layer_percent")); + // A person's pick of any of these actions runs in place (picked_view()): Toggle Perspective and Reset Window Layout + // their menu items, the camera actions, Go to tab and Go to layer the camera, tab and layer functions view_set's UI + // closure runs for a call, so a camera action turns the Design tab's camera too. An automated call of a camera action, + // Go to tab or Go to layer is view_set's own function. catalog.add(NativeCommands::with_menu_item_forms(std::move(view), picked_view, /*person_form_behind_dialogs=*/false, std::move(camera_forms))); @@ -1339,11 +1340,11 @@ void register_view_tools(CommandCatalog& catalog) {"help_about", L("About OrcaSlicer"), L("Help"), "OrcaSlicer_gradient_circle", "about", "Show the About dialog."}, }; std::vector windows; - json window_tiles = json::array(); + json window_actions = json::array(); for (const WindowMenuItem& item : window_menu_items) { windows.emplace_back(item.window); - window_tiles.push_back( - NativeCommands::tile(item.key, item.title, item.group, item.icon, {{"window", item.window}}, item.description)); + window_actions.push_back( + NativeCommands::action(item.key, item.title, item.group, item.icon, {{"window", item.window}}, item.description)); } catalog.add(menu_command( "window_open", L("Open a window"), @@ -1360,7 +1361,7 @@ void register_view_tools(CommandCatalog& catalog) {"key", prop("string", "preferences, with tab: a preference on that tab, e.g. auto_arrange on behaviour: " "its control is scrolled into view and focused.")}}, {"window"}), - std::move(window_tiles), [](const json& args) { + std::move(window_actions), [](const json& args) { const std::string window = arg_string(args, "window"); if (window != "preferences" && (args.contains("tab") || args.contains("key"))) return AppActionRunResult{AppActionRunResult::Level::Error, from_u8("tab and key go with window preferences"), false}; @@ -1373,8 +1374,8 @@ void register_view_tools(CommandCatalog& catalog) "they chose another) and show the person a notification naming it; the reply has its path. Agents use " "the window_screenshot tool, which returns the image."; NativeCommand save_screenshot = menu_command("window_save_screenshot", L("Take Screenshot"), saved, object_schema({}), - json::array({NativeCommands::tile("take_screenshot", L("Take Screenshot"), - L("Commands"), "screenshot", json::object(), saved)}), + json::array({NativeCommands::action("take_screenshot", L("Take Screenshot"), + L("Commands"), "screenshot", json::object(), saved)}), [](const json&) { return MenuItems::take_screenshot(); }); // A menu item with no argument form: tool_search finds it and tool_call runs it, the tool list does not show it. save_screenshot.listed = false; diff --git a/src/slic3r/GUI/NativeCommandMenuItems.hpp b/src/slic3r/GUI/NativeCommandMenuItems.hpp index 25d212a546..33ddc1977f 100644 --- a/src/slic3r/GUI/NativeCommandMenuItems.hpp +++ b/src/slic3r/GUI/NativeCommandMenuItems.hpp @@ -13,11 +13,11 @@ namespace GUI { enum class CalibKind : int; -// The functions of the Speed Dial's menu items that are tiles of a command: each does what its item does, as a +// The functions of the Speed Dial's menu items that are actions of a command: each does what its item does, as a // person's pick of the item does it: on what is selected in the Prepare view, on the current plate, or on the app and // its windows. A command made from menu items calls the function of the menu item its variant argument names, and a typed tool -// calls one when a call's arguments are that item's tile's (Mcp::person_form()), or, where the item does what the tool -// does (Auto-Arrange), for a person's pick of the tile alone (NativeCommands::with_menu_item_forms()). They are defined in +// calls one when a call's arguments are those of that item's action (Mcp::person_form()), or, where the item does what the +// tool does (Auto-Arrange), for a person's pick of the action alone (NativeCommands::with_menu_item_forms()). They are defined in // NativeCommands.cpp, beside the helpers the menu items share. UI thread. namespace MenuItems { diff --git a/src/slic3r/GUI/NativeCommands.cpp b/src/slic3r/GUI/NativeCommands.cpp index d80d09dcd5..653ea94b16 100644 --- a/src/slic3r/GUI/NativeCommands.cpp +++ b/src/slic3r/GUI/NativeCommands.cpp @@ -115,19 +115,19 @@ void ensure_3d_view(Plater* plater) using NativeCommands::refused; -// The tile of `command` that collects a value whose call `args` is: the tile's args and the value, under its +// The action of `command` that collects a value whose call `args` is: the action's args and the value, under its // input_arg (or its input where it has none), and nothing else; nullptr when none is. -const json* tile_with_input(const NativeCommand& command, const json& args) +const json* action_with_input(const NativeCommand& command, const json& args) { - if (!command.tiles.is_array() || !args.is_object()) + if (!command.actions.is_array() || !args.is_object()) return nullptr; - for (const json& tile : command.tiles) { - const std::string input = tile.value("input", std::string()); + for (const json& action : command.actions) { + const std::string input = action.value("input", std::string()); if (input.empty()) continue; json rest = args; - if (rest.erase(tile.value("input_arg", input)) == 1 && rest == tile.at("args")) - return &tile; + if (rest.erase(action.value("input_arg", input)) == 1 && rest == action.at("args")) + return &action; } return nullptr; } @@ -379,24 +379,24 @@ AppActionRunResult import_preset_file(const boost::filesystem::path& path, bool return {AppActionRunResult::Level::Succeeded, message}; } -// Thin AppAction wrapper for one catalog entry's own tile, or one of its items: identity and presentation come from -// the catalog, run() runs the catalog's command, which outlives the action. The id is keyed by the stable catalog key -// (not the display title), so a rename or a UI-language switch never re-keys the action. +// Thin AppAction wrapper for one catalog entry's own action, or one of its items: identity and presentation come from +// the catalog, run() runs the catalog's command, which outlives the AppAction. The id is keyed by the stable catalog +// key (not the display title), so a rename or a UI-language switch never re-keys it. struct CommandAction : AppAction { - // A Speed Dial pick (ActionRegistry::run()): `args` is empty for a plain pick, or the value a tile with an input - // collects. The tile's own arguments join them (tile_call_args()), and NativeCommands::run() checks the result + // A Speed Dial pick (ActionRegistry::run()): `args` is empty for a plain pick, or the value an action with an input + // collects. The action's own arguments join them (action_call_args()), and NativeCommands::run() checks the result // against the command's schema. AppActionRunResult run(const json& args) const override { - return NativeCommands::run(m_command, tile_call_args(m_tile.is_null() ? nullptr : &m_tile, args)); + return NativeCommands::run(m_command, action_call_args(m_action.is_null() ? nullptr : &m_action, args)); } - // The command's own tile, in its tile_group, else its group. `title` is the command's title in the UI's language. A - // Design command's takes the command's arguments, which its gizmo or dialog would otherwise ask for; any other's - // takes none, as an item of tiles with no arguments does, and runs the command as a person's pick does. + // The command's own action, in its action_group, else its group. `title` is the command's title in the UI's + // language. A Design command's takes the command's arguments, which its gizmo or dialog would otherwise ask for; any + // other's takes none, as an item of actions with no arguments does, and runs the command as a person's pick does. CommandAction(const NativeCommand& c, std::string title) - : CommandAction(c, c.key, std::move(title), c.title, c.tile_group.empty() ? c.group : c.tile_group) + : CommandAction(c, c.key, std::move(title), c.title, c.action_group.empty() ? c.group : c.action_group) { this->input = c.input; this->icon = c.icon; @@ -409,20 +409,21 @@ struct CommandAction : AppAction } } - // The tile `tile` of `c`, in its group, else the command's. `title` is the tile's title in the UI's language. - CommandAction(const NativeCommand& c, const json& tile, std::string title) - : CommandAction(c, tile.at("key").get(), std::move(title), tile.at("title").get(), - tile.value("group", c.group)) + // `action`, an item of `c`'s actions, in its group, else the command's. `title` is the action's title in the UI's + // language. + CommandAction(const NativeCommand& c, const json& action, std::string title) + : CommandAction(c, action.at("key").get(), std::move(title), action.at("title").get(), + action.value("group", c.group)) { - m_tile = tile; - this->icon = tile.at("icon").get(); - this->automation_description = tile.at("description").get(); - this->preset = tile.at("args"); - this->input = tile.value("input", std::string()); + m_action = action; + this->icon = action.at("icon").get(); + this->automation_description = action.at("description").get(); + this->preset = action.at("args"); + this->input = action.value("input", std::string()); this->input_schema = Mcp::object_schema({}); // The value the Speed Dial's second phase collects, typed as the command's argument it goes to. if (!this->input.empty()) { - const std::string to = tile.value("input_arg", this->input); + const std::string to = action.value("input_arg", this->input); const json& property = c.input_schema.at("properties").at(to); this->input_schema = {{"type", "object"}, {"properties", {{this->input, property}}}, @@ -446,7 +447,7 @@ private: } const NativeCommand& m_command; - json m_tile; // the item of m_command's tiles; null for its own tile + json m_action; // the item of m_command's actions; null for its own action }; // The Preferences dialog's tabs, by the names window_open's tab gives them. @@ -460,7 +461,7 @@ constexpr std::pair kPreferencesTabs[] = {{"general } // namespace -// ---- The menu items that are tiles of a command (NativeCommandMenuItems.hpp) ---- +// ---- The menu items that are actions of a command (NativeCommandMenuItems.hpp) ---- json MenuItems::input_file(const char* what) { return Mcp::prop("string", std::string("Absolute path of ") + what + "."); } @@ -1123,8 +1124,8 @@ const CommandCatalog& NativeCommands::instance() return process_catalog != nullptr ? *process_catalog : publish_catalog({}); } -json NativeCommands::tile(std::string key, std::string title, std::string group, std::string icon, json args, std::string description, - std::string input, std::string input_arg) +json NativeCommands::action(std::string key, std::string title, std::string group, std::string icon, json args, std::string description, + std::string input, std::string input_arg) { json item{{"key", std::move(key)}, {"title", std::move(title)}, {"icon", std::move(icon)}, {"description", std::move(description)}, {"args", std::move(args)}}; @@ -1138,17 +1139,17 @@ json NativeCommands::tile(std::string key, std::string title, std::string group, return item; } -std::vector NativeCommands::palette_tiles(const CommandCatalog& catalog) +std::vector NativeCommands::speed_dial_actions(const CommandCatalog& catalog) { - std::vector out; + std::vector out; for (const NativeCommand& c : catalog.commands()) { - // The Design tab's tiles are there only while the tab is shown (ActionRegistry::materialize_design_actions()). + // The Design tab's actions are there only while the tab is shown (ActionRegistry::materialize_design_actions()). if (c.group == kDesignGroup) continue; - if (c.in_palette) + if (c.has_own_action) out.push_back({&c, nullptr}); - if (c.tiles.is_array()) - for (const json& item : c.tiles) + if (c.actions.is_array()) + for (const json& item : c.actions) out.push_back({&c, &item}); } return out; @@ -1156,7 +1157,7 @@ std::vector NativeCommands::palette_tiles(const Com namespace { -// `title`, a title of `command` or of one of its tiles, in the UI's language. +// `title`, a title of `command` or of one of its actions, in the UI's language. wxString translated_title(const NativeCommand& command, const std::string& title) { const char* context = title_context(command); @@ -1165,16 +1166,17 @@ wxString translated_title(const NativeCommand& command, const std::string& title } // namespace -wxString NativeCommands::tile_title(const NativeCommand& command) { return translated_title(command, command.title); } +wxString NativeCommands::action_title(const NativeCommand& command) { return translated_title(command, command.title); } std::unique_ptr NativeCommands::make_action(const NativeCommand& command) { - return std::make_unique(command, into_u8(tile_title(command))); + return std::make_unique(command, into_u8(action_title(command))); } -std::unique_ptr NativeCommands::make_action(const NativeCommand& command, const json& tile) +std::unique_ptr NativeCommands::make_action(const NativeCommand& command, const json& command_action) { - return std::make_unique(command, tile, into_u8(translated_title(command, tile.at("title").get()))); + return std::make_unique(command, command_action, + into_u8(translated_title(command, command_action.at("title").get()))); } const NativeCommand* NativeCommands::find(const std::string& key) { return instance().find(key); } @@ -1253,23 +1255,23 @@ AppActionRunResult NativeCommands::refused(const Ops::Refusal& refusal, AppActio return result; } -NativeCommand NativeCommands::with_person_form(NativeCommand tool, std::function person, +NativeCommand NativeCommands::with_person_form(NativeCommand tool, std::function person, bool person_form_behind_dialogs) { tool.input_schema = Mcp::with_silent(std::move(tool.input_schema), Mcp::person_forms(tool)); return with_menu_item_forms(std::move(tool), std::move(person), person_form_behind_dialogs); } -NativeCommand NativeCommands::with_menu_item_forms(NativeCommand tool, std::function person, +NativeCommand NativeCommands::with_menu_item_forms(NativeCommand tool, std::function person, bool person_form_behind_dialogs, std::vector own_forms) { - // The tiles a call's arguments are matched against, kept apart from the tool this returns. + // The actions a call's arguments are matched against, kept apart from the tool this returns. NativeCommand forms; - forms.in_palette = tool.in_palette; - forms.tiles = tool.tiles; + forms.has_own_action = tool.has_own_action; + forms.actions = tool.actions; // The person's form runs as a ui_command() function does: in place for a person's pick, in one UI closure - // for an automated call, whose reply then says what the pick showed. It is given the tile's arguments, {} for - // the tool's own tile. + // for an automated call, whose reply then says what the pick showed. It is given the action's arguments, {} for + // the tool's own action. const auto given = [](const json& args) { return Mcp::person_form(args) ? json::object() : args; }; const CommandFn asks = ui_command(tool.key, tool.title, tool.group, Mcp::object_schema({}), [person, given](const json& args) { return person(given(args)); }) @@ -1278,9 +1280,9 @@ NativeCommand NativeCommands::with_menu_item_forms(NativeCommand tool, std::func tool.run = [key = tool.key, forms = std::move(forms), own_forms = std::move(own_forms), person = std::move(person), given, asks, checked, silent = std::move(tool.run)](const json& args, ToolContext& ctx) { const bool own = std::find(own_forms.begin(), own_forms.end(), given(args)) != own_forms.end(); - // A person's pick of a tile whose menu item is the tool's own function, or of a tile that collects a value, runs that - // function in place, as a menu item does: no job. - if (ctx.person() && (own || tile_with_input(forms, args) != nullptr)) + // A person's pick of an action whose menu item is the tool's own function, or of an action that collects a value, + // runs that function in place, as a menu item does: no job. + if (ctx.person() && (own || action_with_input(forms, args) != nullptr)) return asks(args, ctx); if (own || !Mcp::person_form(forms, args)) return silent(args, ctx); @@ -1290,9 +1292,9 @@ NativeCommand NativeCommands::with_menu_item_forms(NativeCommand tool, std::func // opens, so it is refused while a modal dialog is open or another call's nested loop runs, in the UI // closure that runs it. Mcp::UiInvoker& ui = ctx.runtime().ui(); - return ui_command(key, {}, {}, Mcp::object_schema({}), [&person, &ui, &given](const json& tile_args) { + return ui_command(key, {}, {}, Mcp::object_schema({}), [&person, &ui, &given](const json& action_args) { ui.require_mutate(); - return person(given(tile_args)); + return person(given(action_args)); }).run(args, ctx); }; return tool; @@ -1302,7 +1304,7 @@ ToolResult NativeCommands::from_run_result(const std::string& key, const AppActi { // An operation's refusal is worded once, in English here as in a tool's reply. const std::string message = result.refusal ? result.refusal->english() : into_u8(result.message); - // A command that did nothing (no selection, no objects) fails here, though the palette shows it as + // A command that did nothing (no selection, no objects) fails here, though the Speed Dial shows it as // information. if (result.level == AppActionRunResult::Level::Error || result.level == AppActionRunResult::Level::Busy || !result.done) { json details; diff --git a/src/slic3r/GUI/NativeCommands.hpp b/src/slic3r/GUI/NativeCommands.hpp index 8a528ed1b8..8644375f00 100644 --- a/src/slic3r/GUI/NativeCommands.hpp +++ b/src/slic3r/GUI/NativeCommands.hpp @@ -27,13 +27,13 @@ struct CatalogOptions }; // Adds the built-in commands to `catalog`, family by family (Mcp::register_app_tools() and the others): the typed -// tools and the commands made from menu items (MenuItems, NativeCommandMenuItems.hpp), whose items are their tiles, eight of them -// with a tile of their own (in_palette). Each is in the group of its place (place_heading()) and is listed, as it runs +// tools and the commands made from menu items (MenuItems, NativeCommandMenuItems.hpp), whose items are their actions, eight of them +// with an action of their own (has_own_action). Each is in the group of its place (place_heading()) and is listed, as it runs // from its arguments, but for the three menu items that take none (window_save_screenshot, script_toggle_panel, // settings_toggle_developer_mode). They come in the order tools/list gives them: tool_search, tool_call and app_state, // then place by place (Tools and actions, The app, The project, Objects, Parts, Plates and on), each place's commands // in the order their families declare them, and Driving the GUI last. Before Driving the GUI, with options.cad, the Design tab's commands -// (Mcp::register_cad_commands()), not listed, of which those with an action have a tile the Speed Dial shows in the +// (Mcp::register_cad_commands()), not listed, of which those with a handler have an action the Speed Dial shows in the // Design tab; without it, in a build with CAD, it records that it leaves them out and why // (Mcp::leave_out_cad_commands()). undo and redo act on the Design tab's history or the project's, a person's pick // as the Edit menu's item does; with options.cad their examples show the Design tab's. Also adds the source of the @@ -56,26 +56,26 @@ void build(const CatalogOptions& options); // switch. Any thread. const CommandCatalog& instance(); -// An item of a command's `tiles`: a menu item folded into the command, which runs it with `args`. `title` and `group` -// (its Speed Dial section) are untranslated msgids, L()-marked by the caller. `input` is the Speed Dial's token for -// the value the item's second phase collects ("percent", "tab"), and `input_arg` the command's argument that value +// An item of a command's `actions`: a menu item folded into the command, which runs it with `args`. `title` and +// `group` (its Speed Dial section) are untranslated msgids, L()-marked by the caller. `input` is the Speed Dial's token +// for the value the item's second phase collects ("percent", "tab"), and `input_arg` the command's argument that value // goes to where it is not named as the token. The item has `group`, `input` and `input_arg` only when they are // given: without a group it is in its command's section. -nlohmann::json tile(std::string key, std::string title, std::string group, std::string icon, nlohmann::json args, - std::string description, std::string input = {}, std::string input_arg = {}); +nlohmann::json action(std::string key, std::string title, std::string group, std::string icon, nlohmann::json args, + std::string description, std::string input = {}, std::string input_arg = {}); -// A tile a person picks from the Speed Dial: `command`'s own (in_palette) when `tile` is null, else the item of its -// tiles `tile` points at. -struct PaletteTile +// An action a person picks from the Speed Dial: `command`'s own (has_own_action) when `action` is null, else the item +// of its actions `action` points at. +struct SpeedDialAction { const NativeCommand* command; - const nlohmann::json* tile; + const nlohmann::json* action; }; -// The tiles a person picks from the Speed Dial whatever tab is shown, in the order their commands were added, a -// command's own first and then each item of its tiles: all but the Design tab's (group kDesignGroup), which the +// The actions a person picks from the Speed Dial whatever tab is shown, in the order their commands were added, a +// command's own first and then each item of its actions: all but the Design tab's (group kDesignGroup), which the // Speed Dial has only while that tab is shown (ActionRegistry::materialize_design_actions()). -std::vector palette_tiles(const CommandCatalog& catalog); +std::vector speed_dial_actions(const CommandCatalog& catalog); // A command whose function runs on the UI thread and says what a person's pick shows. Its run: for a // person's pick (ToolContext::person()), `fn(args)` in place, its result as the reply's notice. For an @@ -93,25 +93,25 @@ NativeCommand ui_command(std::string key, std::string title, std::string group, NativeCommand long_command(std::string key, std::string title, std::string group, nlohmann::json schema, CommandFn fn, bool inline_call = false); -// A typed tool that a person picks too: `tool`, which has its tiles already (its own, in_palette, or items of its -// tiles), with its person's forms (Mcp::person_forms()): {} for its own tile, and the args of each item that collects -// no value. A call that is one of them (Mcp::person_form(tool, args)) is the person's form: `person` given those -// arguments, on the UI thread, as ui_command() runs a function. Any other call is the tool's own function, given the -// arguments as they are. `own_forms` are the tiles whose menu item does what the tool does (view_set's camera tiles): an -// automated call whose arguments, null as {}, are one of them is the tool's own function, and a person's pick of one -// is `person`, which runs the same function in place; they stay person's forms (Mcp::person_form()) for what reads a -// call as a tile's. A person's pick of a tile that collects a value is `person` too, given the tile's call (its args -// and the value), while an automated call of it is the tool's. An agent's call of the person's form is refused while a -// modal dialog is open or another call's nested loop runs (Mcp::UiInvoker::require_mutate()), also where the tool's -// guard lets it run behind dialogs, unless `person_form_behind_dialogs` says the form opens nothing and may run where -// the tool does. The tool's schema stays as it is: it takes its tiles' arguments, and its own function needs nothing a -// tile leaves out. -NativeCommand with_menu_item_forms(NativeCommand tool, std::function person, +// A typed tool that a person picks too: `tool`, which has its actions already (its own, has_own_action, or items of its +// actions), with its person's forms (Mcp::person_forms()): {} for its own action, and the args of each item that +// collects no value. A call that is one of them (Mcp::person_form(tool, args)) is the person's form: `person` given +// those arguments, on the UI thread, as ui_command() runs a function. Any other call is the tool's own function, given +// the arguments as they are. `own_forms` are the actions whose menu item does what the tool does (view_set's camera +// actions): an automated call whose arguments, null as {}, are one of them is the tool's own function, and a person's +// pick of one is `person`, which runs the same function in place; they stay person's forms (Mcp::person_form()) for +// what reads a call as an action's. A person's pick of an action that collects a value is `person` too, given the +// action's call (its args and the value), while an automated call of it is the tool's. An agent's call of the person's +// form is refused while a modal dialog is open or another call's nested loop runs (Mcp::UiInvoker::require_mutate()), +// also where the tool's guard lets it run behind dialogs, unless `person_form_behind_dialogs` says the form opens +// nothing and may run where the tool does. The tool's schema stays as it is: it takes its actions' arguments, and its +// own function needs nothing an action leaves out. +NativeCommand with_menu_item_forms(NativeCommand tool, std::function person, bool person_form_behind_dialogs = false, std::vector own_forms = {}); // with_menu_item_forms() for a tool whose own function requires what its person's forms leave out (a path a dialog asks // for): its schema goes through Mcp::with_silent() with them, so it also takes silent: true, and a call with silent is // the tool's own function, given silent with the other arguments, so that what the function journals keeps it. -NativeCommand with_person_form(NativeCommand tool, std::function person, +NativeCommand with_person_form(NativeCommand tool, std::function person, bool person_form_behind_dialogs = false); // The person's forms of recording_start and recording_stop. UI thread. @@ -145,7 +145,7 @@ AppActionRunResult run(const std::string& key, const nlohmann::json& args = nloh // The same for `command`, which need not be in the process catalog, whether or not OrcaSlicer is closing. AppActionRunResult run(const NativeCommand& command, const nlohmann::json& args = nlohmann::json::object()); -// Shows what a command run from the palette or a menu said: its message as a notification at its level, +// Shows what a command run from the Speed Dial or a menu said: its message as a notification at its level, // nothing for an empty message or a Busy one. UI thread only. void notify_result(const AppActionRunResult& result); @@ -155,25 +155,25 @@ bool recording_active(); // The process catalog's command `key`, or nullptr. Any thread. const NativeCommand* find(const std::string& key); -// A command's title as its tile shows it, in the UI's language, translated in its title_context(): a Design -// command's, its entry's name, in the Design context, as the right-click menu names an item; any other command's -// title with no context. The Speed Dial's tiles, the replay and script editors and the notice of a job a person -// started show a command's title with it; a recording's caption translates the title in the same context on its -// own (title_context()). UI thread only. -wxString tile_title(const NativeCommand& command); +// A command's title as its Speed Dial action shows it, in the UI's language, translated in its title_context(): a +// Design command's, its entry's name, in the Design context, as the right-click menu names an item; any other +// command's title with no context. The Speed Dial's actions, the replay and script editors and the notice of a job a +// person started show a command's title with it; a recording's caption translates the title in the same context on +// its own (title_context()). UI thread only. +wxString action_title(const NativeCommand& command); -// Materialises the own tile of one catalog entry as a runnable AppAction, titled tile_title() with the English title -// and section kept as search aliases; its section is the command's tile_group, or its group where that is empty. A -// Design command's takes the command's arguments; any other's takes none, its preset {}, as an item of tiles with no -// arguments does. Keeps the catalog's identity, presentation and behaviour as the single source of truth; ActionRegistry only stores -// and dispatches the result. The action runs `command`, which outlives it. UI thread only. +// Materialises the own action of one catalog entry as a runnable AppAction, titled action_title() with the English +// title and section kept as search aliases; its section is the command's action_group, or its group where that is +// empty. A Design command's takes the command's arguments; any other's takes none, its preset {}, as an item of +// actions with no arguments does. Keeps the catalog's identity, presentation and behaviour as the single source of +// truth; ActionRegistry only stores and dispatches the result. The AppAction runs `command`, which outlives it. UI thread only. std::unique_ptr make_action(const NativeCommand& command); -// The action of `tile`, one of `command`'s tiles (NativeCommand::tiles): the id of its key, its title translated -// in the command's title_context(), its section (the tile's group, else the command's), its icon and description, -// and its args as the preset. A tile that collects a value takes that value alone, under its input token, typed as -// the command's argument it goes to; any other shows an agent no arguments. Either runs the command with -// tile_call_args() (CommandCatalog.hpp), for a person's pick and action_run alike. UI thread only. -std::unique_ptr make_action(const NativeCommand& command, const nlohmann::json& tile); +// The AppAction of `command_action`, one of `command`'s actions (NativeCommand::actions): the id of its key, its +// title translated in the command's title_context(), its section (the action's group, else the command's), its icon +// and description, and its args as the preset. An action that collects a value takes that value alone, under its +// input token, typed as the command's argument it goes to; any other shows an agent no arguments. Either runs the +// command with action_call_args() (CommandCatalog.hpp), for a person's pick and action_run alike. UI thread only. +std::unique_ptr make_action(const NativeCommand& command, const nlohmann::json& command_action); } // namespace NativeCommands }} // namespace Slic3r::GUI diff --git a/src/slic3r/GUI/Operations/Outcome.hpp b/src/slic3r/GUI/Operations/Outcome.hpp index 261662c8af..f0b361153b 100644 --- a/src/slic3r/GUI/Operations/Outcome.hpp +++ b/src/slic3r/GUI/Operations/Outcome.hpp @@ -30,7 +30,7 @@ struct Refusal std::vector args; // the placeholders' values std::vector names; // names that help the caller: candidates, closest matches - // In the UI's language, for the palette and notifications. + // In the UI's language, for the Speed Dial and notifications. wxString translated() const; // For a tool's reply and a Python exception. std::string english() const; diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp index 17ddbb2828..790d563897 100644 --- a/src/slic3r/GUI/OptionsGroup.cpp +++ b/src/slic3r/GUI/OptionsGroup.cpp @@ -269,7 +269,7 @@ void OptionsGroup::append_line(const Line& line) for (const auto& opt : line.get_options()) { if (!line.label_path.empty()) index.set_path(opt.opt_id, type, line.label_path); - // Mirror the sub-label OG_CustomCtrl draws for a multi-option row, so the palette + // Mirror the sub-label OG_CustomCtrl draws for a multi-option row, so the Speed Dial // names each field like the page does. const std::string& leaf_src = opt.opt.label; const wxString leaf = (leaf_src == L_CONTEXT("Top", "Layers") || leaf_src == L_CONTEXT("Bottom", "Layers")) ? diff --git a/src/slic3r/plugin/host/PluginHostTools.cpp b/src/slic3r/plugin/host/PluginHostTools.cpp index b450b08a13..0fb7304ab9 100644 --- a/src/slic3r/plugin/host/PluginHostTools.cpp +++ b/src/slic3r/plugin/host/PluginHostTools.cpp @@ -221,9 +221,9 @@ void register_tools(py::module_& host) }, py::arg("name"), "The command `name` as a dict: key, title, group (as list() gives it), description, input_schema (the JSON " - "Schema of its arguments), examples when it has some ([{title, calls: [{tool, args}]}]), listed, in_palette (it " - "has a tile of its own in the Speed Dial), tiles when it has some (the Speed Dial's tiles that run it with their " - "args), the access labels read_only, destructive, idempotent and open_world, guard " + "Schema of its arguments), examples when it has some ([{title, calls: [{tool, args}]}]), listed, has_own_action " + "(it has an action of its own in the Speed Dial), actions when it has some (the Speed Dial's actions that run it " + "with their args), the access labels read_only, destructive, idempotent and open_world, guard " "(inspect, recover or mutate: what it may do behind a dialog), completion and operations. An unknown name " "raises ToolError, whose details hold did_you_mean, the closest names. Any thread."); } diff --git a/tests/automation/automation_test_utils.hpp b/tests/automation/automation_test_utils.hpp index 4aaf67bf85..3ee43a92df 100644 --- a/tests/automation/automation_test_utils.hpp +++ b/tests/automation/automation_test_utils.hpp @@ -26,11 +26,11 @@ // core with a type of the GUI library. namespace Slic3r { namespace GUI { namespace Mcp { namespace Test { -inline NativeCommand command(std::string key, bool in_palette = false) +inline NativeCommand command(std::string key, bool has_own_action = false) { NativeCommand c; - c.key = std::move(key); - c.in_palette = in_palette; + c.key = std::move(key); + c.has_own_action = has_own_action; return c; } diff --git a/tests/automation/test_command_catalog.cpp b/tests/automation/test_command_catalog.cpp index f5575eaa44..1e46f0163c 100644 --- a/tests/automation/test_command_catalog.cpp +++ b/tests/automation/test_command_catalog.cpp @@ -119,11 +119,11 @@ TEST_CASE("the person's form is the call with no arguments", "[CommandCatalog]") CHECK(Mcp::silent_args({{"silent", true}, {"path", "a"}}) == json{{"path", "a"}}); } -TEST_CASE("a call with exactly a tile's arguments is the person's form", "[CommandCatalog]") +TEST_CASE("a call with exactly an action's arguments is the person's form", "[CommandCatalog]") { - // A command with a tile of its own, a tile that mirrors along X and one that collects a tab in the Speed Dial. - NativeCommand c = command("view_it", /*in_palette=*/true); - c.tiles = json::array({json{{"key", "view_x"}, {"title", "X"}, {"group", "View"}, {"icon", ""}, {"description", ""}, + // A command with an action of its own, an action that mirrors along X and one that collects a tab in the Speed Dial. + NativeCommand c = command("view_it", /*has_own_action=*/true); + c.actions = json::array({json{{"key", "view_x"}, {"title", "X"}, {"group", "View"}, {"icon", ""}, {"description", ""}, {"args", {{"axis", "x"}}}}, json{{"key", "view_tab"}, {"title", "Tab"}, {"group", "Commands"}, {"icon", ""}, {"description", ""}, {"args", json::object()}, {"input", "tab"}}}); @@ -134,9 +134,9 @@ TEST_CASE("a call with exactly a tile's arguments is the person's form", "[Comma CHECK_FALSE(Mcp::person_form(c, {{"axis", "x"}, {"silent", true}})); CHECK_FALSE(Mcp::person_form(c, {{"silent", true}})); - // A tile that collects a value is no person's form: its value comes from the Speed Dial's second phase. + // An action that collects a value is no person's form: its value comes from the Speed Dial's second phase. NativeCommand collects = command("go_to"); - collects.tiles = json::array({json{{"key", "go_to_tab"}, {"title", "Tab"}, {"group", "Commands"}, {"icon", ""}, + collects.actions = json::array({json{{"key", "go_to_tab"}, {"title", "Tab"}, {"group", "Commands"}, {"icon", ""}, {"description", ""}, {"args", json::object()}, {"input", "tab"}}}); CHECK_FALSE(Mcp::person_form(collects, json::object())); } @@ -179,7 +179,7 @@ TEST_CASE("a two-form schema requires its arguments only when some are given", " CHECK_THAT(Mcp::validate_arguments(s, {{"silent", false}}), ContainsSubstring("silent")); } -TEST_CASE("a reference entry has the command's fields, and its examples and tiles only when it has some", "[CommandCatalog][Reference]") +TEST_CASE("a reference entry has the command's fields, and its examples and actions only when it has some", "[CommandCatalog][Reference]") { NativeCommand c = command("export_it", true); c.title = "Export It"; @@ -197,7 +197,7 @@ TEST_CASE("a reference entry has the command's fields, and its examples and tile {"description", "Exports it."}, {"input_schema", c.input_schema}, {"listed", false}, - {"in_palette", true}, + {"has_own_action", true}, {"read_only", false}, {"destructive", false}, {"idempotent", false}, @@ -214,22 +214,22 @@ TEST_CASE("a reference entry has the command's fields, and its examples and tile CHECK(other["guard"] == "inspect"); CHECK(other["completion"] == "immediate"); CHECK(other["examples"] == c.examples); - CHECK_FALSE(other.contains("tiles")); + CHECK_FALSE(other.contains("actions")); c.guard = GuardClass::Mutate; CHECK(Slic3r::GUI::command_reference(c)["guard"] == "mutate"); - c.tiles = json::array({json{{"key", "export_it_pdf"}, {"title", "Export as PDF"}, {"icon", ""}, {"description", ""}, - {"args", {{"format", "pdf"}}}}}); - CHECK(Slic3r::GUI::command_reference(c)["tiles"] == c.tiles); + c.actions = json::array({json{{"key", "export_it_pdf"}, {"title", "Export as PDF"}, {"icon", ""}, {"description", ""}, + {"args", {{"format", "pdf"}}}}}); + CHECK(Slic3r::GUI::command_reference(c)["actions"] == c.actions); - // What a person sees of its own tile, once it has any. + // What a person sees of its own action, once it has any. CHECK_FALSE(entry.contains("icon")); CHECK_FALSE(entry.contains("input")); - CHECK_FALSE(entry.contains("tile_group")); - c.icon = "menu_save"; - c.input = "tab"; - c.tile_group = "Commands"; + CHECK_FALSE(entry.contains("action_group")); + c.icon = "menu_save"; + c.input = "tab"; + c.action_group = "Commands"; const json shown = Slic3r::GUI::command_reference(c); CHECK(shown["icon"] == "menu_save"); CHECK(shown["input"] == "tab"); - CHECK(shown["tile_group"] == "Commands"); + CHECK(shown["action_group"] == "Commands"); } diff --git a/tests/automation/test_mcp_replay_summary.cpp b/tests/automation/test_mcp_replay_summary.cpp index 05e2ca8d41..f91c8e407c 100644 --- a/tests/automation/test_mcp_replay_summary.cpp +++ b/tests/automation/test_mcp_replay_summary.cpp @@ -24,58 +24,59 @@ using Flags = std::vector; const Flags kEveryFlag{"writes_file", "changes_presets", "replaces_project", "sends_to_printer"}; -// The commands the cases call by their key, with tiles and places in the tool list as the app's catalog has them: -// commands whose menu items are their tiles, view_set's two among them collecting a value, and object_mirror's -// two, one of which has a Speed Dial section of its own; plate_delete, with a tile of its own; all of them listed, as -// they run from their arguments. And export_drawing, made up, with a tile of its own and one that runs it with +// The commands the cases call by their key, with actions and places in the tool list as the app's catalog has them: +// commands whose menu items are their actions, view_set's two among them collecting a value, and object_mirror's +// two, one of which has a Speed Dial section of its own; plate_delete, with an action of its own; all of them listed, +// as they run from their arguments. And export_drawing, made up, with an action of its own and one that runs it with // {"format": "pdf"}, which the tool list does not show, as a Design command. Every other tool the cases name is a // typed tool, which the summary describes by its name. -CommandCatalog tile_catalog() +CommandCatalog action_catalog() { CommandCatalog catalog; - const auto tile = [](const char* key, const char* title, json args) { + const auto entry = [](const char* key, const char* title, json args) { return json{{"key", key}, {"title", title}, {"icon", ""}, {"description", ""}, {"args", std::move(args)}}; }; - // A tile whose second phase collects a value under `input`, which goes to the command's `input_arg`. - const auto collects = [&tile](const char* key, const char* title, const char* input, const char* input_arg) { - json item = tile(key, title, json::object()); + // An action whose second phase collects a value under `input`, which goes to the command's `input_arg`. + const auto collects = [&entry](const char* key, const char* title, const char* input, const char* input_arg) { + json item = entry(key, title, json::object()); item["input"] = input; item["input_arg"] = input_arg; return item; }; - const auto add = [&catalog](const char* key, bool listed, bool in_palette, json tiles) { + const auto add = [&catalog](const char* key, bool listed, bool has_own_action, json actions) { NativeCommand command; - command.key = key; - command.listed = listed; - command.in_palette = in_palette; - command.tiles = std::move(tiles); + command.key = key; + command.listed = listed; + command.has_own_action = has_own_action; + command.actions = std::move(actions); catalog.add(std::move(command)); }; - add("project_new", true, false, json::array({tile("new_project", "New Project", json::object())})); - add("project_open", true, false, json::array({tile("load_project", "Load Project", json::object())})); - add("project_import", true, false, json::array({tile("import_file", "Import 3MF/STL/STEP/SVG/OBJ/AMF", json::object())})); + add("project_new", true, false, json::array({entry("new_project", "New Project", json::object())})); + add("project_open", true, false, json::array({entry("load_project", "Load Project", json::object())})); + add("project_import", true, false, json::array({entry("import_file", "Import 3MF/STL/STEP/SVG/OBJ/AMF", json::object())})); add("project_save", true, false, - json::array({tile("save_project", "Save Project", json::object()), tile("save_project_as", "Save Project As", {{"save_as", true}})})); - add("project_export", true, false, json::array({tile("export_gcode", "Export G-code", {{"format", "gcode"}})})); + json::array({entry("save_project", "Save Project", json::object()), + entry("save_project_as", "Save Project As", {{"save_as", true}})})); + add("project_export", true, false, json::array({entry("export_gcode", "Export G-code", {{"format", "gcode"}})})); add("calibration_generate_test", true, false, - json::array({tile("calib_flow_ratio", "Flow Ratio Calibration", {{"test", "flow_ratio"}})})); - add("plate_slice", true, false, json::array({tile("slice_all", "Slice All Plates", {{"plates", "all"}, {"preview", true}})})); + json::array({entry("calib_flow_ratio", "Flow Ratio Calibration", {{"test", "flow_ratio"}})})); + add("plate_slice", true, false, json::array({entry("slice_all", "Slice All Plates", {{"plates", "all"}, {"preview", true}})})); add("view_set", true, false, - json::array({tile("view_top", "View: Top", {{"camera", "top"}}), collects("go_to_tab", "Go to tab...", "tab", "tab"), + json::array({entry("view_top", "View: Top", {{"camera", "top"}}), collects("go_to_tab", "Go to tab...", "tab", "tab"), collects("go_to_layer", "Go to layer (percent)", "percent", "layer_percent")})); - add("object_add_primitive", true, false, json::array({tile("add_primitive_cube", "Cube", {{"shape", "cube"}})})); - add("object_set_instances", true, false, json::array({tile("obj_set_instances", "Set Number of Instances", json::object())})); - json mirror_x = tile("obj_mirror_x", "Mirror X", {{"axis", "x"}}); + add("object_add_primitive", true, false, json::array({entry("add_primitive_cube", "Cube", {{"shape", "cube"}})})); + add("object_set_instances", true, false, json::array({entry("obj_set_instances", "Set Number of Instances", json::object())})); + json mirror_x = entry("obj_mirror_x", "Mirror X", {{"axis", "x"}}); mirror_x["group"] = "Object"; - add("object_mirror", true, false, json::array({std::move(mirror_x), tile("obj_mirror_y", "Mirror Y", {{"axis", "y"}})})); - add("preset_export", true, false, json::array({tile("export_config", "Export Preset Bundle", json::object())})); - add("preset_sync", true, false, json::array({tile("sync_presets", "Sync Presets", json::object())})); - add("printer_send", true, false, json::array({tile("send_gcode", "Send G-code to printer host", json::object())})); + add("object_mirror", true, false, json::array({std::move(mirror_x), entry("obj_mirror_y", "Mirror Y", {{"axis", "y"}})})); + add("preset_export", true, false, json::array({entry("export_config", "Export Preset Bundle", json::object())})); + add("preset_sync", true, false, json::array({entry("sync_presets", "Sync Presets", json::object())})); + add("printer_send", true, false, json::array({entry("send_gcode", "Send G-code to printer host", json::object())})); add("window_open", true, false, - json::array({tile("open_preferences", "Preferences", {{"window", "preferences"}}), - tile("preset_bundle", "Open Preset Bundle", {{"window", "preset_bundle"}})})); + json::array({entry("open_preferences", "Preferences", {{"window", "preferences"}}), + entry("preset_bundle", "Open Preset Bundle", {{"window", "preset_bundle"}})})); add("plate_delete", true, true, json()); - add("export_drawing", false, true, json::array({tile("export_drawing_pdf", "Export as PDF", {{"format", "pdf"}})})); + add("export_drawing", false, true, json::array({entry("export_drawing_pdf", "Export as PDF", {{"format", "pdf"}})})); catalog.seal(); return catalog; } @@ -90,7 +91,7 @@ StepDescription describe(const std::string& step, const std::string& vars = "{}" ReplayContext ctx; ctx.replay_dir = "C:/replays"; ctx.out_dir = "C:/out"; - return describe_step(tile_catalog(), replay->steps[0], *replay, ctx); + return describe_step(action_catalog(), replay->steps[0], *replay, ctx); } Flags flags_of(const StepDescription& d) @@ -162,15 +163,15 @@ TEST_CASE("project tools replace the project after checking for unsaved changes" const StepDescription asked = describe(R"({"tool": "project_new", "args": {}})"); CHECK(flags_of(asked) == Flags{"replaces_project"}); CHECK(asked.replace == "app_asked"); - // A test called with its tile's arguments opens its dialog, as the Calibration menu does. + // A test called with its action's arguments opens its dialog, as the Calibration menu does. const StepDescription dialog = describe(R"({"tool": "calibration_generate_test", "args": {"test": "flow_ratio"}})"); CHECK(flags_of(dialog) == Flags{"changes_presets", "replaces_project"}); CHECK(dialog.replace == "app_asked"); } -TEST_CASE("a command called by name is described as its tile is", "[Mcp]") +TEST_CASE("a command called by name is described as its action is", "[Mcp]") { - const auto [key, tile_key, args, flags] = GENERATE_COPY(table({ + const auto [key, action_key, args, flags] = GENERATE_COPY(table({ {"preset_export", "export_config", json::object(), {"writes_file"}}, {"preset_sync", "sync_presets", json::object(), {"changes_presets"}}, {"window_open", "preset_bundle", {{"window", "preset_bundle"}}, {"changes_presets"}}, @@ -178,27 +179,27 @@ TEST_CASE("a command called by name is described as its tile is", "[Mcp]") {"plate_delete", "plate_delete", json::object(), {}}, })); INFO(key << " " << args.dump()); - const StepDescription by_name = describe(json{{"tool", key}, {"args", args}}.dump()); - const StepDescription tile = describe(action("orca_command:" + tile_key + ":orca")); + const StepDescription by_name = describe(json{{"tool", key}, {"args", args}}.dump()); + const StepDescription by_action = describe(action("orca_command:" + action_key + ":orca")); CHECK(flags_of(by_name) == flags); - CHECK(flags_of(by_name) == flags_of(tile)); - CHECK(by_name.replace == tile.replace); - CHECK(by_name.what == tile.what); - CHECK(describe_call(tile_catalog(), key, args) == tile.what); + CHECK(flags_of(by_name) == flags_of(by_action)); + CHECK(by_name.replace == by_action.replace); + CHECK(by_name.what == by_action.what); + CHECK(describe_call(action_catalog(), key, args) == by_action.what); } -TEST_CASE("a tile that runs its command with arguments is described as that call is", "[Mcp]") +TEST_CASE("an action that runs its command with arguments is described as that call is", "[Mcp]") { - const auto [key, tile, args, flags] = GENERATE_COPY(table({ + const auto [key, action_key, args, flags] = GENERATE_COPY(table({ {"project_export", "export_gcode", {{"format", "gcode"}}, {"writes_file"}}, {"calibration_generate_test", "calib_flow_ratio", {{"test", "flow_ratio"}}, {"changes_presets", "replaces_project"}}, {"object_set_instances", "obj_set_instances", json::object(), {}}, {"object_mirror", "obj_mirror_y", {{"axis", "y"}}, {}}, })); INFO(key << " " << args.dump()); - const json what{{"kind", "command"}, {"key", key}, {"tile", tile}}; - const std::string id = "orca_command:" + tile + ":orca"; - // The tile's action with no arguments and with its own, and the call of its command with them. + const json what{{"kind", "command"}, {"key", key}, {"action", action_key}}; + const std::string id = "orca_command:" + action_key + ":orca"; + // The action with no arguments and with its own, and the call of its command with them. const StepDescription picked = describe(action(id)); const StepDescription given = describe(action(id, args)); const StepDescription called = describe(json{{"tool", key}, {"args", args}}.dump()); @@ -207,20 +208,20 @@ TEST_CASE("a tile that runs its command with arguments is described as that call CHECK(flags_of(*d) == flags); CHECK(d->replace == picked.replace); } - CHECK(describe_call(tile_catalog(), key, args) == what); - CHECK(describe_call(tile_catalog(), "action_run", {{"id", id}}) == what); - CHECK(describe_call(tile_catalog(), "action_run", {{"id", tile}}) == what); + CHECK(describe_call(action_catalog(), key, args) == what); + CHECK(describe_call(action_catalog(), "action_run", {{"id", id}}) == what); + CHECK(describe_call(action_catalog(), "action_run", {{"id", action_key}}) == what); } -TEST_CASE("a call with other arguments than a tile's is described by its arguments", "[Mcp]") +TEST_CASE("a call with other arguments than an action's is described by its arguments", "[Mcp]") { const json what{{"kind", "command"}, {"key", "export_drawing"}, {"args", {"format: svg"}}}; CHECK(describe(R"({"tool": "export_drawing", "args": {"format": "svg"}})").what == what); CHECK(describe(action("orca_command:export_drawing:orca", {{"format", "svg"}})).what == what); - // The command's own tile with the other tile's arguments is that tile. + // The command's own action with the other action's arguments is that action. CHECK(describe(action("orca_command:export_drawing:orca", {{"format", "pdf"}})).what == - json{{"kind", "command"}, {"key", "export_drawing"}, {"tile", "export_drawing_pdf"}}); - // A command made from menu items called with arguments no tile has is described as a typed tool's call, with what it + json{{"kind", "command"}, {"key", "export_drawing"}, {"action", "export_drawing_pdf"}}); + // A command made from menu items called with arguments no action has is described as a typed tool's call, with what it // does whichever way it is called. const StepDescription exported = describe(json{{"tool", "preset_export"}, {"args", {{"path", abs_path("presets")}}}}.dump()); CHECK(exported.what == json{{"kind", "files"}, {"names", {"presets"}}}); @@ -228,20 +229,20 @@ TEST_CASE("a call with other arguments than a tile's is described by its argumen CHECK(flags_of(describe(json{{"tool", "preset_import"}, {"args", {{"path", abs_path("a.json")}}}}.dump())) == Flags{"changes_presets"}); } -TEST_CASE("a tile that collects a value is described with it, and a call without it is no tile", "[Mcp]") +TEST_CASE("an action that collects a value is described with it, and a call without it is no action's call", "[Mcp]") { - // Go to layer's percent reaches view_set as layer_percent, which the description shows with the tile. + // Go to layer's percent reaches view_set as layer_percent, which the description shows with the action. CHECK(describe(action("orca_command:go_to_layer:orca", {{"percent", 50}})).what == - json{{"kind", "command"}, {"key", "view_set"}, {"tile", "go_to_layer"}, {"args", {"layer_percent: 50"}}}); + json{{"kind", "command"}, {"key", "view_set"}, {"action", "go_to_layer"}, {"args", {"layer_percent: 50"}}}); CHECK(describe(action("orca_command:go_to_tab:orca", {{"tab", "preview"}})).what == - json{{"kind", "command"}, {"key", "view_set"}, {"tile", "go_to_tab"}, {"args", {"tab: preview"}}}); - // view_set called with no arguments is no tile's call: the two tiles with nothing of their own collect a value. - CHECK(describe_call(tile_catalog(), "view_set", json::object()).is_null()); - CHECK(describe_call(tile_catalog(), "view_set", {{"camera", "top"}}) == - json{{"kind", "command"}, {"key", "view_set"}, {"tile", "view_top"}}); + json{{"kind", "command"}, {"key", "view_set"}, {"action", "go_to_tab"}, {"args", {"tab: preview"}}}); + // view_set called with no arguments is no action's call: the two actions with nothing of their own collect a value. + CHECK(describe_call(action_catalog(), "view_set", json::object()).is_null()); + CHECK(describe_call(action_catalog(), "view_set", {{"camera", "top"}}) == + json{{"kind", "command"}, {"key", "view_set"}, {"action", "view_top"}}); } -TEST_CASE("a step that calls a tile's command by its key is described from the catalog it is given", "[Mcp]") +TEST_CASE("a step that calls an action's command by its key is described from the catalog it is given", "[Mcp]") { std::string err; const auto replay = parse_replay(R"({"orca_replay_version": "0.2.0", "steps": [ @@ -253,18 +254,18 @@ TEST_CASE("a step that calls a tile's command by its key is described from the c ReplayContext ctx; ctx.out_dir = "C:/out"; - // filament_delete as the app's catalog has it: listed, with a tile of its own. + // filament_delete as the app's catalog has it: listed, with an action of its own. CommandCatalog catalog; NativeCommand filament_delete; - filament_delete.key = "filament_delete"; - filament_delete.in_palette = true; - filament_delete.listed = true; + filament_delete.key = "filament_delete"; + filament_delete.has_own_action = true; + filament_delete.listed = true; catalog.add(std::move(filament_delete)); catalog.seal(); - const StepDescription tile = describe_step(catalog, replay->steps[0], *replay, ctx); - REQUIRE(tile.what.is_object()); - CHECK(tile.what.value("kind", "") == "command"); - CHECK(tile.what.value("key", "") == "filament_delete"); + const StepDescription own = describe_step(catalog, replay->steps[0], *replay, ctx); + REQUIRE(own.what.is_object()); + CHECK(own.what.value("kind", "") == "command"); + CHECK(own.what.value("key", "") == "filament_delete"); // With arguments of its own it is its silent form, described from them as a typed tool's call is. CHECK(describe_step(catalog, replay->steps[1], *replay, ctx).what == json{{"kind", "value"}, {"text", "filament_slot: 2"}}); @@ -276,8 +277,9 @@ TEST_CASE("a step that calls a tile's command by its key is described from the c TEST_CASE("speed dial actions are flagged by their id", "[Mcp]") { - // A tile's id reaches its command through find_tile(), and the command and its arguments decide the flags: a tile's - // call and a call of its command with those arguments, or with a path beside them, are flagged alike. + // An action's id reaches its command through find_command_action(), and the command and its arguments decide the + // flags: an action's call and a call of its command with those arguments, or with a path beside them, are flagged + // alike. struct Case { std::string step; @@ -298,7 +300,7 @@ TEST_CASE("speed dial actions are flagged by their id", "[Mcp]") {action("orca_command:new_project:orca"), {"replaces_project"}, "app_asked"}, {action("orca_command:load_project:orca"), {"replaces_project"}, "app_asked"}, {action("orca_command:import_file:orca"), {}, ""}, - // A tile by the key inside its id, as action_run takes it. + // An action by the key inside its id, as action_run takes it. {action("export_gcode"), {"writes_file"}, ""}, {action("new_project"), {"replaces_project"}, "app_asked"}, {action("send_gcode"), {"sends_to_printer"}, ""}, @@ -311,7 +313,7 @@ TEST_CASE("speed dial actions are flagged by their id", "[Mcp]") {action("orca_setting:layer_height:1"), {}, ""}, {action("plugin_replay_action:tool:plugin"), kEveryFlag, "app_asked"}, {action("plugin_page_action:page:plugin"), kEveryFlag, "app_asked"}, - // A name inside an id that is no tile may be another action's, whose effect can't be read. + // A name inside an id that is no command's action may be another action's, whose effect can't be read. {action("page"), kEveryFlag, "app_asked"}, })); INFO(c.step); @@ -330,20 +332,21 @@ TEST_CASE("speed dial actions describe their command and file", "[Mcp]") { const json none = json::object(); const auto [id, args, what] = GENERATE_COPY(table({ - {"orca_command:import_file:orca", none, {{"kind", "command"}, {"key", "project_import"}, {"tile", "import_file"}}}, - {"orca_command:save_project_as:orca", none, {{"kind", "command"}, {"key", "project_save"}, {"tile", "save_project_as"}}}, - {"orca_command:export_config:orca", none, {{"kind", "command"}, {"key", "preset_export"}, {"tile", "export_config"}}}, + {"orca_command:import_file:orca", none, {{"kind", "command"}, {"key", "project_import"}, {"action", "import_file"}}}, + {"orca_command:save_project_as:orca", none, {{"kind", "command"}, {"key", "project_save"}, {"action", "save_project_as"}}}, + {"orca_command:export_config:orca", none, {{"kind", "command"}, {"key", "preset_export"}, {"action", "export_config"}}}, {"orca_command:go_to_layer:orca", {{"percent", 50}}, - {{"kind", "command"}, {"key", "view_set"}, {"tile", "go_to_layer"}, {"args", {"layer_percent: 50"}}}}, - {"orca_command:add_primitive_cube:orca", none, {{"kind", "command"}, {"key", "object_add_primitive"}, {"tile", "add_primitive_cube"}}}, - {"orca_command:slice_all:orca", none, {{"kind", "command"}, {"key", "plate_slice"}, {"tile", "slice_all"}}}, - // A tile with a Speed Dial section of its own is described as any other. - {"orca_command:obj_mirror_x:orca", none, {{"kind", "command"}, {"key", "object_mirror"}, {"tile", "obj_mirror_x"}}}, - {"orca_command:obj_mirror_y:orca", none, {{"kind", "command"}, {"key", "object_mirror"}, {"tile", "obj_mirror_y"}}}, - // A tile by the key inside its id, as action_run takes it, a command's own tile among them. - {"export_gcode", none, {{"kind", "command"}, {"key", "project_export"}, {"tile", "export_gcode"}}}, + {{"kind", "command"}, {"key", "view_set"}, {"action", "go_to_layer"}, {"args", {"layer_percent: 50"}}}}, + {"orca_command:add_primitive_cube:orca", none, + {{"kind", "command"}, {"key", "object_add_primitive"}, {"action", "add_primitive_cube"}}}, + {"orca_command:slice_all:orca", none, {{"kind", "command"}, {"key", "plate_slice"}, {"action", "slice_all"}}}, + // An action with a Speed Dial section of its own is described as any other. + {"orca_command:obj_mirror_x:orca", none, {{"kind", "command"}, {"key", "object_mirror"}, {"action", "obj_mirror_x"}}}, + {"orca_command:obj_mirror_y:orca", none, {{"kind", "command"}, {"key", "object_mirror"}, {"action", "obj_mirror_y"}}}, + // An action by the key inside its id, as action_run takes it, a command's own action among them. + {"export_gcode", none, {{"kind", "command"}, {"key", "project_export"}, {"action", "export_gcode"}}}, {"go_to_layer", {{"percent", 50}}, - {{"kind", "command"}, {"key", "view_set"}, {"tile", "go_to_layer"}, {"args", {"layer_percent: 50"}}}}, + {{"kind", "command"}, {"key", "view_set"}, {"action", "go_to_layer"}, {"args", {"layer_percent: 50"}}}}, {"plate_delete", none, {{"kind", "command"}, {"key", "plate_delete"}}}, {"orca_recent_project:C:/p/a.3mf:orca", none, {{"kind", "recent_project"}, {"name", "a.3mf"}}}, {"orca_setting:layer_height:1", none, {{"kind", "value"}, {"text", "layer_height"}}}, @@ -484,8 +487,8 @@ TEST_CASE("saved jobs don't change a step's flags", "[Mcp]") without.out_dir = "C:/out"; ReplayContext with = without; with.jobs = json{{"p", "j12"}}; - const StepDescription a = describe_step(tile_catalog(), replay->steps[0], *replay, without); - const StepDescription b = describe_step(tile_catalog(), replay->steps[0], *replay, with); + const StepDescription a = describe_step(action_catalog(), replay->steps[0], *replay, without); + const StepDescription b = describe_step(action_catalog(), replay->steps[0], *replay, with); CHECK(flags_of(a) == flags_of(b)); CHECK(a.replace == b.replace); CHECK(a.answers_dialogs == b.answers_dialogs); diff --git a/tests/data/command_catalog.json b/tests/data/command_catalog.json index 63b2066ff5..51deff783e 100644 --- a/tests/data/command_catalog.json +++ b/tests/data/command_catalog.json @@ -6,8 +6,8 @@ "destructive": false, "group": "Tools and actions", "guard": "inspect", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -45,8 +45,8 @@ "destructive": false, "group": "Tools and actions", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -77,8 +77,8 @@ "destructive": false, "group": "The app", "guard": "inspect", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": {}, @@ -97,8 +97,8 @@ "destructive": false, "group": "Tools and actions", "guard": "inspect", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -136,12 +136,12 @@ }, { "completion": "immediate", - "description": "Run one action by the id action_search returned (orca_command:view_front:orca, or the name inside it, view_front), with args, the command's arguments, when it takes some (its input_schema). A command's tile (action_search names the command) runs the command as a call with the tile's arguments does: a tile that asks in a dialog asks, and the call returns blocked_by_dialog; answer it with dialog_answer, or, for a native one it can't press (a file picker), register dialog_auto_answer before the call. Such a tile takes no args, or exactly its own; to run a command without asking, call it with its arguments (an absolute path skips a file dialog). Go to layer and Go to tab take their value alone ({\"percent\": 50}, {\"tab\": \"preview\"}), and a Design command's own tile takes the command's arguments. An action that starts a background job (obj_arrange, obj_orient) completes when the job ends. An action that does nothing (no object selected) is an error. Some commands add what they did to the reply (the order object_order leaves, the object object_assemble made). The other actions (plates, recent projects, plugin scripts and pages, settings) run only here.", + "description": "Run one action by the id action_search returned (orca_command:view_front:orca, or the name inside it, view_front), with args, the command's arguments, when it takes some (its input_schema). A command's action (action_search names the command) runs the command as a call with the action's arguments does: an action that asks in a dialog asks, and the call returns blocked_by_dialog; answer it with dialog_answer, or, for a native one it can't press (a file picker), register dialog_auto_answer before the call. Such an action takes no args, or exactly its own; to run a command without asking, call it with its arguments (an absolute path skips a file dialog). Go to layer and Go to tab take their value alone ({\"percent\": 50}, {\"tab\": \"preview\"}), and a Design command's own action takes the command's arguments. An action that starts a background job (obj_arrange, obj_orient) completes when the job ends. An action that does nothing (no object selected) is an error. Some commands add what they did to the reply (the order object_order leaves, the object object_assemble made). The other actions (plates, recent projects, plugin scripts and pages, settings) run only here.", "destructive": false, "group": "Tools and actions", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -172,8 +172,8 @@ "destructive": false, "group": "The app", "guard": "inspect", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -214,8 +214,8 @@ "destructive": false, "group": "The app", "guard": "inspect", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -248,6 +248,7 @@ "title": "Read the log" }, { + "action_group": "Commands", "completion": "immediate", "description": "Take back the last change of a history, as Edit > Undo does. history design is the Design tab's: the last feature added, edited, deleted, moved, shown or hidden, or renamed, or variable changed, or in a sketch session the last drawn shape; project is the project's. Without history, the Design tab's while it is shown, else the project's. Reply: history and, for the Design tab's, result: scope (design or sketch), undo_depth, redo_depth, features, bodies and generation; entities in a sketch.", "destructive": false, @@ -320,9 +321,9 @@ ], "group": "The app", "guard": "mutate", + "has_own_action": true, "icon": "menu_undo", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "properties": { @@ -342,10 +343,10 @@ "open_world": false, "operations": [], "read_only": false, - "tile_group": "Commands", "title": "Undo" }, { + "action_group": "Commands", "completion": "immediate", "description": "Put back what undo took back, until the next change, as Edit > Redo does, in the history undo takes. Reply as undo's.", "destructive": false, @@ -430,9 +431,9 @@ ], "group": "The app", "guard": "mutate", + "has_own_action": true, "icon": "menu_redo", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "properties": { @@ -452,41 +453,10 @@ "open_world": false, "operations": [], "read_only": false, - "tile_group": "Commands", "title": "Redo" }, { - "completion": "immediate", - "description": "Open one of OrcaSlicer's web pages in the default web browser, as its menu item does: wiki, the OrcaSlicer wiki; youtube, the OrcaSlicer YouTube channel; plugin_hub, the plugin hub's page, where a person picks a plugin to install. Nothing opens in OrcaSlicer.", - "destructive": false, - "group": "The app", - "guard": "mutate", - "idempotent": false, - "in_palette": false, - "input_schema": { - "additionalProperties": false, - "properties": { - "page": { - "description": "The page.", - "enum": [ - "wiki", - "youtube", - "plugin_hub" - ], - "type": "string" - } - }, - "required": [ - "page" - ], - "type": "object" - }, - "key": "app_open_web_page", - "listed": true, - "open_world": true, - "operations": [], - "read_only": false, - "tiles": [ + "actions": [ { "args": { "page": "wiki" @@ -518,16 +488,56 @@ "title": "Install Plugin" } ], + "completion": "immediate", + "description": "Open one of OrcaSlicer's web pages in the default web browser, as its menu item does: wiki, the OrcaSlicer wiki; youtube, the OrcaSlicer YouTube channel; plugin_hub, the plugin hub's page, where a person picks a plugin to install. Nothing opens in OrcaSlicer.", + "destructive": false, + "group": "The app", + "guard": "mutate", + "has_own_action": false, + "idempotent": false, + "input_schema": { + "additionalProperties": false, + "properties": { + "page": { + "description": "The page.", + "enum": [ + "wiki", + "youtube", + "plugin_hub" + ], + "type": "string" + } + }, + "required": [ + "page" + ], + "type": "object" + }, + "key": "app_open_web_page", + "listed": true, + "open_world": true, + "operations": [], + "read_only": false, "title": "Open a web page" }, { + "actions": [ + { + "args": {}, + "description": "Check for a newer OrcaSlicer.", + "group": "Help", + "icon": "refresh", + "key": "help_check_updates", + "title": "Check for Updates" + } + ], "completion": "immediate", "description": "Check for a newer OrcaSlicer.", "destructive": false, "group": "The app", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": {}, @@ -538,26 +548,26 @@ "open_world": true, "operations": [], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Check for a newer OrcaSlicer.", - "group": "Help", - "icon": "refresh", - "key": "help_check_updates", - "title": "Check for Updates" - } - ], "title": "Check for Updates" }, { + "actions": [ + { + "args": {}, + "description": "Open the configuration folder in the file manager.", + "group": "Help", + "icon": "open_project", + "key": "help_open_config_folder", + "title": "Show Configuration Folder" + } + ], "completion": "immediate", "description": "Open the configuration folder in the file manager.", "destructive": false, "group": "The app", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": {}, @@ -568,26 +578,26 @@ "open_world": false, "operations": [], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Open the configuration folder in the file manager.", - "group": "Help", - "icon": "open_project", - "key": "help_open_config_folder", - "title": "Show Configuration Folder" - } - ], "title": "Show Configuration Folder" }, { + "actions": [ + { + "args": {}, + "description": "Time the 3D views on a test model. It asks first (Start or Cancel), then replaces the project with the OrcaSliced Combo as New Project does, which may ask about unsaved changes, slices it and shows the results.", + "group": "Help", + "icon": "", + "key": "help_benchmark_3d_scene", + "title": "Benchmark 3D Scene" + } + ], "completion": "immediate", "description": "Time the 3D views on a test model. It asks first (Start or Cancel), then replaces the project with the OrcaSliced Combo as New Project does, which may ask about unsaved changes, slices it and shows the results.", "destructive": false, "group": "The app", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": {}, @@ -598,16 +608,6 @@ "open_world": false, "operations": [], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Time the 3D views on a test model. It asks first (Start or Cancel), then replaces the project with the OrcaSliced Combo as New Project does, which may ask about unsaved changes, slices it and shows the results.", - "group": "Help", - "icon": "", - "key": "help_benchmark_3d_scene", - "title": "Benchmark 3D Scene" - } - ], "title": "Benchmark 3D Scene" }, { @@ -616,8 +616,8 @@ "destructive": false, "group": "The app", "guard": "inspect", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -696,8 +696,8 @@ ], "group": "The app", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -726,8 +726,8 @@ "destructive": false, "group": "The app", "guard": "recover", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -746,13 +746,23 @@ "title": "Cancel a job" }, { + "actions": [ + { + "args": {}, + "description": "Open a project through the Open dialog (it asks first if the current project has unsaved changes); project_open with a path opens that file without a dialog.", + "group": "Commands", + "icon": "menu_open", + "key": "load_project", + "title": "Load Project" + } + ], "completion": "immediate", "description": "Open a project (.3mf) by absolute path, without a file dialog, replacing the current project, with the settings it was saved with whatever the Preferences' Load behavior says; when the current project has unsaved changes that fails, changing nothing, unless discard_changes. A G-code file replaces the project too, to show its toolpaths: with unsaved changes the app asks first (blocked_by_dialog), whatever discard_changes says. project_import adds models, or a project's objects alone, to the current project. Called with no arguments it is Load Project: the Open dialog asks for the file (blocked_by_dialog), after asking about the unsaved changes. Reply: opened (project or gcode), and objects, names and plates for a project, path for a G-code.", "destructive": false, "group": "The project", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "if": { @@ -789,26 +799,36 @@ "open_project" ], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Open a project through the Open dialog (it asks first if the current project has unsaved changes); project_open with a path opens that file without a dialog.", - "group": "Commands", - "icon": "menu_open", - "key": "load_project", - "title": "Load Project" - } - ], "title": "Open a project" }, { + "actions": [ + { + "args": {}, + "description": "Import models (3MF/STL/STEP/SVG/OBJ/AMF) through a file dialog, as one undo step; a project file's settings are not loaded (project_open opens a project). project_import with paths adds files' geometry without a dialog.", + "group": "Import", + "icon": "menu_open", + "key": "import_file", + "title": "Import 3MF/STL/STEP/SVG/OBJ/AMF" + }, + { + "args": { + "archive": true + }, + "description": "Import models from a ZIP archive (opens a file dialog).", + "group": "Import", + "icon": "menu_open", + "key": "import_zip_archive", + "title": "Import ZIP Archive" + } + ], "completion": "immediate", "description": "Add the models of files (STL, 3MF, STEP, OBJ, AMF, SVG...) to the current project by absolute path, without a file dialog, as one undo step; a .3mf adds its objects only, not its settings (project_open opens it as a project). A .zip archive gives the model files it holds (STL, OBJ, AMF, 3MF, STEP; a .3mf its objects only, as above), as Import ZIP Archive does: those entries names, by their paths in the archive, else all of them, in place of its file list; an entry the archive lacks is refused with the names it has, before anything is imported. Importing can open a dialog (STEP mesh options, for instance); the reply is then blocked_by_dialog. Called with no arguments it is Import 3MF/STL/STEP/SVG/OBJ/AMF, and with archive: true alone Import ZIP Archive: a file dialog asks for the files, or for the archive and then which of its files to import (blocked_by_dialog). Reply: opened (models), added (how many objects), archives (each archive's path and the entries taken) and the project's objects, names and plates.", "destructive": false, "group": "The project", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "if": { @@ -842,7 +862,7 @@ "type": "array" }, "silent": { - "description": "true runs the command without asking; it then needs paths, and what else the call leaves out takes its default. A call with no arguments, or with exactly a tile's arguments, does what a person's pick of that tile does.", + "description": "true runs the command without asking; it then needs paths, and what else the call leaves out takes its default. A call with no arguments, or with exactly a Speed Dial action's arguments, does what a person's pick of that action does.", "enum": [ true ], @@ -863,36 +883,26 @@ "import_models" ], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Import models (3MF/STL/STEP/SVG/OBJ/AMF) through a file dialog, as one undo step; a project file's settings are not loaded (project_open opens a project). project_import with paths adds files' geometry without a dialog.", - "group": "Import", - "icon": "menu_open", - "key": "import_file", - "title": "Import 3MF/STL/STEP/SVG/OBJ/AMF" - }, - { - "args": { - "archive": true - }, - "description": "Import models from a ZIP archive (opens a file dialog).", - "group": "Import", - "icon": "menu_open", - "key": "import_zip_archive", - "title": "Import ZIP Archive" - } - ], "title": "Import models" }, { + "actions": [ + { + "args": {}, + "description": "Runs project_new with no arguments, as New Project does: a new, empty project, after asking about the unsaved changes if there are any.", + "group": "Commands", + "icon": "menu_open", + "key": "new_project", + "title": "New Project" + } + ], "completion": "immediate", "description": "Start a new, empty project. Called with no arguments, it asks as New Project does, about the unsaved changes if there are any: the reply is then blocked_by_dialog, and dialog_answer answers it. With arguments, or silent: true, it asks nothing: it fails, changing nothing, when the current project has unsaved changes, unless discard_changes. The presets' unsaved changes carry over to the new project unless preset_changes is \"discard\", as New Project's prompt offers. Reply, with arguments: objects, names, plates; when presets had or have unsaved changes, discarded and modified list per preset the keys dropped and the keys still unsaved. With no arguments the reply is ran and level, also once a prompt is answered, whatever the answer: Cancel keeps the project.", "destructive": false, "group": "The project", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -925,26 +935,36 @@ "new_project" ], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Runs project_new with no arguments, as New Project does: a new, empty project, after asking about the unsaved changes if there are any.", - "group": "Commands", - "icon": "menu_open", - "key": "new_project", - "title": "New Project" - } - ], "title": "New Project" }, { + "actions": [ + { + "args": {}, + "description": "Runs project_save with no arguments, as Save Project does: to the project's file, or through a file dialog when it has none.", + "group": "Commands", + "icon": "menu_save", + "key": "save_project", + "title": "Save Project" + }, + { + "args": { + "save_as": true + }, + "description": "Save the project as a .3mf file through the save dialog. project_save with a path saves there without a dialog; a name ending in .gcode.3mf is refused (project_export {format: \"sliced_3mf\"} writes that).", + "group": "Commands", + "icon": "menu_save", + "key": "save_project_as", + "title": "Save Project As" + } + ], "completion": "immediate", "description": "Save the project. Called with no arguments, it saves as Save Project does: to the project's file (reply: ran, level), or, when it has none, through a file dialog (blocked_by_dialog; a native picker needs dialog_auto_answer registered first); with save_as: true alone, as Save Project As does, always through the file dialog. With path, it saves a .3mf there without the file dialog, and the file becomes the project's (reply: path, bytes); a name ending in .gcode.3mf is refused (project_export writes that). Either way the save can still open a dialog (blocked_by_dialog): a warning when settings name a plugin OrcaSlicer cannot identify, or an error when the file cannot be written. A save that writes nothing, its file dialog or that warning cancelled or the write failed, fails with project_not_saved, and a file already there stays as it was.", "destructive": false, "group": "The project", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "if": { @@ -992,147 +1012,10 @@ "save_project_as" ], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Runs project_save with no arguments, as Save Project does: to the project's file, or through a file dialog when it has none.", - "group": "Commands", - "icon": "menu_save", - "key": "save_project", - "title": "Save Project" - }, - { - "args": { - "save_as": true - }, - "description": "Save the project as a .3mf file through the save dialog. project_save with a path saves there without a dialog; a name ending in .gcode.3mf is refused (project_export {format: \"sliced_3mf\"} writes that).", - "group": "Commands", - "icon": "menu_save", - "key": "save_project_as", - "title": "Save Project As" - } - ], "title": "Save Project" }, { - "completion": "immediate", - "description": "Write the project to a file without a dialog. gcode: the plate's G-code (slice first; it is written in the background, and the call returns once it is). sliced_3mf: the sliced plate, or all plates, as .gcode.3mf (slice first: a plate that is not sliced is written without G-code). 3mf: the model without slicing data. stl and drc (Draco): the objects as one file, or with per_object each in a file of its own, named after it, into the folder path names; every object of every plate, or those objects names. toolpaths_obj: the toolpaths the Preview shows, as an OBJ, refused while it shows none (slice the plate and show the Preview first). Without format, the path's extension (.gcode, .gcode.3mf, .3mf, .stl, .drc, .obj) says which. Called with exactly the arguments of one of the File > Export menu items (format alone, sliced_3mf with plates \"all\", stl or drc with per_object), it asks for the file or folder in the dialog that item opens (blocked_by_dialog). A file per object of a project with no objects, and the toolpaths while the Preview shows none, are refused in either form. Reply: path and bytes; for gcode, path and export (ok, or superseded with a note when the project changed while it was written); for per_object, path and files (each file written); for stl and drc, objects (those written).", - "destructive": false, - "group": "The project", - "guard": "mutate", - "idempotent": false, - "in_palette": false, - "input_schema": { - "additionalProperties": false, - "if": { - "not": { - "enum": [ - { - "format": "gcode" - }, - { - "format": "sliced_3mf" - }, - { - "format": "sliced_3mf", - "plates": "all" - }, - { - "format": "3mf" - }, - { - "format": "stl" - }, - { - "format": "stl", - "per_object": true - }, - { - "format": "drc" - }, - { - "format": "drc", - "per_object": true - }, - { - "format": "toolpaths_obj" - } - ] - } - }, - "properties": { - "format": { - "description": "What to write; default from the path's extension.", - "enum": [ - "gcode", - "sliced_3mf", - "3mf", - "stl", - "drc", - "toolpaths_obj" - ], - "type": "string" - }, - "object_ids": { - "description": "The ids object_list reports for objects, one per entry: refused when an index names another object now.", - "items": { - "type": "integer" - }, - "type": "array" - }, - "objects": { - "description": "Object indices.", - "items": { - "type": "integer" - }, - "type": "array" - }, - "overwrite": { - "description": "Replace an existing file.", - "type": "boolean" - }, - "path": { - "description": "Absolute output path: the file, or with per_object an existing folder.", - "type": "string" - }, - "per_object": { - "description": "stl and drc: a file per object, into a folder. Default false.", - "type": "boolean" - }, - "plates": { - "description": "\"current\" (default), a plate index, which is selected first and is the plate gcode and sliced_3mf write, or \"all\" (sliced_3mf only).", - "type": [ - "string", - "integer" - ] - }, - "silent": { - "description": "true runs the command without asking; it then needs path, and what else the call leaves out takes its default. A call with exactly a tile's arguments does what a person's pick of that tile does.", - "enum": [ - true - ], - "type": "boolean" - } - }, - "then": { - "required": [ - "path" - ] - }, - "type": "object" - }, - "key": "project_export", - "listed": true, - "open_world": false, - "operations": [ - "start_gcode_export", - "export_sliced_3mf", - "export_model_3mf", - "export_stl", - "export_toolpaths_obj" - ], - "read_only": false, - "tiles": [ + "actions": [ { "args": { "format": "gcode" @@ -1227,6 +1110,123 @@ "title": "Export Toolpaths as OBJ" } ], + "completion": "immediate", + "description": "Write the project to a file without a dialog. gcode: the plate's G-code (slice first; it is written in the background, and the call returns once it is). sliced_3mf: the sliced plate, or all plates, as .gcode.3mf (slice first: a plate that is not sliced is written without G-code). 3mf: the model without slicing data. stl and drc (Draco): the objects as one file, or with per_object each in a file of its own, named after it, into the folder path names; every object of every plate, or those objects names. toolpaths_obj: the toolpaths the Preview shows, as an OBJ, refused while it shows none (slice the plate and show the Preview first). Without format, the path's extension (.gcode, .gcode.3mf, .3mf, .stl, .drc, .obj) says which. Called with exactly the arguments of one of the File > Export menu items (format alone, sliced_3mf with plates \"all\", stl or drc with per_object), it asks for the file or folder in the dialog that item opens (blocked_by_dialog). A file per object of a project with no objects, and the toolpaths while the Preview shows none, are refused in either form. Reply: path and bytes; for gcode, path and export (ok, or superseded with a note when the project changed while it was written); for per_object, path and files (each file written); for stl and drc, objects (those written).", + "destructive": false, + "group": "The project", + "guard": "mutate", + "has_own_action": false, + "idempotent": false, + "input_schema": { + "additionalProperties": false, + "if": { + "not": { + "enum": [ + { + "format": "gcode" + }, + { + "format": "sliced_3mf" + }, + { + "format": "sliced_3mf", + "plates": "all" + }, + { + "format": "3mf" + }, + { + "format": "stl" + }, + { + "format": "stl", + "per_object": true + }, + { + "format": "drc" + }, + { + "format": "drc", + "per_object": true + }, + { + "format": "toolpaths_obj" + } + ] + } + }, + "properties": { + "format": { + "description": "What to write; default from the path's extension.", + "enum": [ + "gcode", + "sliced_3mf", + "3mf", + "stl", + "drc", + "toolpaths_obj" + ], + "type": "string" + }, + "object_ids": { + "description": "The ids object_list reports for objects, one per entry: refused when an index names another object now.", + "items": { + "type": "integer" + }, + "type": "array" + }, + "objects": { + "description": "Object indices.", + "items": { + "type": "integer" + }, + "type": "array" + }, + "overwrite": { + "description": "Replace an existing file.", + "type": "boolean" + }, + "path": { + "description": "Absolute output path: the file, or with per_object an existing folder.", + "type": "string" + }, + "per_object": { + "description": "stl and drc: a file per object, into a folder. Default false.", + "type": "boolean" + }, + "plates": { + "description": "\"current\" (default), a plate index, which is selected first and is the plate gcode and sliced_3mf write, or \"all\" (sliced_3mf only).", + "type": [ + "string", + "integer" + ] + }, + "silent": { + "description": "true runs the command without asking; it then needs path, and what else the call leaves out takes its default. A call with exactly a Speed Dial action's arguments does what a person's pick of that action does.", + "enum": [ + true + ], + "type": "boolean" + } + }, + "then": { + "required": [ + "path" + ] + }, + "type": "object" + }, + "key": "project_export", + "listed": true, + "open_world": false, + "operations": [ + "start_gcode_export", + "export_sliced_3mf", + "export_model_3mf", + "export_stl", + "export_toolpaths_obj" + ], + "read_only": false, "title": "Export" }, { @@ -1235,8 +1235,8 @@ "destructive": false, "group": "The project", "guard": "inspect", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -1267,8 +1267,8 @@ "destructive": false, "group": "The project", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -1295,8 +1295,8 @@ "destructive": false, "group": "Objects", "guard": "inspect", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -1330,13 +1330,35 @@ "title": "List objects" }, { + "actions": [ + { + "args": { + "all": true + }, + "description": "Select every object in the 3D view (the assemble view while it is shown, else Prepare, switching to it), and reply with the selection; refused while a gizmo that keeps its selection is open. A person's pick shows Prepare and selects there.", + "group": "Object", + "icon": "", + "key": "select_all", + "title": "Select All Objects" + }, + { + "args": { + "none": true + }, + "description": "Clear the selection in the 3D view (the assemble view while it is shown, else Prepare, switching to it), close the open gizmo, and reply with the selection. A person's pick clears it where it is, switching no tab.", + "group": "Object", + "icon": "", + "key": "deselect_all", + "title": "Deselect All" + } + ], "completion": "immediate", "description": "Select objects, instances or parts in the 3D view (the assemble view while it is shown, else Prepare, switching to it), as clicking them would. Give objects, instances ([[object, instance], ...]) or parts ([[object, part], ...]); add keeps the current selection; all / none select everything or nothing, whatever else is given; none also closes the open gizmo, as Deselect All does, and all is refused while a gizmo that keeps its selection is open. The reply is the selection as app_state.selection gives it, for all and none alone (Select All and Deselect All) too.", "destructive": false, "group": "Objects", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -1402,28 +1424,6 @@ "open_world": false, "operations": [], "read_only": false, - "tiles": [ - { - "args": { - "all": true - }, - "description": "Select every object in the 3D view (the assemble view while it is shown, else Prepare, switching to it), and reply with the selection; refused while a gizmo that keeps its selection is open. A person's pick shows Prepare and selects there.", - "group": "Object", - "icon": "", - "key": "select_all", - "title": "Select All Objects" - }, - { - "args": { - "none": true - }, - "description": "Clear the selection in the 3D view (the assemble view while it is shown, else Prepare, switching to it), close the open gizmo, and reply with the selection. A person's pick clears it where it is, switching no tab.", - "group": "Object", - "icon": "", - "key": "deselect_all", - "title": "Deselect All" - } - ], "title": "Select objects" }, { @@ -1432,8 +1432,8 @@ "destructive": false, "group": "Objects", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -1528,99 +1528,7 @@ "title": "Move, rotate or scale an instance or a part" }, { - "completion": "immediate", - "description": "Add a primitive shape (cube, cylinder, sphere, cone, disc or torus) as a new object, as Add Primitive does: on the current plate, or on plate, which becomes the current one; at position, in the bed coordinates object_list and object_transform use, else where Add Primitive puts it; named name, else after its shape. With a size, at that size; with silent, at the shape's built-in size. With shape alone, as its tiles, the Primitive size dialog asks for the size (blocked_by_dialog), unless a person turned that dialog off, and the call is refused while an object is selected (part_add adds a shape to an object); any other call adds the object whatever is selected. One undo step; the new object is selected. Reply: the object (objects, object), its plate and offset. The shape may then be turned toward the part-cooling fan, so the size is along its own axes before that turn.", - "destructive": false, - "group": "Objects", - "guard": "mutate", - "idempotent": false, - "in_palette": false, - "input_schema": { - "additionalProperties": false, - "if": { - "not": { - "enum": [ - { - "shape": "cube" - }, - { - "shape": "cylinder" - }, - { - "shape": "sphere" - }, - { - "shape": "cone" - }, - { - "shape": "disc" - }, - { - "shape": "torus" - } - ] - } - }, - "properties": { - "name": { - "description": "The object's name. Default: its shape's.", - "type": "string" - }, - "plate": { - "description": "The plate to add it on. Default: the current plate.", - "minimum": 0, - "type": "integer" - }, - "position": { - "description": "[x, y, z] mm: where its first instance goes, as object_transform's position; it then rests on the bed.", - "items": { - "type": "number" - }, - "type": "array" - }, - "shape": { - "description": "The shape.", - "enum": [ - "cube", - "cylinder", - "sphere", - "cone", - "disc", - "torus" - ], - "type": "string" - }, - "silent": { - "description": "true runs the command without asking; it then needs shape, and what else the call leaves out takes its default. A call with exactly a tile's arguments does what a person's pick of that tile does.", - "enum": [ - true - ], - "type": "boolean" - }, - "size": { - "description": "mm, the Primitive size dialog's fields, in place of the dialog: cube [x, y, z]; cylinder, cone, disc [diameter, height]; sphere [diameter]; torus [inner diameter, tube diameter]; each above 0.", - "items": { - "type": "number" - }, - "type": "array" - } - }, - "then": { - "required": [ - "shape" - ] - }, - "type": "object" - }, - "key": "object_add_primitive", - "listed": true, - "open_world": false, - "operations": [ - "add_primitive", - "rename_object" - ], - "read_only": false, - "tiles": [ + "actions": [ { "args": { "shape": "cube" @@ -1682,47 +1590,102 @@ "title": "Torus" } ], - "title": "Add a primitive" - }, - { "completion": "immediate", - "description": "Add one of the test models OrcaSlicer ships to the current plate, as Add Handy models does; orca_cube and orcasliced_combo, of several files, then arrange the objects as the toolbar's Arrange does, which moves the others too.", + "description": "Add a primitive shape (cube, cylinder, sphere, cone, disc or torus) as a new object, as Add Primitive does: on the current plate, or on plate, which becomes the current one; at position, in the bed coordinates object_list and object_transform use, else where Add Primitive puts it; named name, else after its shape. With a size, at that size; with silent, at the shape's built-in size. With shape alone, as its Speed Dial actions, the Primitive size dialog asks for the size (blocked_by_dialog), unless a person turned that dialog off, and the call is refused while an object is selected (part_add adds a shape to an object); any other call adds the object whatever is selected. One undo step; the new object is selected. Reply: the object (objects, object), its plate and offset. The shape may then be turned toward the part-cooling fan, so the size is along its own axes before that turn.", "destructive": false, "group": "Objects", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, - "properties": { - "model": { - "description": "The model.", + "if": { + "not": { "enum": [ - "orca_cube", - "orcasliced_combo", - "orca_badge", - "orca_tolerance_test", - "3dbenchy", - "cali_cat", - "autodesk_fdm_test", - "voron_cube", - "stanford_bunny", - "orca_string_hell" - ], - "type": "string" + { + "shape": "cube" + }, + { + "shape": "cylinder" + }, + { + "shape": "sphere" + }, + { + "shape": "cone" + }, + { + "shape": "disc" + }, + { + "shape": "torus" + } + ] } }, - "required": [ - "model" - ], + "properties": { + "name": { + "description": "The object's name. Default: its shape's.", + "type": "string" + }, + "plate": { + "description": "The plate to add it on. Default: the current plate.", + "minimum": 0, + "type": "integer" + }, + "position": { + "description": "[x, y, z] mm: where its first instance goes, as object_transform's position; it then rests on the bed.", + "items": { + "type": "number" + }, + "type": "array" + }, + "shape": { + "description": "The shape.", + "enum": [ + "cube", + "cylinder", + "sphere", + "cone", + "disc", + "torus" + ], + "type": "string" + }, + "silent": { + "description": "true runs the command without asking; it then needs shape, and what else the call leaves out takes its default. A call with exactly a Speed Dial action's arguments does what a person's pick of that action does.", + "enum": [ + true + ], + "type": "boolean" + }, + "size": { + "description": "mm, the Primitive size dialog's fields, in place of the dialog: cube [x, y, z]; cylinder, cone, disc [diameter, height]; sphere [diameter]; torus [inner diameter, tube diameter]; each above 0.", + "items": { + "type": "number" + }, + "type": "array" + } + }, + "then": { + "required": [ + "shape" + ] + }, "type": "object" }, - "key": "object_add_handy_model", + "key": "object_add_primitive", "listed": true, "open_world": false, - "operations": [], + "operations": [ + "add_primitive", + "rename_object" + ], "read_only": false, - "tiles": [ + "title": "Add a primitive" + }, + { + "actions": [ { "args": { "model": "orca_cube" @@ -1824,16 +1787,63 @@ "title": "Orca String Hell" } ], + "completion": "immediate", + "description": "Add one of the test models OrcaSlicer ships to the current plate, as Add Handy models does; orca_cube and orcasliced_combo, of several files, then arrange the objects as the toolbar's Arrange does, which moves the others too.", + "destructive": false, + "group": "Objects", + "guard": "mutate", + "has_own_action": false, + "idempotent": false, + "input_schema": { + "additionalProperties": false, + "properties": { + "model": { + "description": "The model.", + "enum": [ + "orca_cube", + "orcasliced_combo", + "orca_badge", + "orca_tolerance_test", + "3dbenchy", + "cali_cat", + "autodesk_fdm_test", + "voron_cube", + "stanford_bunny", + "orca_string_hell" + ], + "type": "string" + } + }, + "required": [ + "model" + ], + "type": "object" + }, + "key": "object_add_handy_model", + "listed": true, + "open_world": false, + "operations": [], + "read_only": false, "title": "Add a handy model" }, { + "actions": [ + { + "args": {}, + "description": "Add a text: a part on the selected object, or a new object when nothing is selected. It is created in the background (app_wait {for: \"idle\"} waits for it), and the Text gizmo opens on it.", + "group": "Add Primitive", + "icon": "menu_obj_text", + "key": "add_primitive_text", + "title": "Text" + } + ], "completion": "immediate", "description": "Add a text: a part on the selected object, or a new object when nothing is selected. It is created in the background (app_wait {for: \"idle\"} waits for it), and the Text gizmo opens on it.", "destructive": false, "group": "Objects", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": {}, @@ -1844,26 +1854,26 @@ "open_world": false, "operations": [], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Add a text: a part on the selected object, or a new object when nothing is selected. It is created in the background (app_wait {for: \"idle\"} waits for it), and the Text gizmo opens on it.", - "group": "Add Primitive", - "icon": "menu_obj_text", - "key": "add_primitive_text", - "title": "Text" - } - ], "title": "Text" }, { + "actions": [ + { + "args": {}, + "description": "Add an SVG as a new object, or as a part of the selected object, from the file a dialog asks for; object_add_svg with a path uses that file without one. The part is created in the background (app_wait {for: \"idle\"} waits for it), and the SVG gizmo opens on it.", + "group": "Add Primitive", + "icon": "menu_obj_svg", + "key": "add_primitive_svg", + "title": "SVG" + } + ], "completion": "immediate", "description": "Add an SVG as a new object, or as a part of the selected object. With a path, uses that file without a dialog; the part is created in the background (app_wait {for: \"idle\"} waits for it), and the SVG gizmo opens on it.", "destructive": false, "group": "Objects", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -1879,26 +1889,36 @@ "open_world": false, "operations": [], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Add an SVG as a new object, or as a part of the selected object, from the file a dialog asks for; object_add_svg with a path uses that file without one. The part is created in the background (app_wait {for: \"idle\"} waits for it), and the SVG gizmo opens on it.", - "group": "Add Primitive", - "icon": "menu_obj_svg", - "key": "add_primitive_svg", - "title": "SVG" - } - ], "title": "SVG" }, { + "actions": [ + { + "args": {}, + "description": "Delete the selected objects or parts.", + "group": "Object", + "icon": "delete", + "key": "obj_delete", + "title": "Delete Selected" + }, + { + "args": { + "all": true + }, + "description": "Delete all objects.", + "group": "Object", + "icon": "delete", + "key": "obj_delete_all", + "title": "Delete All Objects" + } + ], "completion": "immediate", "description": "Delete objects, instances or parts, as Delete does: those named (objects, instances, parts), what stands on a plate (plate: its objects, or the instances on it of an object on two plates), every object (all, as Delete All does), or with none of these what is selected in the Prepare view. An object whose every instance or every part is named goes whole. An object's last solid part alone, and a cut object or a solid or negative part of one, are refused with the message or the question Delete gives; a call with no arguments leaves them to the object list, which shows the message or asks the question (blocked_by_dialog), and all deletes cut objects without asking, as Delete All does. One undo step. Reply: what was deleted (objects, instances, parts, with the indices they had); kept, what was named and stayed, with its indices now (the object list deletes from the last named and stops at what it refuses or asks about); and object_count, the objects left; the objects after a deleted one move down.", "destructive": false, "group": "Objects", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -1954,7 +1974,7 @@ "type": "integer" }, "silent": { - "description": "true runs the command without asking; what the call leaves out takes its default. A call with no arguments, or with exactly a tile's arguments, does what a person's pick of that tile does.", + "description": "true runs the command without asking; what the call leaves out takes its default. A call with no arguments, or with exactly a Speed Dial action's arguments, does what a person's pick of that action does.", "enum": [ true ], @@ -1970,36 +1990,26 @@ "delete_objects" ], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Delete the selected objects or parts.", - "group": "Object", - "icon": "delete", - "key": "obj_delete", - "title": "Delete Selected" - }, - { - "args": { - "all": true - }, - "description": "Delete all objects.", - "group": "Object", - "icon": "delete", - "key": "obj_delete_all", - "title": "Delete All Objects" - } - ], "title": "Delete objects" }, { + "actions": [ + { + "args": {}, + "description": "Rename the selected object or part (select one) in the Rename dialog; object_rename with a name skips it.", + "group": "Object", + "icon": "", + "key": "obj_rename", + "title": "Rename" + } + ], "completion": "immediate", "description": "Rename an object, or a part of it (object and part), or with neither the object or part selected in the Prepare view. With a name, skips the Rename dialog; an empty name, or one with characters a file name cannot hold, is refused. Reply: what was renamed, with its name (objects or parts).", "destructive": false, "group": "Objects", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "if": { @@ -2052,70 +2062,10 @@ "rename_object" ], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Rename the selected object or part (select one) in the Rename dialog; object_rename with a name skips it.", - "group": "Object", - "icon": "", - "key": "obj_rename", - "title": "Rename" - } - ], "title": "Rename" }, { - "completion": "immediate", - "description": "Give an object this many instances (count), as Set Number of Instances does, or one more or one fewer (delta 1 or -1), as the toolbar's + and - do: the object named, else the one selected in the Prepare view, or the object of the selected instance or part. With no arguments the dialog asks for the count (blocked_by_dialog). New instances overlap; arrange afterwards. One undo step; the object is selected. Reply: the object (objects, object) and instances, how many it has.", - "destructive": false, - "group": "Objects", - "guard": "mutate", - "idempotent": false, - "in_palette": false, - "input_schema": { - "additionalProperties": false, - "properties": { - "count": { - "description": "The total number of instances, up to 1000, in place of the dialog.", - "minimum": 1, - "type": "integer" - }, - "delta": { - "description": "1 adds an instance and -1 removes one, as the toolbar's + and - do.", - "enum": [ - 1, - -1 - ], - "type": "integer" - }, - "object": { - "description": "Object index (object_list).", - "minimum": 0, - "type": "integer" - }, - "object_id": { - "description": "The id object_list reports for this object: the call is refused when the index names another one now.", - "minimum": 0, - "type": "integer" - }, - "silent": { - "description": "true runs the command without asking; it then needs count or delta. A call with no arguments, or with exactly a tile's arguments, does what a person's pick of that tile does.", - "enum": [ - true - ], - "type": "boolean" - } - }, - "type": "object" - }, - "key": "object_set_instances", - "listed": true, - "open_world": false, - "operations": [ - "set_instance_count" - ], - "read_only": false, - "tiles": [ + "actions": [ { "args": {}, "description": "Give the selected object the number of instances the dialog asks for, in one undo step; object_set_instances with a count skips the dialog. New instances overlap; arrange afterwards.", @@ -2145,16 +2095,76 @@ "title": "Decrease Instances" } ], + "completion": "immediate", + "description": "Give an object this many instances (count), as Set Number of Instances does, or one more or one fewer (delta 1 or -1), as the toolbar's + and - do: the object named, else the one selected in the Prepare view, or the object of the selected instance or part. With no arguments the dialog asks for the count (blocked_by_dialog). New instances overlap; arrange afterwards. One undo step; the object is selected. Reply: the object (objects, object) and instances, how many it has.", + "destructive": false, + "group": "Objects", + "guard": "mutate", + "has_own_action": false, + "idempotent": false, + "input_schema": { + "additionalProperties": false, + "properties": { + "count": { + "description": "The total number of instances, up to 1000, in place of the dialog.", + "minimum": 1, + "type": "integer" + }, + "delta": { + "description": "1 adds an instance and -1 removes one, as the toolbar's + and - do.", + "enum": [ + 1, + -1 + ], + "type": "integer" + }, + "object": { + "description": "Object index (object_list).", + "minimum": 0, + "type": "integer" + }, + "object_id": { + "description": "The id object_list reports for this object: the call is refused when the index names another one now.", + "minimum": 0, + "type": "integer" + }, + "silent": { + "description": "true runs the command without asking; it then needs count or delta. A call with no arguments, or with exactly an action's arguments, does what a person's pick of that action does.", + "enum": [ + true + ], + "type": "boolean" + } + }, + "type": "object" + }, + "key": "object_set_instances", + "listed": true, + "open_world": false, + "operations": [ + "set_instance_count" + ], + "read_only": false, "title": "Set the number of instances" }, { + "actions": [ + { + "args": {}, + "description": "Make each instance of the selected object a separate object (object_select {objects: [n]}); with some of its instances selected, only those. New objects are added last; the reply lists the objects that hold those instances (objects).", + "group": "Object", + "icon": "", + "key": "obj_instances_to_objects", + "title": "Set as Individual Objects" + } + ], "completion": "immediate", "description": "Make each instance of an object a separate object (object), or some instances of one object one new object (instances), as Set as Individual Objects does; with neither, what is selected in the Prepare view: an object, or some of its instances. New objects are added last. Reply: the objects that hold those instances afterwards (objects): the object and its new objects, or the new object.", "destructive": false, "group": "Objects", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -2192,26 +2202,38 @@ "separate_instances" ], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Make each instance of the selected object a separate object (object_select {objects: [n]}); with some of its instances selected, only those. New objects are added last; the reply lists the objects that hold those instances (objects).", - "group": "Object", - "icon": "", - "key": "obj_instances_to_objects", - "title": "Set as Individual Objects" - } - ], "title": "Set as Individual Objects" }, { + "actions": [ + { + "args": { + "into": "objects" + }, + "description": "Split the selected object into separate objects.", + "group": "Object", + "icon": "menu_split_objects", + "key": "obj_split_objects", + "title": "Split to Objects" + }, + { + "args": { + "into": "parts" + }, + "description": "Split the selected object into parts.", + "group": "Object", + "icon": "menu_split_parts", + "key": "obj_split_parts", + "title": "Split to Parts" + } + ], "completion": "immediate", - "description": "Split an object into separate objects, or into parts of it, as Split > To Objects and To Parts do: the object named, else the one row selected in the object list, as Split reads it: an object's row, into objects also a row of the object's own other than a part's, and into parts a part's row, or another row of the object. A mesh of one shell is refused, and into parts so is an object of several parts, whose part is selected to split it. Into objects, the object is removed and its pieces are added last and selected. Where some of them would float above the bed of an object that drops, keep_z answers the question Split asks (true keeps their height, false lets them drop), and without it the call is refused (auto_drop_question); with only a tile's arguments Split asks it (blocked_by_dialog). One undo step. Reply: the new objects (objects) or the parts the part became (parts), with their indices afterwards, and object_count.", + "description": "Split an object into separate objects, or into parts of it, as Split > To Objects and To Parts do: the object named, else the one row selected in the object list, as Split reads it: an object's row, into objects also a row of the object's own other than a part's, and into parts a part's row, or another row of the object. A mesh of one shell is refused, and into parts so is an object of several parts, whose part is selected to split it. Into objects, the object is removed and its pieces are added last and selected. Where some of them would float above the bed of an object that drops, keep_z answers the question Split asks (true keeps their height, false lets them drop), and without it the call is refused (auto_drop_question); with only an action's arguments Split asks it (blocked_by_dialog). One undo step. Reply: the new objects (objects) or the parts the part became (parts), with their indices afterwards, and object_count.", "destructive": false, "group": "Objects", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "if": { @@ -2250,7 +2272,7 @@ "type": "integer" }, "silent": { - "description": "true runs the command without asking; it then needs into, and what else the call leaves out takes its default. A call with exactly a tile's arguments does what a person's pick of that tile does.", + "description": "true runs the command without asking; it then needs into, and what else the call leaves out takes its default. A call with exactly a Speed Dial action's arguments does what a person's pick of that action does.", "enum": [ true ], @@ -2271,38 +2293,26 @@ "split_object" ], "read_only": false, - "tiles": [ - { - "args": { - "into": "objects" - }, - "description": "Split the selected object into separate objects.", - "group": "Object", - "icon": "menu_split_objects", - "key": "obj_split_objects", - "title": "Split to Objects" - }, - { - "args": { - "into": "parts" - }, - "description": "Split the selected object into parts.", - "group": "Object", - "icon": "menu_split_parts", - "key": "obj_split_parts", - "title": "Split to Parts" - } - ], "title": "Split an object" }, { + "actions": [ + { + "args": {}, + "description": "Assemble two or more selected objects into one object of parts named Assembly. They are removed and it is added last, so object indices change; the reply has its index (object) and name.", + "group": "Object", + "icon": "", + "key": "obj_assemble", + "title": "Assemble" + } + ], "completion": "immediate", "description": "Assemble two or more objects into one object of parts named Assembly, as Assemble does: those named, else the object and instance rows selected in the object list, an instance becoming an object of its own first. Cut objects are refused. They are removed and the new object is added last and selected, so object indices change. One undo step. Reply: the new object's index (object) and name, and objects.", "destructive": false, "group": "Objects", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -2330,26 +2340,58 @@ "assemble_objects" ], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Assemble two or more selected objects into one object of parts named Assembly. They are removed and it is added last, so object indices change; the reply has its index (object) and name.", - "group": "Object", - "icon": "", - "key": "obj_assemble", - "title": "Assemble" - } - ], "title": "Assemble" }, { + "actions": [ + { + "args": { + "by": "name" + }, + "description": "Order the current plate's objects by name, which sets the object list and print order, as the plate menu's Order By does. Choosing the order they already have reverses it. Object indices change; the reply lists the new order (order: [{object, name, plate}]) and descending.", + "group": "Object", + "icon": "", + "key": "obj_order_by_name", + "title": "Order by Name" + }, + { + "args": { + "by": "filament" + }, + "description": "Order the current plate's objects by filament, which sets the object list and print order, as the plate menu's Order By does. Choosing the order they already have reverses it. Object indices change; the reply lists the new order (order: [{object, name, plate}]) and descending.", + "group": "Object", + "icon": "", + "key": "obj_order_by_filament", + "title": "Order by Filament" + }, + { + "args": { + "by": "height" + }, + "description": "Order the current plate's objects by height, which sets the object list and print order, as the plate menu's Order By does. Choosing the order they already have reverses it. Object indices change; the reply lists the new order (order: [{object, name, plate}]) and descending.", + "group": "Object", + "icon": "", + "key": "obj_order_by_height", + "title": "Order by Height" + }, + { + "args": { + "by": "size" + }, + "description": "Order the current plate's objects by size (bounding box volume), which sets the object list and print order, as the plate menu's Order By does. Choosing the order they already have reverses it. Object indices change; the reply lists the new order (order: [{object, name, plate}]) and descending.", + "group": "Object", + "icon": "", + "key": "obj_order_by_size", + "title": "Order by Size" + } + ], "completion": "immediate", - "description": "Order the objects of a plate (the current one, or plate), or with all of every plate, by name, filament, height or size (bounding box volume), which sets the object list and print order, as the plate menu's Order By does: ascending, or with descending true descending. Called with by alone, as its tiles, it shows the Prepare view and, as Order By does, reverses the order the objects already have. With order in place of by, the plate's objects go in the order given, as dragging them in the object list puts them: order names each of the plate's objects once, by index, and anything else is refused; the other plates' objects keep their order. One undo step; object indices change. Reply: the new order (order: [{object, name, plate}]), and descending with by.", + "description": "Order the objects of a plate (the current one, or plate), or with all of every plate, by name, filament, height or size (bounding box volume), which sets the object list and print order, as the plate menu's Order By does: ascending, or with descending true descending. Called with by alone, as its Speed Dial actions, it shows the Prepare view and, as Order By does, reverses the order the objects already have. With order in place of by, the plate's objects go in the order given, as dragging them in the object list puts them: order names each of the plate's objects once, by index, and anything else is refused; the other plates' objects keep their order. One undo step; object indices change. Reply: the new order (order: [{object, name, plate}]), and descending with by.", "destructive": false, "group": "Objects", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -2396,58 +2438,26 @@ "reorder_objects" ], "read_only": false, - "tiles": [ - { - "args": { - "by": "name" - }, - "description": "Order the current plate's objects by name, which sets the object list and print order, as the plate menu's Order By does. Choosing the order they already have reverses it. Object indices change; the reply lists the new order (order: [{object, name, plate}]) and descending.", - "group": "Object", - "icon": "", - "key": "obj_order_by_name", - "title": "Order by Name" - }, - { - "args": { - "by": "filament" - }, - "description": "Order the current plate's objects by filament, which sets the object list and print order, as the plate menu's Order By does. Choosing the order they already have reverses it. Object indices change; the reply lists the new order (order: [{object, name, plate}]) and descending.", - "group": "Object", - "icon": "", - "key": "obj_order_by_filament", - "title": "Order by Filament" - }, - { - "args": { - "by": "height" - }, - "description": "Order the current plate's objects by height, which sets the object list and print order, as the plate menu's Order By does. Choosing the order they already have reverses it. Object indices change; the reply lists the new order (order: [{object, name, plate}]) and descending.", - "group": "Object", - "icon": "", - "key": "obj_order_by_height", - "title": "Order by Height" - }, - { - "args": { - "by": "size" - }, - "description": "Order the current plate's objects by size (bounding box volume), which sets the object list and print order, as the plate menu's Order By does. Choosing the order they already have reverses it. Object indices change; the reply lists the new order (order: [{object, name, plate}]) and descending.", - "group": "Object", - "icon": "", - "key": "obj_order_by_size", - "title": "Order by Size" - } - ], "title": "Order objects" }, { + "actions": [ + { + "args": {}, + "description": "Drop the selection onto the bed.", + "group": "Object", + "icon": "toolbar_flatten", + "key": "obj_drop", + "title": "Drop to Bed" + } + ], "completion": "immediate", "description": "Drop objects or parts onto the bed, as Drop does: those named, each instance and each part that does not rest on the bed dropped on its own, else what is selected in the Prepare view, dropped as one by its lowest point. What already rests on the bed is no error: moved false says that nothing moved. One undo step; the targets are left selected. Reply: what it acted on (objects, instances, parts) and moved.", "destructive": false, "group": "Objects", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -2489,26 +2499,48 @@ "drop_objects" ], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Drop the selection onto the bed.", - "group": "Object", - "icon": "toolbar_flatten", - "key": "obj_drop", - "title": "Drop to Bed" - } - ], "title": "Drop to Bed" }, { + "actions": [ + { + "args": { + "axis": "x" + }, + "description": "Mirror the selection along X.", + "group": "Object", + "icon": "menu_mirror_x", + "key": "obj_mirror_x", + "title": "Mirror X" + }, + { + "args": { + "axis": "y" + }, + "description": "Mirror the selection along Y.", + "group": "Object", + "icon": "menu_mirror_y", + "key": "obj_mirror_y", + "title": "Mirror Y" + }, + { + "args": { + "axis": "z" + }, + "description": "Mirror the selection along Z.", + "group": "Object", + "icon": "menu_mirror_z", + "key": "obj_mirror_z", + "title": "Mirror Z" + } + ], "completion": "immediate", "description": "Mirror objects or parts along an axis, as Mirror > Along X Axis, Y Axis and Z Axis do: those named, each instance of an object and the parts of each object in turn, else what is selected in the Prepare view, which Mirror takes of one instance or parts of one. Cut objects are refused. One undo step; the targets are left selected. Reply: what it mirrored (objects, instances, parts).", "destructive": false, "group": "Objects", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -2562,48 +2594,26 @@ "mirror_objects" ], "read_only": false, - "tiles": [ - { - "args": { - "axis": "x" - }, - "description": "Mirror the selection along X.", - "group": "Object", - "icon": "menu_mirror_x", - "key": "obj_mirror_x", - "title": "Mirror X" - }, - { - "args": { - "axis": "y" - }, - "description": "Mirror the selection along Y.", - "group": "Object", - "icon": "menu_mirror_y", - "key": "obj_mirror_y", - "title": "Mirror Y" - }, - { - "args": { - "axis": "z" - }, - "description": "Mirror the selection along Z.", - "group": "Object", - "icon": "menu_mirror_z", - "key": "obj_mirror_z", - "title": "Mirror Z" - } - ], "title": "Mirror objects" }, { + "actions": [ + { + "args": {}, + "description": "Center the selection on its plate.", + "group": "Object", + "icon": "", + "key": "obj_center", + "title": "Center Selected on Plate" + } + ], "completion": "immediate", - "description": "Centre objects on their plate, as Center does: those named, each plate's as one group on the plate it stands on (an object on no plate goes with the current plate's), or all on plate; with none named, what is selected in the Prepare view as one group, on plate, or with no arguments, as its tile, on the current plate. A group moves as one, its box to the plate's centre, its objects keeping their places relative to each other, so a group spread over several plates and sent to plate may not fit on its bed. One undo step; the targets are left selected. Reply: what it centred (objects, instances, parts) and the groups (plates: [{plate, objects}]).", + "description": "Centre objects on their plate, as Center does: those named, each plate's as one group on the plate it stands on (an object on no plate goes with the current plate's), or all on plate; with none named, what is selected in the Prepare view as one group, on plate, or with no arguments, as its Speed Dial action, on the current plate. A group moves as one, its box to the plate's centre, its objects keeping their places relative to each other, so a group spread over several plates and sent to plate may not fit on its bed. One undo step; the targets are left selected. Reply: what it centred (objects, instances, parts) and the groups (plates: [{plate, objects}]).", "destructive": false, "group": "Objects", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -2636,26 +2646,26 @@ "center_objects" ], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Center the selection on its plate.", - "group": "Object", - "icon": "", - "key": "obj_center", - "title": "Center Selected on Plate" - } - ], "title": "Center Selected on Plate" }, { + "actions": [ + { + "args": {}, + "description": "Scale the selection to fit the print volume.", + "group": "Object", + "icon": "", + "key": "obj_fit_volume", + "title": "Scale to Fit Print Volume" + } + ], "completion": "immediate", "description": "Scale objects as one to fit the current plate's print volume and move them into it, as Scale to build volume does: those named, else the objects and instances selected in the Prepare view. Cut objects and a bed of another shape than a rectangle or a circle are refused. One undo step; the targets are left selected. Reply: what it scaled (objects, instances) and each instance's scale (scales: [{object, instance, scale}]).", "destructive": false, "group": "Objects", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -2683,26 +2693,26 @@ "scale_to_fit" ], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Scale the selection to fit the print volume.", - "group": "Object", - "icon": "", - "key": "obj_fit_volume", - "title": "Scale to Fit Print Volume" - } - ], "title": "Scale to Fit Print Volume" }, { + "actions": [ + { + "args": {}, + "description": "Auto-orient the selection, or every object when nothing is selected; the call returns when it is done.", + "group": "Object", + "icon": "toolbar_orient", + "key": "obj_orient", + "title": "Auto-Orient" + } + ], "completion": "immediate", "description": "Turn objects to the orientation that prints best, as Auto-Orient does: those named and those that stand on plates, else what is selected in the Prepare view, an instance or a part standing for its object, or every object when nothing is selected. An object on a locked plate, or one that is not printable, keeps its orientation. A call that names objects or plates turns no other object: a plate named that holds no objects, a locked plate named, and objects named none of which can be turned (not printable, or on a locked plate) are refused. A selection of objects that are not printable, none on a locked plate, leaves the job to turn every other object, as the toolbar's does. Waits for the job to end. One undo step; objects named are left selected. Reply: the objects it turned (objects) and the rotation of each instance it turned (rotations: [{object, instance, rotation_deg}]).", "destructive": false, "group": "Objects", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -2737,16 +2747,6 @@ "orient_objects" ], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Auto-orient the selection, or every object when nothing is selected; the call returns when it is done.", - "group": "Object", - "icon": "toolbar_orient", - "key": "obj_orient", - "title": "Auto-Orient" - } - ], "title": "Auto-Orient" }, { @@ -2792,8 +2792,8 @@ ], "group": "Objects", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -2877,8 +2877,8 @@ ], "group": "Objects", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -2951,8 +2951,8 @@ ], "group": "Objects", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -3039,8 +3039,8 @@ ], "group": "Objects", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -3112,8 +3112,8 @@ ], "group": "Objects", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -3162,13 +3162,23 @@ "title": "Reload from disk" }, { + "actions": [ + { + "args": {}, + "description": "Arrange all objects on the unlocked plates with the saved Arrange options, as the toolbar does; the call waits for the arrangement and replies as object_arrange does: the settings in force, the instances left off every plate and the plates skipped. object_arrange with arguments also takes options, one plate or fill bed.", + "group": "Object", + "icon": "toolbar_arrange", + "key": "obj_arrange", + "title": "Auto-Arrange" + } + ], "completion": "immediate", "description": "Arrange the objects of every unlocked plate as the toolbar's Arrange does, or of one plate (plates: an index or \"current\") as its Arrange icon does. With fill_object, fill that object's plate with more of it instead, as Fill bed with instances (or copies, by fill_with) does (reply: added, how many). spacing, rotate, align_y and multi_material are the Arrange options panel's settings: the values given stay in the panel, so later arranges use them too. Waits for the arrangement (a longer one replies with a job). Reply: the settings in force, instances left off every plate, plates the all-plates arrange skipped and the job's notifications. An arrange may reorder objects, so object_list again. One undo step. Called with no arguments it is Auto-Arrange, the toolbar's Arrange with the panel's settings, and waits and replies as any other call.", "destructive": false, "group": "Objects", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -3225,16 +3235,6 @@ "start_arrange" ], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Arrange all objects on the unlocked plates with the saved Arrange options, as the toolbar does; the call waits for the arrangement and replies as object_arrange does: the settings in force, the instances left off every plate and the plates skipped. object_arrange with arguments also takes options, one plate or fill bed.", - "group": "Object", - "icon": "toolbar_arrange", - "key": "obj_arrange", - "title": "Auto-Arrange" - } - ], "title": "Arrange objects or fill the bed" }, { @@ -3243,8 +3243,8 @@ "destructive": false, "group": "Objects", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -3301,8 +3301,8 @@ "destructive": false, "group": "Objects", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -3360,8 +3360,8 @@ "destructive": false, "group": "Parts", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -3431,68 +3431,7 @@ "title": "Add a part or modifier to an object" }, { - "completion": "immediate", - "description": "Change what parts are, as Change Type does: those named, else the part rows selected in the object list. type is part, negative, modifier, support_blocker, support_enforcer, or precise_seam, a Center precise seam where a seam keeps its subtype; subtype, with precise_seam alone, sets the seam's subtype as the Precise Seam Type menu does. Not an object's last solid part; a text or SVG part does not become a support blocker or enforcer or a precise seam; a painted modifier keeps its type. One undo step. Parts are listed by type, so part indices change. Reply: each part with its index afterwards and its type (parts).", - "destructive": false, - "group": "Parts", - "guard": "mutate", - "idempotent": false, - "in_palette": false, - "input_schema": { - "additionalProperties": false, - "properties": { - "part_ids": { - "description": "The ids object_list reports for the entries of parts, one per entry: refused when a pair names another part now.", - "items": { - "type": "integer" - }, - "type": "array" - }, - "parts": { - "description": "[[object, part], ...]", - "items": { - "type": "array" - }, - "type": "array" - }, - "subtype": { - "description": "With type precise_seam: the seam's subtype, which every part named takes. Default: a seam keeps its own, another part becomes center.", - "enum": [ - "center", - "left", - "right", - "enforced", - "blocked", - "neutral" - ], - "type": "string" - }, - "type": { - "description": "What the parts become.", - "enum": [ - "part", - "negative", - "modifier", - "support_blocker", - "support_enforcer", - "precise_seam" - ], - "type": "string" - } - }, - "required": [ - "type" - ], - "type": "object" - }, - "key": "part_change_type", - "listed": true, - "open_world": false, - "operations": [ - "change_part_type" - ], - "read_only": false, - "tiles": [ + "actions": [ { "args": { "type": "part" @@ -3554,6 +3493,67 @@ "title": "Change Type to Precise Seam" } ], + "completion": "immediate", + "description": "Change what parts are, as Change Type does: those named, else the part rows selected in the object list. type is part, negative, modifier, support_blocker, support_enforcer, or precise_seam, a Center precise seam where a seam keeps its subtype; subtype, with precise_seam alone, sets the seam's subtype as the Precise Seam Type menu does. Not an object's last solid part; a text or SVG part does not become a support blocker or enforcer or a precise seam; a painted modifier keeps its type. One undo step. Parts are listed by type, so part indices change. Reply: each part with its index afterwards and its type (parts).", + "destructive": false, + "group": "Parts", + "guard": "mutate", + "has_own_action": false, + "idempotent": false, + "input_schema": { + "additionalProperties": false, + "properties": { + "part_ids": { + "description": "The ids object_list reports for the entries of parts, one per entry: refused when a pair names another part now.", + "items": { + "type": "integer" + }, + "type": "array" + }, + "parts": { + "description": "[[object, part], ...]", + "items": { + "type": "array" + }, + "type": "array" + }, + "subtype": { + "description": "With type precise_seam: the seam's subtype, which every part named takes. Default: a seam keeps its own, another part becomes center.", + "enum": [ + "center", + "left", + "right", + "enforced", + "blocked", + "neutral" + ], + "type": "string" + }, + "type": { + "description": "What the parts become.", + "enum": [ + "part", + "negative", + "modifier", + "support_blocker", + "support_enforcer", + "precise_seam" + ], + "type": "string" + } + }, + "required": [ + "type" + ], + "type": "object" + }, + "key": "part_change_type", + "listed": true, + "open_world": false, + "operations": [ + "change_part_type" + ], + "read_only": false, "title": "Change a part's type" }, { @@ -3589,8 +3589,8 @@ ], "group": "Parts", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -3634,13 +3634,105 @@ "title": "Replace 3D file" }, { + "actions": [ + { + "args": { + "test": "temperature" + }, + "description": "Open the Temperature Calibration dialog; calibration_generate_test with the test's parameters, or silent, runs it with no dialog.", + "group": "Calibration", + "icon": "param_temperature", + "key": "calib_temperature", + "title": "Temperature Calibration" + }, + { + "args": { + "test": "max_volumetric" + }, + "description": "Open the Max Volumetric Speed Calibration dialog; calibration_generate_test with the test's parameters, or silent, runs it with no dialog.", + "group": "Calibration", + "icon": "param_volumetric_speed", + "key": "calib_max_volumetric", + "title": "Max Volumetric Speed Calibration" + }, + { + "args": { + "test": "pressure_advance" + }, + "description": "Open the Pressure Advance Calibration dialog; calibration_generate_test with the test's parameters, or silent, runs it with no dialog.", + "group": "Calibration", + "icon": "param_flow_ratio_and_pressure_advance", + "key": "calib_pressure_advance", + "title": "Pressure Advance Calibration" + }, + { + "args": { + "test": "flow_ratio" + }, + "description": "Open the Flow Ratio Calibration dialog; calibration_generate_test with the test's parameters, or silent, runs it with no dialog.", + "group": "Calibration", + "icon": "param_flow_ratio_and_pressure_advance", + "key": "calib_flow_ratio", + "title": "Flow Ratio Calibration" + }, + { + "args": { + "test": "retraction" + }, + "description": "Open the Retraction Calibration dialog; calibration_generate_test with the test's parameters, or silent, runs it with no dialog.", + "group": "Calibration", + "icon": "param_retraction", + "key": "calib_retraction", + "title": "Retraction Calibration" + }, + { + "args": { + "test": "cornering" + }, + "description": "Open the Cornering Calibration dialog; calibration_generate_test with the test's parameters, or silent, runs it with no dialog.", + "group": "Calibration", + "icon": "param_precision", + "key": "calib_cornering", + "title": "Cornering Calibration" + }, + { + "args": { + "test": "input_shaping_freq" + }, + "description": "Open the Input Shaping Frequency Calibration dialog; calibration_generate_test with the test's parameters, or silent, runs it with no dialog.", + "group": "Calibration", + "icon": "param_resonance_avoidance", + "key": "calib_input_shaping_freq", + "title": "Input Shaping Frequency Calibration" + }, + { + "args": { + "test": "input_shaping_damp" + }, + "description": "Open the Input Shaping Damping Calibration dialog; calibration_generate_test with the test's parameters, or silent, runs it with no dialog.", + "group": "Calibration", + "icon": "param_resonance_avoidance", + "key": "calib_input_shaping_damp", + "title": "Input Shaping Damping Calibration" + }, + { + "args": { + "test": "vfa" + }, + "description": "Open the VFA Calibration dialog; calibration_generate_test with the test's parameters, or silent, runs it with no dialog.", + "group": "Calibration", + "icon": "param_speed", + "key": "calib_vfa", + "title": "VFA Calibration" + } + ], "completion": "immediate", "description": "Generate a Calibration menu test as its dialog's OK does: a new project named after the test with the test model, and the process, filament and printer presets changed as the test needs (presets_changed). The test prints with filament slot 1, so the filament tab is pointed at slot 1's preset. Omitted parameters take the dialog's defaults (pressure advance's by the printer's extruder type); temperatures are clamped to 155-500 °C and rounded down to 5 °C. Fails, changing nothing, when the project has unsaved changes (pass discard_changes) or presets do (pass preset_changes). Called with test alone it opens that test's dialog, as the Calibration menu does (blocked_by_dialog), and the dialog's OK runs the test; silent: true with test alone runs it with the dialog's defaults. Reply: test, project, params (the values used, which the journal records), objects, names, plates, presets_changed, result_keys (where the measured value belongs), warnings, adjusted (vfa), and discarded and modified as project_new. Then plate_slice and project_export. To save a measured value: project_new {discard_changes, preset_changes: \"discard\"}, settings_set the value, preset_save.", "destructive": false, "group": "Plates", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "if": { @@ -3747,7 +3839,7 @@ "type": "string" }, "silent": { - "description": "true runs the command without asking; it then needs test, and what else the call leaves out takes its default. A call with exactly a tile's arguments does what a person's pick of that tile does.", + "description": "true runs the command without asking; it then needs test, and what else the call leaves out takes its default. A call with exactly a Speed Dial action's arguments does what a person's pick of that action does.", "enum": [ true ], @@ -3820,98 +3912,6 @@ "open_world": false, "operations": [], "read_only": false, - "tiles": [ - { - "args": { - "test": "temperature" - }, - "description": "Open the Temperature Calibration dialog; calibration_generate_test with the test's parameters, or silent, runs it with no dialog.", - "group": "Calibration", - "icon": "param_temperature", - "key": "calib_temperature", - "title": "Temperature Calibration" - }, - { - "args": { - "test": "max_volumetric" - }, - "description": "Open the Max Volumetric Speed Calibration dialog; calibration_generate_test with the test's parameters, or silent, runs it with no dialog.", - "group": "Calibration", - "icon": "param_volumetric_speed", - "key": "calib_max_volumetric", - "title": "Max Volumetric Speed Calibration" - }, - { - "args": { - "test": "pressure_advance" - }, - "description": "Open the Pressure Advance Calibration dialog; calibration_generate_test with the test's parameters, or silent, runs it with no dialog.", - "group": "Calibration", - "icon": "param_flow_ratio_and_pressure_advance", - "key": "calib_pressure_advance", - "title": "Pressure Advance Calibration" - }, - { - "args": { - "test": "flow_ratio" - }, - "description": "Open the Flow Ratio Calibration dialog; calibration_generate_test with the test's parameters, or silent, runs it with no dialog.", - "group": "Calibration", - "icon": "param_flow_ratio_and_pressure_advance", - "key": "calib_flow_ratio", - "title": "Flow Ratio Calibration" - }, - { - "args": { - "test": "retraction" - }, - "description": "Open the Retraction Calibration dialog; calibration_generate_test with the test's parameters, or silent, runs it with no dialog.", - "group": "Calibration", - "icon": "param_retraction", - "key": "calib_retraction", - "title": "Retraction Calibration" - }, - { - "args": { - "test": "cornering" - }, - "description": "Open the Cornering Calibration dialog; calibration_generate_test with the test's parameters, or silent, runs it with no dialog.", - "group": "Calibration", - "icon": "param_precision", - "key": "calib_cornering", - "title": "Cornering Calibration" - }, - { - "args": { - "test": "input_shaping_freq" - }, - "description": "Open the Input Shaping Frequency Calibration dialog; calibration_generate_test with the test's parameters, or silent, runs it with no dialog.", - "group": "Calibration", - "icon": "param_resonance_avoidance", - "key": "calib_input_shaping_freq", - "title": "Input Shaping Frequency Calibration" - }, - { - "args": { - "test": "input_shaping_damp" - }, - "description": "Open the Input Shaping Damping Calibration dialog; calibration_generate_test with the test's parameters, or silent, runs it with no dialog.", - "group": "Calibration", - "icon": "param_resonance_avoidance", - "key": "calib_input_shaping_damp", - "title": "Input Shaping Damping Calibration" - }, - { - "args": { - "test": "vfa" - }, - "description": "Open the VFA Calibration dialog; calibration_generate_test with the test's parameters, or silent, runs it with no dialog.", - "group": "Calibration", - "icon": "param_speed", - "key": "calib_vfa", - "title": "VFA Calibration" - } - ], "title": "Generate a calibration test" }, { @@ -3920,8 +3920,8 @@ "destructive": false, "group": "Plates", "guard": "inspect", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -3957,8 +3957,8 @@ "destructive": false, "group": "Plates", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -3990,8 +3990,8 @@ "destructive": false, "group": "Plates", "guard": "inspect", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -4016,14 +4016,15 @@ "title": "List plates" }, { + "action_group": "Plate", "completion": "immediate", "description": "Add a plate.", "destructive": false, "group": "Plates", "guard": "mutate", + "has_own_action": true, "icon": "toolbar_add_plate", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "properties": {}, @@ -4034,18 +4035,18 @@ "open_world": false, "operations": [], "read_only": false, - "tile_group": "Plate", "title": "Add Plate" }, { + "action_group": "Plate", "completion": "immediate", "description": "Delete a plate (plate, else the current one), as Delete Plate does. The objects on it stay in the project, outside the plates, and the plates after it move down one. The only plate is refused. One undo step. Reply: plate (the index it had), plates (each plate afterwards: index, name and objects, how many stand on it) and current (the current plate).", "destructive": false, "group": "Plates", "guard": "mutate", + "has_own_action": true, "icon": "delete", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "properties": { @@ -4064,18 +4065,18 @@ "delete_plate" ], "read_only": false, - "tile_group": "Plate", "title": "Delete Plate" }, { + "action_group": "Plate", "completion": "immediate", "description": "Add a plate with a copy of each object on the plate (plate, else the current one), placed on it as on that plate, as Duplicate Current Plate does. The new plate comes last, and the current plate stays current. Refused when the project holds as many plates as it can, and while slicing. One undo step. Reply: plate (the plate copied), new_plate (the new plate's index), plates (each plate afterwards: index, name and objects, how many stand on it) and current (the current plate).", "destructive": false, "group": "Plates", "guard": "mutate", + "has_own_action": true, "icon": "menu_copy", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "properties": { @@ -4094,18 +4095,18 @@ "duplicate_plate" ], "read_only": false, - "tile_group": "Plate", "title": "Duplicate Plate" }, { + "action_group": "Plate", "completion": "immediate", - "description": "Name a plate (plate, else the current one), as its name icon does: a plate other than the current one is made current first. name \"\" leaves it unnamed. With no arguments, as its tile, the name dialog asks for the current plate's name (blocked_by_dialog), and a cancelled dialog renames nothing, which the call is told. The name is one undo step; the name the plate has already changes nothing, the current plate included. Reply: plate and name.", + "description": "Name a plate (plate, else the current one), as its name icon does: a plate other than the current one is made current first. name \"\" leaves it unnamed. With no arguments, as its Speed Dial action, the name dialog asks for the current plate's name (blocked_by_dialog), and a cancelled dialog renames nothing, which the call is told. The name is one undo step; the name the plate has already changes nothing, the current plate included. Reply: plate and name.", "destructive": false, "group": "Plates", "guard": "mutate", + "has_own_action": true, "icon": "plate_name_edit", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "if": { @@ -4144,17 +4145,26 @@ "select_plate" ], "read_only": false, - "tile_group": "Plate", "title": "Rename Plate" }, { + "actions": [ + { + "args": {}, + "description": "Lock or unlock the current plate.", + "group": "Plate", + "icon": "lock_normal", + "key": "plate_toggle_lock", + "title": "Toggle Plate Lock" + } + ], "completion": "immediate", - "description": "Lock or unlock a plate (plate, else the current one), as its lock icon does: locked true locks it and false unlocks it; without locked it toggles, as its tile does. An arrange of every plate leaves a locked one as it is. One undo step, none when the plate is in that state already. Reply: plate, locked, and changed (false when it was so already).", + "description": "Lock or unlock a plate (plate, else the current one), as its lock icon does: locked true locks it and false unlocks it; without locked it toggles, as its Speed Dial action does. An arrange of every plate leaves a locked one as it is. One undo step, none when the plate is in that state already. Reply: plate, locked, and changed (false when it was so already).", "destructive": false, "group": "Plates", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -4177,26 +4187,28 @@ "set_plate_locked" ], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Lock or unlock the current plate.", - "group": "Plate", - "icon": "lock_normal", - "key": "plate_toggle_lock", - "title": "Toggle Plate Lock" - } - ], "title": "Toggle Plate Lock" }, { + "actions": [ + { + "args": { + "plate": 0 + }, + "description": "Make the first plate the current one.", + "group": "Plate", + "icon": "go_next_plate", + "key": "plate_goto", + "title": "Go to Plate" + } + ], "completion": "immediate", "description": "Make a plate the current one, as a click on it does: plate; without it, the current plate stays current. An index the project lacks is an error. Reply: plate.", "destructive": false, "group": "Plates", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -4215,59 +4227,10 @@ "select_plate" ], "read_only": false, - "tiles": [ - { - "args": { - "plate": 0 - }, - "description": "Make the first plate the current one.", - "group": "Plate", - "icon": "go_next_plate", - "key": "plate_goto", - "title": "Go to Plate" - } - ], "title": "Go to Plate" }, { - "completion": "immediate", - "description": "Slice the current plate, all plates, or one plate by index, the way the toolbar's Slice button does, and wait for the result (or reply with a job id when it takes longer than the reply budget). Each requested plate reports ok, error, cancelled, empty or skipped; the whole operation is superseded when someone else started a slice or edited the project while it ran. An ok plate has time_s (silent_time_s when the printer estimates it), filament_m and filament_g including flush, filament_cost, layers, max_z, filament_changes, and filaments[i] for slot i+1 with m, g and the grams of model_g, support_g, flush_g and tower_g. Other changes are refused until it finishes; job_cancel stops it. The Preview tab shows the result, as after the Slice button; preview: true, alone or with plates \"all\", is the call of Slice and Preview or Slice All Plates, whose pick starts the slice as a job and shows its result as a notification.", - "destructive": false, - "group": "Plates", - "guard": "mutate", - "idempotent": false, - "in_palette": false, - "input_schema": { - "additionalProperties": false, - "properties": { - "plates": { - "description": "\"current\" (default), \"all\", or a plate index.", - "type": [ - "string", - "integer" - ] - }, - "preview": { - "description": "Show the Preview tab, as every slice does: the argument of the Slice and Preview and Slice All Plates tiles.", - "type": "boolean" - }, - "timeout_s": { - "description": "Stop waiting after this long (default 1800): the call fails, and the slice goes on unless job_cancel stops it.", - "maximum": 7200, - "minimum": 10, - "type": "integer" - } - }, - "type": "object" - }, - "key": "plate_slice", - "listed": true, - "open_world": false, - "operations": [ - "start_slice" - ], - "read_only": false, - "tiles": [ + "actions": [ { "args": { "preview": true @@ -4290,6 +4253,43 @@ "title": "Slice All Plates" } ], + "completion": "immediate", + "description": "Slice the current plate, all plates, or one plate by index, the way the toolbar's Slice button does, and wait for the result (or reply with a job id when it takes longer than the reply budget). Each requested plate reports ok, error, cancelled, empty or skipped; the whole operation is superseded when someone else started a slice or edited the project while it ran. An ok plate has time_s (silent_time_s when the printer estimates it), filament_m and filament_g including flush, filament_cost, layers, max_z, filament_changes, and filaments[i] for slot i+1 with m, g and the grams of model_g, support_g, flush_g and tower_g. Other changes are refused until it finishes; job_cancel stops it. The Preview tab shows the result, as after the Slice button; preview: true, alone or with plates \"all\", is the call of Slice and Preview or Slice All Plates, whose pick starts the slice as a job and shows its result as a notification.", + "destructive": false, + "group": "Plates", + "guard": "mutate", + "has_own_action": false, + "idempotent": false, + "input_schema": { + "additionalProperties": false, + "properties": { + "plates": { + "description": "\"current\" (default), \"all\", or a plate index.", + "type": [ + "string", + "integer" + ] + }, + "preview": { + "description": "Show the Preview tab, as every slice does: the argument of the Slice and Preview and Slice All Plates actions.", + "type": "boolean" + }, + "timeout_s": { + "description": "Stop waiting after this long (default 1800): the call fails, and the slice goes on unless job_cancel stops it.", + "maximum": 7200, + "minimum": 10, + "type": "integer" + } + }, + "type": "object" + }, + "key": "plate_slice", + "listed": true, + "open_world": false, + "operations": [ + "start_slice" + ], + "read_only": false, "title": "Slice" }, { @@ -4298,8 +4298,8 @@ "destructive": false, "group": "Plates", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -4390,8 +4390,8 @@ "destructive": false, "group": "Plates", "guard": "inspect", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -4440,8 +4440,8 @@ "destructive": false, "group": "Presets and settings", "guard": "inspect", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -4516,8 +4516,8 @@ "destructive": false, "group": "Presets and settings", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -4571,8 +4571,8 @@ "destructive": false, "group": "Presets and settings", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -4626,8 +4626,8 @@ "destructive": true, "group": "Presets and settings", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -4668,8 +4668,8 @@ "destructive": false, "group": "Presets and settings", "guard": "inspect", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -4730,8 +4730,8 @@ "destructive": false, "group": "Presets and settings", "guard": "inspect", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -4828,8 +4828,8 @@ "destructive": false, "group": "Presets and settings", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -4914,13 +4914,23 @@ "title": "Change settings" }, { + "actions": [ + { + "args": {}, + "description": "Import presets from the file a dialog asks for. preset_import with a path imports a preset .json, a .zip of them, an .orca_printer, .orca_filament or .orca_bundle, or a .gcode without a dialog, and the message names the presets imported, replaced and kept; a .gcode loads the settings it was sliced with.", + "group": "Import", + "icon": "menu_open", + "key": "import_configs", + "title": "Import Configs" + } + ], "completion": "immediate", "description": "Import presets from a preset .json, a .zip of them, an .orca_printer, .orca_filament or .orca_bundle, or a .gcode by absolute path, without a dialog, and the message names the presets imported, replaced and kept; a .gcode loads the settings it was sliced with. Called with no arguments it is Import Configs: the file dialog asks for the file (blocked_by_dialog).", "destructive": false, "group": "Presets and settings", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "if": { @@ -4961,26 +4971,26 @@ "import_presets" ], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Import presets from the file a dialog asks for. preset_import with a path imports a preset .json, a .zip of them, an .orca_printer, .orca_filament or .orca_bundle, or a .gcode without a dialog, and the message names the presets imported, replaced and kept; a .gcode loads the settings it was sliced with.", - "group": "Import", - "icon": "menu_open", - "key": "import_configs", - "title": "Import Configs" - } - ], "title": "Import Configs" }, { + "actions": [ + { + "args": {}, + "description": "Export presets as a bundle or ZIP archives through the Export Preset Bundle dialog: click the label of the kind to export, check its rows (each named after a printer preset or a filament), press OK, then answer the result message. preset_export with a folder as path has OK write there instead of asking for one.", + "group": "Export", + "icon": "save", + "key": "export_config", + "title": "Export Preset Bundle" + } + ], "completion": "immediate", "description": "Export presets as a bundle or ZIP archives through the Export Preset Bundle dialog: click the label of the kind to export, check its rows (each named after a printer preset or a filament), press OK, then answer the result message. Every call opens the dialog (blocked_by_dialog). With path, OK writes into that folder instead of asking for one, and a cancelled dialog is an error: nothing was exported.", "destructive": false, "group": "Presets and settings", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -4996,26 +5006,26 @@ "open_world": false, "operations": [], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Export presets as a bundle or ZIP archives through the Export Preset Bundle dialog: click the label of the kind to export, check its rows (each named after a printer preset or a filament), press OK, then answer the result message. preset_export with a folder as path has OK write there instead of asking for one.", - "group": "Export", - "icon": "save", - "key": "export_config", - "title": "Export Preset Bundle" - } - ], "title": "Export Preset Bundle" }, { + "actions": [ + { + "args": {}, + "description": "Synchronize user presets with the cloud account.", + "group": "Presets", + "icon": "printer_sync_ok", + "key": "sync_presets", + "title": "Sync Presets" + } + ], "completion": "immediate", "description": "Synchronize user presets with the cloud account. Refused while no account is signed in.", "destructive": false, "group": "Presets and settings", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": {}, @@ -5028,26 +5038,26 @@ "sync_presets" ], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Synchronize user presets with the cloud account.", - "group": "Presets", - "icon": "printer_sync_ok", - "key": "sync_presets", - "title": "Sync Presets" - } - ], "title": "Sync Presets" }, { + "actions": [ + { + "args": {}, + "description": "Migrate legacy user filament presets.", + "group": "Help", + "icon": "", + "key": "help_migrate_filament_presets", + "title": "Migrate Filament Presets" + } + ], "completion": "immediate", "description": "Migrate legacy user filament presets.", "destructive": false, "group": "Presets and settings", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": {}, @@ -5058,50 +5068,10 @@ "open_world": false, "operations": [], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Migrate legacy user filament presets.", - "group": "Help", - "icon": "", - "key": "help_migrate_filament_presets", - "title": "Migrate Filament Presets" - } - ], "title": "Migrate Filament Presets" }, { - "completion": "immediate", - "description": "Switch the settings view to Simple, Advanced or Expert mode, which decides which settings the settings pages show.", - "destructive": false, - "group": "Presets and settings", - "guard": "mutate", - "idempotent": false, - "in_palette": false, - "input_schema": { - "additionalProperties": false, - "properties": { - "mode": { - "description": "The mode.", - "enum": [ - "simple", - "advanced", - "expert" - ], - "type": "string" - } - }, - "required": [ - "mode" - ], - "type": "object" - }, - "key": "settings_set_mode", - "listed": true, - "open_world": false, - "operations": [], - "read_only": false, - "tiles": [ + "actions": [ { "args": { "mode": "simple" @@ -5133,16 +5103,56 @@ "title": "Mode: Expert" } ], + "completion": "immediate", + "description": "Switch the settings view to Simple, Advanced or Expert mode, which decides which settings the settings pages show.", + "destructive": false, + "group": "Presets and settings", + "guard": "mutate", + "has_own_action": false, + "idempotent": false, + "input_schema": { + "additionalProperties": false, + "properties": { + "mode": { + "description": "The mode.", + "enum": [ + "simple", + "advanced", + "expert" + ], + "type": "string" + } + }, + "required": [ + "mode" + ], + "type": "object" + }, + "key": "settings_set_mode", + "listed": true, + "open_world": false, + "operations": [], + "read_only": false, "title": "Set the settings mode" }, { + "actions": [ + { + "args": {}, + "description": "Turn Developer mode on or off.", + "group": "Mode", + "icon": "advanced", + "key": "toggle_developer_mode", + "title": "Toggle Developer Mode" + } + ], "completion": "immediate", "description": "Turn Developer mode on or off.", "destructive": false, "group": "Presets and settings", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": {}, @@ -5153,27 +5163,18 @@ "open_world": false, "operations": [], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Turn Developer mode on or off.", - "group": "Mode", - "icon": "advanced", - "key": "toggle_developer_mode", - "title": "Toggle Developer Mode" - } - ], "title": "Toggle Developer Mode" }, { + "action_group": "Filament", "completion": "immediate", "description": "Add a filament slot, as the + button above the filament list does. It takes the next colour and the last slot's preset (change them with preset_select filament_slot and project_set_settings filament_colour). It goes after the physical slots: mixed filaments move up by one, and objects on them follow. Refused for a printer that has one filament per extruder, which shows no + and - buttons. Reply: filament_slot (the new slot) and filament_slots (how many the project has).", "destructive": false, "group": "Filaments", "guard": "mutate", + "has_own_action": true, "icon": "add_filament", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "properties": {}, @@ -5186,18 +5187,18 @@ "add_filament_slot" ], "read_only": false, - "tile_group": "Filament", "title": "Add Filament Slot" }, { + "action_group": "Filament", "completion": "immediate", "description": "Delete a filament slot, as its Delete menu item does, the objects on it taking the first filament; with merge_into, as its Merge with item does, the objects on it taking that slot. The slots after it move down by one. The only physical slot and a mixed filament (project_get_settings filament_is_mixed) are refused, and so is a merge into a mixed filament that mixes the slot. Refused for a printer that has one filament per extruder, which shows no + and - buttons. Not in the undo history. Reply: filament_slot (the slot deleted), merged_into (the slot its objects went to, as numbered afterwards) and filament_slots.", "destructive": false, "group": "Filaments", "guard": "mutate", + "has_own_action": true, "icon": "delete_filament", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "properties": { @@ -5221,7 +5222,6 @@ "delete_filament_slot" ], "read_only": false, - "tile_group": "Filament", "title": "Delete Filament Slot" }, { @@ -5270,8 +5270,8 @@ ], "group": "Filaments", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -5308,13 +5308,23 @@ "title": "Add Mixed Filament" }, { + "actions": [ + { + "args": {}, + "description": "Synchronize the filament list from the connected printer's AMS.", + "group": "Printer", + "icon": "ams_fila_sync", + "key": "sync_ams", + "title": "Synchronize Filament List from AMS" + } + ], "completion": "immediate", - "description": "Synchronize the filament list from the connected printer's AMS. With mode, as the sync dialog's Synchronize now does with that choice, without the dialog: map maps each of the project's filaments to a slot, as the dialog's Mapping first does, which takes a project with objects; overwrite replaces the filament list with the slots' filaments. Called with no arguments, as its tile, it opens the sync dialog where the project has objects (blocked_by_dialog), and a warning where it cannot sync. With no printer connected, no AMS or no filament it is refused, saying so. Not in the undo history. Reply: mode, filaments (each slot's preset and colour afterwards) and mapped_to_generic (slots whose filament is unknown, mapped to a generic preset).", + "description": "Synchronize the filament list from the connected printer's AMS. With mode, as the sync dialog's Synchronize now does with that choice, without the dialog: map maps each of the project's filaments to a slot, as the dialog's Mapping first does, which takes a project with objects; overwrite replaces the filament list with the slots' filaments. Called with no arguments, as its Speed Dial action, it opens the sync dialog where the project has objects (blocked_by_dialog), and a warning where it cannot sync. With no printer connected, no AMS or no filament it is refused, saying so. Not in the undo history. Reply: mode, filaments (each slot's preset and colour afterwards) and mapped_to_generic (slots whose filament is unknown, mapped to a generic preset).", "destructive": false, "group": "Filaments", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -5336,16 +5346,6 @@ "sync_filaments_from_ams" ], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Synchronize the filament list from the connected printer's AMS.", - "group": "Printer", - "icon": "ams_fila_sync", - "key": "sync_ams", - "title": "Synchronize Filament List from AMS" - } - ], "title": "Synchronize Filament List from AMS" }, { @@ -5389,8 +5389,8 @@ ], "group": "Filaments", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -5443,8 +5443,8 @@ ], "group": "Filaments", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -5472,13 +5472,23 @@ "title": "Uninstall system filaments" }, { + "actions": [ + { + "args": {}, + "description": "Open the Send G-code to printer host dialog for the current plate, as the Print button does for a printer with a print host (OctoPrint, Moonraker, PrusaLink, Duet...). Set the file name with widget_set_value and press Upload or Upload and Print with dialog_answer; the plate is sliced if needed, then uploaded in the background: app_state.uploads shows the row's state, and a failed upload also opens an error dialog. A replay uploads again. Fails for a printer without a print host, or one that prints through the Bambu network or printer agents.", + "group": "Slice & Export", + "icon": "printer", + "key": "send_gcode", + "title": "Send G-code to printer host" + } + ], "completion": "immediate", "description": "Open the Send G-code to printer host dialog for the current plate, as the Print button does for a printer with a print host (OctoPrint, Moonraker, PrusaLink, Duet...). Set the file name with widget_set_value and press Upload or Upload and Print with dialog_answer; the plate is sliced if needed, then uploaded in the background: app_state.uploads shows the row's state, and a failed upload also opens an error dialog. A replay uploads again. Fails for a printer without a print host, or one that prints through the Bambu network or printer agents.", "destructive": false, "group": "Printers and prints", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": {}, @@ -5491,16 +5501,6 @@ "send_gcode_to_host" ], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Open the Send G-code to printer host dialog for the current plate, as the Print button does for a printer with a print host (OctoPrint, Moonraker, PrusaLink, Duet...). Set the file name with widget_set_value and press Upload or Upload and Print with dialog_answer; the plate is sliced if needed, then uploaded in the background: app_state.uploads shows the row's state, and a failed upload also opens an error dialog. A replay uploads again. Fails for a printer without a print host, or one that prints through the Bambu network or printer agents.", - "group": "Slice & Export", - "icon": "printer", - "key": "send_gcode", - "title": "Send G-code to printer host" - } - ], "title": "Send G-code to printer host" }, { @@ -5533,8 +5533,8 @@ ], "group": "Printers and prints", "guard": "inspect", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -5617,8 +5617,8 @@ ], "group": "Printers and prints", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -5699,8 +5699,8 @@ ], "group": "Printers and prints", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -5774,8 +5774,8 @@ ], "group": "Plugins", "guard": "inspect", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": {}, @@ -5789,13 +5789,23 @@ "title": "List plugins" }, { + "actions": [ + { + "args": {}, + "description": "Install a plugin from the .py or .whl file a dialog asks for, as the Plugins dialog's Install local plugin does, asking before it replaces one installed; plugin_install_local with a path installs that file without a dialog. A plugin of that name installed already is replaced only with overwrite true; without it the call is refused with the question the dialog asks.", + "group": "Plugins", + "icon": "", + "key": "install_local_plugin", + "title": "Install Local Plugin" + } + ], "completion": "immediate", "description": "Install a plugin from a .py or .whl file by absolute path, as the Plugins dialog's Install local plugin does, without its file dialog. A plugin of that name installed already is replaced only with overwrite true; without it the call is refused with the question the dialog asks. Called with no arguments, the file dialog asks for the file (blocked_by_dialog), and replacing an installed plugin asks first (dialog_answer).", "destructive": false, "group": "Plugins", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "if": { @@ -5830,16 +5840,6 @@ "open_world": false, "operations": [], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Install a plugin from the .py or .whl file a dialog asks for, as the Plugins dialog's Install local plugin does, asking before it replaces one installed; plugin_install_local with a path installs that file without a dialog. A plugin of that name installed already is replaced only with overwrite true; without it the call is refused with the question the dialog asks.", - "group": "Plugins", - "icon": "", - "key": "install_local_plugin", - "title": "Install Local Plugin" - } - ], "title": "Install Local Plugin" }, { @@ -5879,8 +5879,8 @@ ], "group": "Plugins", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -5944,8 +5944,8 @@ ], "group": "Plugins", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -5995,8 +5995,8 @@ ], "group": "Plugins", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -6020,13 +6020,23 @@ "title": "Uninstall a plugin" }, { + "actions": [ + { + "args": {}, + "description": "Reload plugins.", + "group": "Plugins", + "icon": "", + "key": "refresh_plugins", + "title": "Refresh Plugins" + } + ], "completion": "immediate", "description": "Reload the plugins, as Refresh Plugins does: the installed plugins are rescanned and the plugin hub's list fetched again, and a notification says how it went. The call waits for the refresh to end and replies with the plugins, as plugin_list gives them; a refresh already running, or waiting, runs before the call's own, so the reply comes from a rescan that began after the call. job_cancel stops the wait, not the refresh.", "destructive": false, "group": "Plugins", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": {}, @@ -6039,26 +6049,147 @@ "start_plugin_refresh" ], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Reload plugins.", - "group": "Plugins", - "icon": "", - "key": "refresh_plugins", - "title": "Refresh Plugins" - } - ], "title": "Refresh Plugins" }, { + "actions": [ + { + "args": { + "camera": "top" + }, + "description": "Turn the camera of the view shown, the Design tab's too, to the top view.", + "group": "View", + "icon": "", + "key": "view_top", + "title": "View: Top" + }, + { + "args": { + "camera": "bottom" + }, + "description": "Turn the camera of the view shown, the Design tab's too, to the bottom view.", + "group": "View", + "icon": "", + "key": "view_bottom", + "title": "View: Bottom" + }, + { + "args": { + "camera": "front" + }, + "description": "Turn the camera of the view shown, the Design tab's too, to the front view.", + "group": "View", + "icon": "", + "key": "view_front", + "title": "View: Front" + }, + { + "args": { + "camera": "rear" + }, + "description": "Turn the camera of the view shown, the Design tab's too, to the rear view.", + "group": "View", + "icon": "", + "key": "view_rear", + "title": "View: Rear" + }, + { + "args": { + "camera": "left" + }, + "description": "Turn the camera of the view shown, the Design tab's too, to the left view.", + "group": "View", + "icon": "", + "key": "view_left", + "title": "View: Left" + }, + { + "args": { + "camera": "right" + }, + "description": "Turn the camera of the view shown, the Design tab's too, to the right view.", + "group": "View", + "icon": "", + "key": "view_right", + "title": "View: Right" + }, + { + "args": { + "camera": "iso" + }, + "description": "Turn the camera of the view shown, the Design tab's too, to the iso view.", + "group": "View", + "icon": "", + "key": "view_iso", + "title": "View: Isometric" + }, + { + "args": { + "camera": "default" + }, + "description": "Turn the camera of the view shown to the default view and fit the plate; on the Design tab, its Home view.", + "group": "View", + "icon": "", + "key": "view_default", + "title": "View: Default" + }, + { + "args": { + "camera": "fit_bed" + }, + "description": "Fit the build plate in the 3D view shown; refused on the Design tab, which has no bed to fit.", + "group": "View", + "icon": "", + "key": "view_fit_bed", + "title": "Fit Bed to View" + }, + { + "args": { + "projection": "toggle" + }, + "description": "Switch the 3D camera between perspective and orthographic.", + "group": "View", + "icon": "", + "key": "view_toggle_perspective", + "title": "Toggle Perspective" + }, + { + "args": { + "layout": "default" + }, + "description": "Restore the default window layout.", + "group": "View", + "icon": "toolbar_reset", + "key": "reset_window_layout", + "title": "Reset Window Layout" + }, + { + "args": {}, + "description": "Switch to a main window tab.", + "group": "Commands", + "icon": "", + "input": "tab", + "key": "go_to_tab", + "title": "Go to tab..." + }, + { + "args": {}, + "description": "Show the Preview tab at a layer chosen as a percentage of the layer range; an error while the Preview has no layers (slice first).", + "group": "Commands", + "icon": "height_range_layer", + "input": "percent", + "input_arg": "layer_percent", + "key": "go_to_layer", + "title": "Go to layer (percent)" + } + ], "completion": "immediate", - "description": "Set up what the window shows, for screenshots and GUI work: the main tab, the 3D view (canvas: Prepare's, the preview or the assemble view, which has its own gizmos), the camera of the 3D view shown (a named direction, the default view, or fit to bed / objects / selection, then look_at, the point it looks at, an orbit to look from between the named directions, and the zoom), the preview's color scheme (picked as in the legend's combo, which shows every feature type again), legend rows, time estimate and layers (1-based, or up to a height). Only the given fields change, but a preview field given without tab or canvas shows the Preview tab. On the Design tab the camera points its view (default is its Home view; no fit_bed; sketch_normal looks straight at the open sketch), and with tab design, section, origin_planes, world_axes, origin and bed set the Design view's switches. The reply echoes them; preview layers as [first, last, count] with z, the heights of first and last; with tab design, design: the section view and the four switches as they then are; with any camera field, camera_state, the camera it leaves as app_state.camera gives it, and adjusted: [\"zoom\"] when the zoom was held to its limits. tab takes the id of any other page of the window too, such as a plugin's. projection sets the 3D camera's, layout default restores the default window layout, and layer_percent shows the Preview at that share of the layer range, as Go to layer does. Outside the Design tab, from any tab: section {on} turns the section view of Prepare and the Preview on or off; labels, overhangs, outline, wireframe, gridlines, axes and navigator set the display switches of the View menu and of the 3D view's own menu; sidebar_collapsed and sidebar_width set the sidebar of Prepare and the Preview; in the Preview, legend_collapsed folds the legend and gcode_window shows the G-code window. Each is echoed as the app reads it back, and app_state's view gives them under these names. A pick of a view tile runs the same code in place, so a camera tile turns the Design tab's camera too.", + "description": "Set up what the window shows, for screenshots and GUI work: the main tab, the 3D view (canvas: Prepare's, the preview or the assemble view, which has its own gizmos), the camera of the 3D view shown (a named direction, the default view, or fit to bed / objects / selection, then look_at, the point it looks at, an orbit to look from between the named directions, and the zoom), the preview's color scheme (picked as in the legend's combo, which shows every feature type again), legend rows, time estimate and layers (1-based, or up to a height). Only the given fields change, but a preview field given without tab or canvas shows the Preview tab. On the Design tab the camera points its view (default is its Home view; no fit_bed; sketch_normal looks straight at the open sketch), and with tab design, section, origin_planes, world_axes, origin and bed set the Design view's switches. The reply echoes them; preview layers as [first, last, count] with z, the heights of first and last; with tab design, design: the section view and the four switches as they then are; with any camera field, camera_state, the camera it leaves as app_state.camera gives it, and adjusted: [\"zoom\"] when the zoom was held to its limits. tab takes the id of any other page of the window too, such as a plugin's. projection sets the 3D camera's, layout default restores the default window layout, and layer_percent shows the Preview at that share of the layer range, as Go to layer does. Outside the Design tab, from any tab: section {on} turns the section view of Prepare and the Preview on or off; labels, overhangs, outline, wireframe, gridlines, axes and navigator set the display switches of the View menu and of the 3D view's own menu; sidebar_collapsed and sidebar_width set the sidebar of Prepare and the Preview; in the Preview, legend_collapsed folds the legend and gcode_window shows the G-code window. Each is echoed as the app reads it back, and app_state's view gives them under these names. A pick of a view action runs the same code in place, so a camera action turns the Design tab's camera too.", "destructive": false, "group": "View and windows", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -6288,195 +6419,10 @@ "show_layer_range" ], "read_only": false, - "tiles": [ - { - "args": { - "camera": "top" - }, - "description": "Turn the camera of the view shown, the Design tab's too, to the top view.", - "group": "View", - "icon": "", - "key": "view_top", - "title": "View: Top" - }, - { - "args": { - "camera": "bottom" - }, - "description": "Turn the camera of the view shown, the Design tab's too, to the bottom view.", - "group": "View", - "icon": "", - "key": "view_bottom", - "title": "View: Bottom" - }, - { - "args": { - "camera": "front" - }, - "description": "Turn the camera of the view shown, the Design tab's too, to the front view.", - "group": "View", - "icon": "", - "key": "view_front", - "title": "View: Front" - }, - { - "args": { - "camera": "rear" - }, - "description": "Turn the camera of the view shown, the Design tab's too, to the rear view.", - "group": "View", - "icon": "", - "key": "view_rear", - "title": "View: Rear" - }, - { - "args": { - "camera": "left" - }, - "description": "Turn the camera of the view shown, the Design tab's too, to the left view.", - "group": "View", - "icon": "", - "key": "view_left", - "title": "View: Left" - }, - { - "args": { - "camera": "right" - }, - "description": "Turn the camera of the view shown, the Design tab's too, to the right view.", - "group": "View", - "icon": "", - "key": "view_right", - "title": "View: Right" - }, - { - "args": { - "camera": "iso" - }, - "description": "Turn the camera of the view shown, the Design tab's too, to the iso view.", - "group": "View", - "icon": "", - "key": "view_iso", - "title": "View: Isometric" - }, - { - "args": { - "camera": "default" - }, - "description": "Turn the camera of the view shown to the default view and fit the plate; on the Design tab, its Home view.", - "group": "View", - "icon": "", - "key": "view_default", - "title": "View: Default" - }, - { - "args": { - "camera": "fit_bed" - }, - "description": "Fit the build plate in the 3D view shown; refused on the Design tab, which has no bed to fit.", - "group": "View", - "icon": "", - "key": "view_fit_bed", - "title": "Fit Bed to View" - }, - { - "args": { - "projection": "toggle" - }, - "description": "Switch the 3D camera between perspective and orthographic.", - "group": "View", - "icon": "", - "key": "view_toggle_perspective", - "title": "Toggle Perspective" - }, - { - "args": { - "layout": "default" - }, - "description": "Restore the default window layout.", - "group": "View", - "icon": "toolbar_reset", - "key": "reset_window_layout", - "title": "Reset Window Layout" - }, - { - "args": {}, - "description": "Switch to a main window tab.", - "group": "Commands", - "icon": "", - "input": "tab", - "key": "go_to_tab", - "title": "Go to tab..." - }, - { - "args": {}, - "description": "Show the Preview tab at a layer chosen as a percentage of the layer range; an error while the Preview has no layers (slice first).", - "group": "Commands", - "icon": "height_range_layer", - "input": "percent", - "input_arg": "layer_percent", - "key": "go_to_layer", - "title": "Go to layer (percent)" - } - ], "title": "Set up the view" }, { - "completion": "immediate", - "description": "Open one of OrcaSlicer's windows or dialogs for a person, as its menu item does: preferences, the Preferences dialog, with tab, and key on it, on that tab with that preference's control scrolled into view and focused (its controls are named after their preference keys: preferences_get reads them and preferences_set writes those it does not refuse, and widget_set_value {\"target\": {\"name\": key, \"within\": \"Preferences\"}} changes one through the dialog); plugins, the Plugins window; action_replay, the Action Replay window, where a person replays a replay file (agents run one with replay_run); preset_bundle, the preset bundle manager; keyboard_shortcuts; setup_wizard; network_test; troubleshoot, the troubleshooting center; tip_of_the_day; about. A modal one replies blocked_by_dialog.", - "destructive": false, - "group": "View and windows", - "guard": "mutate", - "idempotent": false, - "in_palette": false, - "input_schema": { - "additionalProperties": false, - "properties": { - "key": { - "description": "preferences, with tab: a preference on that tab, e.g. auto_arrange on behaviour: its control is scrolled into view and focused.", - "type": "string" - }, - "tab": { - "description": "preferences: the tab to show.", - "enum": [ - "general", - "files", - "behaviour", - "control", - "graphics", - "online", - "developer" - ], - "type": "string" - }, - "window": { - "description": "The window.", - "enum": [ - "preferences", - "plugins", - "action_replay", - "preset_bundle", - "keyboard_shortcuts", - "setup_wizard", - "network_test", - "troubleshoot", - "tip_of_the_day", - "about" - ], - "type": "string" - } - }, - "required": [ - "window" - ], - "type": "object" - }, - "key": "window_open", - "listed": true, - "open_world": false, - "operations": [], - "read_only": false, - "tiles": [ + "actions": [ { "args": { "window": "preferences" @@ -6578,6 +6524,60 @@ "title": "About OrcaSlicer" } ], + "completion": "immediate", + "description": "Open one of OrcaSlicer's windows or dialogs for a person, as its menu item does: preferences, the Preferences dialog, with tab, and key on it, on that tab with that preference's control scrolled into view and focused (its controls are named after their preference keys: preferences_get reads them and preferences_set writes those it does not refuse, and widget_set_value {\"target\": {\"name\": key, \"within\": \"Preferences\"}} changes one through the dialog); plugins, the Plugins window; action_replay, the Action Replay window, where a person replays a replay file (agents run one with replay_run); preset_bundle, the preset bundle manager; keyboard_shortcuts; setup_wizard; network_test; troubleshoot, the troubleshooting center; tip_of_the_day; about. A modal one replies blocked_by_dialog.", + "destructive": false, + "group": "View and windows", + "guard": "mutate", + "has_own_action": false, + "idempotent": false, + "input_schema": { + "additionalProperties": false, + "properties": { + "key": { + "description": "preferences, with tab: a preference on that tab, e.g. auto_arrange on behaviour: its control is scrolled into view and focused.", + "type": "string" + }, + "tab": { + "description": "preferences: the tab to show.", + "enum": [ + "general", + "files", + "behaviour", + "control", + "graphics", + "online", + "developer" + ], + "type": "string" + }, + "window": { + "description": "The window.", + "enum": [ + "preferences", + "plugins", + "action_replay", + "preset_bundle", + "keyboard_shortcuts", + "setup_wizard", + "network_test", + "troubleshoot", + "tip_of_the_day", + "about" + ], + "type": "string" + } + }, + "required": [ + "window" + ], + "type": "object" + }, + "key": "window_open", + "listed": true, + "open_world": false, + "operations": [], + "read_only": false, "title": "Open a window" }, { @@ -6586,8 +6586,8 @@ "destructive": false, "group": "View and windows", "guard": "inspect", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -6617,8 +6617,8 @@ "destructive": false, "group": "View and windows", "guard": "recover", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -6672,8 +6672,8 @@ "destructive": false, "group": "Recordings, replays and scripts", "guard": "inspect", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -6713,13 +6713,23 @@ "title": "Take a screenshot" }, { + "actions": [ + { + "args": {}, + "description": "Save a PNG of the main window in the folder Start Recording saves in (the person's Downloads unless they chose another) and show the person a notification naming it; the reply has its path. Agents use the window_screenshot tool, which returns the image.", + "group": "Commands", + "icon": "screenshot", + "key": "take_screenshot", + "title": "Take Screenshot" + } + ], "completion": "immediate", "description": "Save a PNG of the main window in the folder Start Recording saves in (the person's Downloads unless they chose another) and show the person a notification naming it; the reply has its path. Agents use the window_screenshot tool, which returns the image.", "destructive": false, "group": "Recordings, replays and scripts", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": {}, @@ -6730,16 +6740,6 @@ "open_world": false, "operations": [], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Save a PNG of the main window in the folder Start Recording saves in (the person's Downloads unless they chose another) and show the person a notification naming it; the reply has its path. Agents use the window_screenshot tool, which returns the image.", - "group": "Commands", - "icon": "screenshot", - "key": "take_screenshot", - "title": "Take Screenshot" - } - ], "title": "Take Screenshot" }, { @@ -6748,8 +6748,8 @@ "destructive": false, "group": "Recordings, replays and scripts", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -6788,8 +6788,8 @@ "destructive": false, "group": "Recordings, replays and scripts", "guard": "inspect", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -6825,8 +6825,8 @@ "destructive": false, "group": "Recordings, replays and scripts", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -6867,8 +6867,8 @@ "destructive": false, "group": "Recordings, replays and scripts", "guard": "inspect", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -6897,13 +6897,23 @@ "title": "Search the Python API" }, { + "actions": [ + { + "args": {}, + "description": "Show or hide the Run Script panel, where a person writes and runs Python scripts cell by cell. Agents run Python with the script_run tool instead.", + "group": "Commands", + "icon": "media_play", + "key": "toggle_run_script_panel", + "title": "Run Script" + } + ], "completion": "immediate", "description": "Show or hide the Run Script panel, where a person writes and runs Python scripts cell by cell. Agents run Python with the script_run tool instead.", "destructive": false, "group": "Recordings, replays and scripts", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": {}, @@ -6914,26 +6924,26 @@ "open_world": false, "operations": [], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Show or hide the Run Script panel, where a person writes and runs Python scripts cell by cell. Agents run Python with the script_run tool instead.", - "group": "Commands", - "icon": "media_play", - "key": "toggle_run_script_panel", - "title": "Run Script" - } - ], "title": "Run Script" }, { + "actions": [ + { + "args": {}, + "description": "Runs recording_start with no arguments, as Start Recording does: the Start Recording dialog, whose Start recording starts the person's recording, which neither the end of a replay or script nor the server turning off ends.", + "group": "Commands", + "icon": "recording_start", + "key": "start_recording", + "title": "Start Recording" + } + ], "completion": "immediate", "description": "Record a video of OrcaSlicer until recording_stop: the main window with any modal dialog on it (target main), or the 3D view shown (canvas). Frames are MJPEG in a Matroska (.mkv) file with their real timestamps. With captions, the tool call acting on the app shows as a caption at the bottom (secret setting values never show); with pointer, the pointer is highlighted, its clicks rippling. Capture takes at most about a third of the UI thread, so the frame rate drops where capturing is slow. One recording at a time: one a replay or script starts ends with it, a client's when the server is turned off. With encode, the recording_stop that reports it also encodes it to an MP4 beside it, as Start Recording does, and the .mkv is deleted once the MP4 is written unless keep_raw_video_file; recording_encode makes an MP4 of any recording later. Called with no arguments, it opens the Start Recording dialog instead, as Start Recording does (blocked_by_dialog): its controls are named after their settings for widget_set_value, dialog_answer \"Start recording\" starts the person's recording, which neither the end of a replay or script nor the server turning off ends, and the dialog remembers the settings; silent: true starts one here at once with the defaults.", "destructive": false, "group": "Recordings, replays and scripts", "guard": "inspect", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -7057,26 +7067,26 @@ "open_world": false, "operations": [], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Runs recording_start with no arguments, as Start Recording does: the Start Recording dialog, whose Start recording starts the person's recording, which neither the end of a replay or script nor the server turning off ends.", - "group": "Commands", - "icon": "recording_start", - "key": "start_recording", - "title": "Start Recording" - } - ], "title": "Start Recording" }, { + "actions": [ + { + "args": {}, + "description": "Runs recording_stop with no arguments, as Stop Recording does: it stops the recording, whoever started it, and shows the person a notification naming its file.", + "group": "Commands", + "icon": "recording_stop", + "key": "stop_recording", + "title": "Stop Recording" + } + ], "completion": "immediate", "description": "Stop the running recording. Call it with silent: true for the report: it waits for the file and returns it with its seconds, frames captured and written, frames dropped when encoding fell behind, failed when they could not be encoded, or skipped when the window could not be captured, the size, the mean UI-thread time a capture took (capture_ms), and why it ended. A recording that ended on its own (max_seconds, the replay or script that started it ended, a write error) is reported once by the next recording_stop. For a recording started with encode, it then starts the MP4 encode and returns it under encode: a job, whose app_wait {for: \"job\"} returns recording_encode's result, whose raw_video_file_deleted says whether the .mkv was deleted. Called with no arguments, it stops the recording as Stop Recording does, whoever started it: without waiting for its file, it shows the person a notification naming it and replies with its path; the next recording_stop with silent: true reports it as ended stopped_in_app.", "destructive": false, "group": "Recordings, replays and scripts", "guard": "inspect", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -7095,16 +7105,6 @@ "open_world": false, "operations": [], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Runs recording_stop with no arguments, as Stop Recording does: it stops the recording, whoever started it, and shows the person a notification naming its file.", - "group": "Commands", - "icon": "recording_stop", - "key": "stop_recording", - "title": "Stop Recording" - } - ], "title": "Stop Recording" }, { @@ -7113,8 +7113,8 @@ "destructive": false, "group": "Recordings, replays and scripts", "guard": "inspect", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -7256,9 +7256,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_sketch", "idempotent": false, - "in_palette": true, "input_schema": { "properties": { "generation": { @@ -7395,9 +7395,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_extrude", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "properties": { @@ -7619,9 +7619,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_revolve", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "properties": { @@ -7838,9 +7838,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_sweep", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "if": { @@ -7980,9 +7980,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_loft", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "if": { @@ -8042,6 +8042,17 @@ "title": "Loft" }, { + "actions": [ + { + "args": { + "type": "surface" + }, + "description": "Thicken a sheet body into a solid. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).", + "icon": "design_thicken", + "key": "thicken_surf", + "title": "Thicken Surface" + } + ], "completion": "immediate", "description": "Thicken a face of a body, or a whole sheet body, into a new solid body by a wall thickness. type face offsets one face of a body into a thin plate. type surface thickens a sheet body: a sheet of several faces whose free rims close into planar loops (the walls of a box with no lids) is capped at them and grows inward, into the closed shape that makes, whatever flip says; one whose rim can't be capped is refused. A single face or a closed shell is offset face by face along each face's normal, the one body_describe gives, or against it with flip; a closed shell can fail to thicken this way. Reply: thicken_index, bodies. Called with exactly one of these argument sets and nothing else, it opens that item's tool of the Design tab for a person, as the menu item does: {\"type\":\"face\"} (Thicken), {\"type\":\"surface\"} (Thicken Surface).", "destructive": false, @@ -8169,9 +8180,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_thicken", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "properties": { @@ -8230,17 +8241,6 @@ "open_world": false, "operations": [], "read_only": false, - "tiles": [ - { - "args": { - "type": "surface" - }, - "description": "Thicken a sheet body into a solid. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).", - "icon": "design_thicken", - "key": "thicken_surf", - "title": "Thicken Surface" - } - ], "title": "Thicken" }, { @@ -8315,9 +8315,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_rib", "idempotent": false, - "in_palette": true, "input_schema": { "if": { "minProperties": 1 @@ -8375,6 +8375,26 @@ "title": "Rib" }, { + "actions": [ + { + "args": { + "operation": "cut" + }, + "description": "Cut the tool body out of the target. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).", + "icon": "design_boolean", + "key": "bool_subtract", + "title": "Subtract" + }, + { + "args": { + "operation": "intersect" + }, + "description": "Keep only where the two bodies overlap. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).", + "icon": "design_boolean", + "key": "bool_intersect", + "title": "Intersect" + } + ], "completion": "immediate", "description": "Combine two bodies: join them, cut the tool from the target, or keep where they intersect. A rejected rebuild is reported in the reply: ok is false or error is not empty. Called with exactly one of these argument sets and nothing else, it opens that item's tool of the Design tab for a person, as the menu item does: {\"operation\":\"join\"} (Join), {\"operation\":\"cut\"} (Subtract), {\"operation\":\"intersect\"} (Intersect).", "destructive": false, @@ -8458,9 +8478,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_boolean", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "if": { @@ -8518,26 +8538,6 @@ "open_world": false, "operations": [], "read_only": false, - "tiles": [ - { - "args": { - "operation": "cut" - }, - "description": "Cut the tool body out of the target. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).", - "icon": "design_boolean", - "key": "bool_subtract", - "title": "Subtract" - }, - { - "args": { - "operation": "intersect" - }, - "description": "Keep only where the two bodies overlap. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).", - "icon": "design_boolean", - "key": "bool_intersect", - "title": "Intersect" - } - ], "title": "Join" }, { @@ -8625,9 +8625,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_extrude", "idempotent": false, - "in_palette": true, "input_schema": { "if": { "minProperties": 1 @@ -8758,9 +8758,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_revolve", "idempotent": false, - "in_palette": true, "input_schema": { "if": { "minProperties": 1 @@ -8906,9 +8906,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_loft", "idempotent": false, - "in_palette": true, "input_schema": { "if": { "minProperties": 1 @@ -9028,9 +9028,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_surface", "idempotent": false, - "in_palette": true, "input_schema": { "if": { "minProperties": 1 @@ -9169,9 +9169,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_hole", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "properties": { @@ -9407,9 +9407,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_thread", "idempotent": false, - "in_palette": true, "input_schema": { "properties": { "at": { @@ -9589,9 +9589,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_shell", "idempotent": false, - "in_palette": true, "input_schema": { "properties": { "body": { @@ -9722,9 +9722,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_cut", "idempotent": false, - "in_palette": true, "input_schema": { "properties": { "body": { @@ -9880,9 +9880,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_filletedge", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "if": { @@ -9981,9 +9981,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_chamfer", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "if": { @@ -10080,9 +10080,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_draft", "idempotent": false, - "in_palette": true, "input_schema": { "if": { "minProperties": 1 @@ -10222,9 +10222,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_offset", "idempotent": false, - "in_palette": true, "input_schema": { "properties": { "body": { @@ -10260,6 +10260,17 @@ "title": "Surface Offset" }, { + "actions": [ + { + "args": { + "type": "circular" + }, + "description": "Repeat the body around an axis — set the count and sweep. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).", + "icon": "design_polararray", + "key": "pattern_circular", + "title": "Circular pattern" + } + ], "completion": "immediate", "description": "Replicate a body in a row, around the plane's normal, or along a sketch curve. linear places count copies along a plane axis at spacing; circular spreads them over angle about the plane's normal through its origin; curve places them at equal-parameter points on a sketch entity, each translated by (P_i - P_0). An argument of one type is refused with another. Reply: pattern_index, bodies, and for linear and circular the frame. Called with exactly one of these argument sets and nothing else, it opens that item's tool of the Design tab for a person, as the menu item does: {\"type\":\"linear\"} (Linear pattern), {\"type\":\"circular\"} (Circular pattern).", "destructive": false, @@ -10388,9 +10399,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_array", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "properties": { @@ -10477,17 +10488,6 @@ "open_world": false, "operations": [], "read_only": false, - "tiles": [ - { - "args": { - "type": "circular" - }, - "description": "Repeat the body around an axis — set the count and sweep. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).", - "icon": "design_polararray", - "key": "pattern_circular", - "title": "Circular pattern" - } - ], "title": "Linear pattern" }, { @@ -10569,9 +10569,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_mirror", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "properties": { @@ -10671,9 +10671,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_move", "idempotent": false, - "in_palette": true, "input_schema": { "properties": { "angle": { @@ -10847,9 +10847,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_c_coincident", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "if": { @@ -11019,9 +11019,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_plane", "idempotent": false, - "in_palette": true, "input_schema": { "properties": { "angle": { @@ -11235,9 +11235,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_line", "idempotent": false, - "in_palette": true, "input_schema": { "properties": { "body": { @@ -11358,9 +11358,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_point", "idempotent": false, - "in_palette": true, "input_schema": { "properties": { "body": { @@ -11462,9 +11462,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_thread", "idempotent": false, - "in_palette": true, "input_schema": { "properties": { "generation": { @@ -11637,9 +11637,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_sketch", "idempotent": false, - "in_palette": true, "input_schema": { "properties": { "edges": { @@ -11811,8 +11811,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "properties": { "a": { @@ -11874,9 +11874,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "info", "idempotent": true, - "in_palette": true, "input_schema": { "properties": { "body": { @@ -11941,9 +11941,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_boolean", "idempotent": true, - "in_palette": true, "input_schema": { "properties": { "generation": { @@ -12032,9 +12032,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_edit", "idempotent": false, - "in_palette": true, "input_schema": { "if": { "minProperties": 1 @@ -12087,9 +12087,9 @@ "destructive": false, "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "rename_edit", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "properties": {}, @@ -12152,9 +12152,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_delete", "idempotent": false, - "in_palette": true, "input_schema": { "if": { "minProperties": 1 @@ -12202,9 +12202,9 @@ "destructive": false, "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_zoom", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "properties": {}, @@ -12293,9 +12293,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_delete", "idempotent": false, - "in_palette": true, "input_schema": { "if": { "minProperties": 1 @@ -12384,9 +12384,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_delete", "idempotent": false, - "in_palette": true, "input_schema": { "if": { "minProperties": 1 @@ -12429,9 +12429,9 @@ "destructive": false, "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_polygon", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "properties": {}, @@ -12450,9 +12450,9 @@ "destructive": false, "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_polygon", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "properties": {}, @@ -12520,9 +12520,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_text", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "if": { @@ -12644,9 +12644,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_svg", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "if": { @@ -12781,9 +12781,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_offset", "idempotent": false, - "in_palette": true, "input_schema": { "if": { "minProperties": 1 @@ -12882,9 +12882,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_trim", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "if": { @@ -12970,9 +12970,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_filletedge", "idempotent": false, - "in_palette": true, "input_schema": { "if": { "minProperties": 1 @@ -13057,9 +13057,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_chamfer", "idempotent": false, - "in_palette": true, "input_schema": { "if": { "minProperties": 1 @@ -13230,9 +13230,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_mirror", "idempotent": false, - "in_palette": true, "input_schema": { "properties": { "axis": { @@ -13377,9 +13377,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_dimension", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "if": { @@ -13574,9 +13574,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_constrain", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "if": { @@ -13660,9 +13660,9 @@ "destructive": false, "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_constrain", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "properties": {}, @@ -13734,9 +13734,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_construction", "idempotent": false, - "in_palette": true, "input_schema": { "properties": { "entities": { @@ -13823,9 +13823,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_extend", "idempotent": false, - "in_palette": true, "input_schema": { "additionalProperties": false, "if": { @@ -13949,9 +13949,9 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": true, "icon": "design_delete", "idempotent": false, - "in_palette": true, "input_schema": { "properties": { "entities": { @@ -14015,8 +14015,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "properties": { "generation": { @@ -14096,8 +14096,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "properties": { "feature": { @@ -14197,8 +14197,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "properties": { "adjacency": { @@ -14388,8 +14388,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "properties": { "body": { @@ -14488,8 +14488,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "properties": { "body": { @@ -14604,8 +14604,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "properties": { "generation": { @@ -14694,8 +14694,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "properties": { "generation": { @@ -14790,8 +14790,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "properties": { "generation": { @@ -14837,8 +14837,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "properties": { "generation": { @@ -14883,8 +14883,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "properties": { "generation": { @@ -14979,8 +14979,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "properties": { "end_a": { @@ -15091,8 +15091,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "properties": { "expr": { @@ -15193,8 +15193,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "properties": { "expr": { @@ -15265,8 +15265,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "properties": { "delta": { @@ -15369,8 +15369,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -15429,8 +15429,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "properties": { "feature": { @@ -15461,6 +15461,15 @@ "title": "Feature rename" }, { + "actions": [ + { + "args": {}, + "description": "Set the selected body's display color. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).", + "icon": "color_palette", + "key": "colour", + "title": "Color" + } + ], "completion": "immediate", "description": "Rename, colour or show/hide a body, as its Bodies row and the Color button do; give one or more. Not in the undo history. The name and colour are saved with the project and the name names its committed object; visibility is view state, and commit_to_plate leaves hidden bodies out. Reply: name, color, visible. Called with exactly one of these argument sets and nothing else, it opens that item's tool of the Design tab for a person, as the menu item does: {} (Color).", "destructive": false, @@ -15534,8 +15543,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "if": { "minProperties": 1 @@ -15593,15 +15602,6 @@ "open_world": false, "operations": [], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Set the selected body's display color. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).", - "icon": "color_palette", - "key": "colour", - "title": "Color" - } - ], "title": "Body set" }, { @@ -15673,8 +15673,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "properties": { "generation": { @@ -15742,8 +15742,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "properties": { "discard_changes": { @@ -15794,8 +15794,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "properties": { "generation": { @@ -15877,8 +15877,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "properties": { "generation": { @@ -15933,8 +15933,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "properties": { "generation": { @@ -16037,8 +16037,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "properties": { "generation": { @@ -16064,6 +16064,230 @@ "title": "Sketch edit" }, { + "actions": [ + { + "args": { + "type": "line" + }, + "description": "Line — click start, then end. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_line", + "key": "sk_line_t", + "title": "Line" + }, + { + "args": { + "type": "polyline" + }, + "description": "Click points; click the first point to close the loop, right-click to end it open. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_polyline", + "key": "sk_polyline", + "title": "Polyline" + }, + { + "args": { + "type": "rectangle_2_point" + }, + "description": "Rectangle — click two opposite corners. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_rect", + "key": "sk_rect", + "title": "Corner rectangle" + }, + { + "args": { + "type": "rectangle_center" + }, + "description": "Click center, then a corner. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_crect", + "key": "sk_rect_center", + "title": "Center rectangle" + }, + { + "args": { + "type": "rectangle_3_point" + }, + "description": "Click two corners of one edge, then a point for the width. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_rect_oblique", + "key": "sk_rect_oblique", + "title": "Oblique rectangle" + }, + { + "args": { + "type": "rectangle_rounded" + }, + "description": "Click two opposite corners, then a point for the corner radius. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_rect_rounded", + "key": "sk_rect_rounded", + "title": "Rounded rectangle" + }, + { + "args": { + "type": "circle_center" + }, + "description": "Circle — click center, then radius. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_circle", + "key": "sk_circle", + "title": "Center circle" + }, + { + "args": { + "type": "circle_2_point" + }, + "description": "Click two ends of the diameter. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_circle2pt", + "key": "sk_circle_2pt", + "title": "2-point circle" + }, + { + "args": { + "type": "circle_3_point" + }, + "description": "Click three points on the circle. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_circle3pt", + "key": "sk_circle_3pt", + "title": "3-point circle" + }, + { + "args": { + "type": "arc_3_point" + }, + "description": "Arc — click start, end, then a point. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_arc3pt", + "key": "sk_arc_t", + "title": "3-point arc" + }, + { + "args": { + "type": "arc_tangent" + }, + "description": "Click start (on the last entity) then end. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_tangentarc", + "key": "sk_arc_tangent", + "title": "Tangent arc" + }, + { + "args": { + "type": "arc_center" + }, + "description": "Click center, then start, then a point for the end angle. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_arc_center", + "key": "sk_arc_center", + "title": "Center-point arc" + }, + { + "args": { + "type": "slot" + }, + "description": "Slot — two centerline ends, then the width. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_slot", + "key": "sk_slot", + "title": "Slot" + }, + { + "args": { + "type": "slot_arc" + }, + "description": "Click center, start, end, then a point for the width. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_slot_arc", + "key": "sk_slot_arc", + "title": "Arc slot" + }, + { + "args": { + "type": "ellipse" + }, + "description": "Ellipse — center, major end, minor point. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_ellipse", + "key": "sk_ellipse", + "title": "Ellipse" + }, + { + "args": { + "type": "ellipse_arc" + }, + "description": "Click center, major-axis end, minor point, then arc start and end. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_ellipse_arc", + "key": "sk_ellipse_arc", + "title": "Elliptical arc" + }, + { + "args": { + "type": "spline" + }, + "description": "Spline — click control points. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_bspline", + "key": "sk_spline", + "title": "Spline" + }, + { + "args": { + "sides": 3, + "type": "polygon" + }, + "description": "Triangle — click center, then a vertex. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_polygon", + "key": "sk_poly_3", + "title": "Triangle" + }, + { + "args": { + "sides": 4, + "type": "polygon" + }, + "description": "Square — click center, then a vertex. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_polygon", + "key": "sk_poly_4", + "title": "Square" + }, + { + "args": { + "sides": 5, + "type": "polygon" + }, + "description": "Pentagon — click center, then a vertex. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_polygon", + "key": "sk_poly_5", + "title": "Pentagon" + }, + { + "args": { + "sides": 6, + "type": "polygon" + }, + "description": "Hexagon — click center, then a vertex. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_polygon", + "key": "sk_polygon", + "title": "Hexagon" + }, + { + "args": { + "sides": 8, + "type": "polygon" + }, + "description": "Octagon — click center, then a vertex. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_polygon", + "key": "sk_poly_8", + "title": "Octagon" + }, + { + "args": { + "sides": 12, + "type": "polygon" + }, + "description": "Dodecagon — click center, then a vertex. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_polygon", + "key": "sk_poly_12", + "title": "Dodecagon" + }, + { + "args": { + "type": "point" + }, + "description": "Point — click to place. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_point", + "key": "sk_point_t", + "title": "Point" + } + ], "completion": "immediate", "description": "Draw a shape in the open sketch from its fields beside `type`, or a list of shapes as `entities`. Each type, and the fields it takes: line {p0, p1}; polyline {points: 2 or more, a loop when the last is the first}; rectangle_2_point {p0, p1: opposite corners}; rectangle_center {center, corner}; rectangle_3_point {p0, p1: one side; width: signed, to the left of p0 to p1}; rectangle_rounded {p0, p1: opposite corners; radius: of the corners}; circle_center {center, radius}; circle_2_point {p0, p1: the ends of a diameter}; circle_3_point {p0, p1, p2: on the circle}; arc_3_point {p0: start; p1: end; on_arc}; arc_center {center, radius, start_angle, end_angle}; arc_tangent {end; entity: the line or arc it leaves, the sketch's or one an item before it adds, at that one's end, along its direction there, left out the one added last}; slot {c0, c1, width}; slot_arc {center, start, end: its direction from the centre, width}; ellipse {center, radius (semi-major), rminor, rotation}; ellipse_arc {the ellipse's fields, start_angle, end_angle: parametric, counter-clockwise}; spline {ctrl: 2 or more poles}; polygon {center, sides, radius (to a vertex) or across_flats, angle (of that vertex, or of the first edge's midpoint)}; point {p}. A type refuses a field it does not take. Each is built as its drawing tool builds it: a rectangle, a slot or a polygon is one shape, which one undo of the sketch takes off whole, and a polyline is its lines, as its tool leaves them; the constraints are inferred exactly, so that none moves what is given. Each shape carries the constraints its tool gives it, at any slant; a constraint between a shape and the sketch's axes or what is already in the sketch, or between plain lines, is inferred only where it holds exactly, so a square on the axes is level only on a side lying exactly on one, with right angles holding the others. Each item of entities may carry its own construction; the top-level construction is the single-type form's, and beside entities each item's that gives none. Beside entities a shape's field, type among them, is refused: it belongs in its item. Points are [x, y] in the sketch plane (mm); angles are radians, or degrees as start_angle_deg and the like. A polygon is lines; its side count is not kept once committed. Reply: first_index, added, shapes [{first, count}] per item, entities, dof. Called with exactly one of these argument sets and nothing else, it opens that item's tool of the Design tab for a person, as the menu item does: {\"type\":\"line\"} (Line), {\"type\":\"polyline\"} (Polyline), {\"type\":\"rectangle_2_point\"} (Corner rectangle), {\"type\":\"rectangle_center\"} (Center rectangle), {\"type\":\"rectangle_3_point\"} (Oblique rectangle), {\"type\":\"rectangle_rounded\"} (Rounded rectangle), {\"type\":\"circle_center\"} (Center circle), {\"type\":\"circle_2_point\"} (2-point circle), {\"type\":\"circle_3_point\"} (3-point circle), {\"type\":\"arc_3_point\"} (3-point arc), {\"type\":\"arc_tangent\"} (Tangent arc), {\"type\":\"arc_center\"} (Center-point arc), {\"type\":\"slot\"} (Slot), {\"type\":\"slot_arc\"} (Arc slot), {\"type\":\"ellipse\"} (Ellipse), {\"type\":\"ellipse_arc\"} (Elliptical arc), {\"type\":\"spline\"} (Spline), {\"sides\":3,\"type\":\"polygon\"} (Triangle), {\"sides\":4,\"type\":\"polygon\"} (Square), {\"sides\":5,\"type\":\"polygon\"} (Pentagon), {\"sides\":6,\"type\":\"polygon\"} (Hexagon), {\"sides\":8,\"type\":\"polygon\"} (Octagon), {\"sides\":12,\"type\":\"polygon\"} (Dodecagon), {\"type\":\"point\"} (Point).", "destructive": false, @@ -16171,8 +16395,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -16444,230 +16668,6 @@ "open_world": false, "operations": [], "read_only": false, - "tiles": [ - { - "args": { - "type": "line" - }, - "description": "Line — click start, then end. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_line", - "key": "sk_line_t", - "title": "Line" - }, - { - "args": { - "type": "polyline" - }, - "description": "Click points; click the first point to close the loop, right-click to end it open. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_polyline", - "key": "sk_polyline", - "title": "Polyline" - }, - { - "args": { - "type": "rectangle_2_point" - }, - "description": "Rectangle — click two opposite corners. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_rect", - "key": "sk_rect", - "title": "Corner rectangle" - }, - { - "args": { - "type": "rectangle_center" - }, - "description": "Click center, then a corner. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_crect", - "key": "sk_rect_center", - "title": "Center rectangle" - }, - { - "args": { - "type": "rectangle_3_point" - }, - "description": "Click two corners of one edge, then a point for the width. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_rect_oblique", - "key": "sk_rect_oblique", - "title": "Oblique rectangle" - }, - { - "args": { - "type": "rectangle_rounded" - }, - "description": "Click two opposite corners, then a point for the corner radius. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_rect_rounded", - "key": "sk_rect_rounded", - "title": "Rounded rectangle" - }, - { - "args": { - "type": "circle_center" - }, - "description": "Circle — click center, then radius. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_circle", - "key": "sk_circle", - "title": "Center circle" - }, - { - "args": { - "type": "circle_2_point" - }, - "description": "Click two ends of the diameter. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_circle2pt", - "key": "sk_circle_2pt", - "title": "2-point circle" - }, - { - "args": { - "type": "circle_3_point" - }, - "description": "Click three points on the circle. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_circle3pt", - "key": "sk_circle_3pt", - "title": "3-point circle" - }, - { - "args": { - "type": "arc_3_point" - }, - "description": "Arc — click start, end, then a point. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_arc3pt", - "key": "sk_arc_t", - "title": "3-point arc" - }, - { - "args": { - "type": "arc_tangent" - }, - "description": "Click start (on the last entity) then end. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_tangentarc", - "key": "sk_arc_tangent", - "title": "Tangent arc" - }, - { - "args": { - "type": "arc_center" - }, - "description": "Click center, then start, then a point for the end angle. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_arc_center", - "key": "sk_arc_center", - "title": "Center-point arc" - }, - { - "args": { - "type": "slot" - }, - "description": "Slot — two centerline ends, then the width. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_slot", - "key": "sk_slot", - "title": "Slot" - }, - { - "args": { - "type": "slot_arc" - }, - "description": "Click center, start, end, then a point for the width. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_slot_arc", - "key": "sk_slot_arc", - "title": "Arc slot" - }, - { - "args": { - "type": "ellipse" - }, - "description": "Ellipse — center, major end, minor point. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_ellipse", - "key": "sk_ellipse", - "title": "Ellipse" - }, - { - "args": { - "type": "ellipse_arc" - }, - "description": "Click center, major-axis end, minor point, then arc start and end. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_ellipse_arc", - "key": "sk_ellipse_arc", - "title": "Elliptical arc" - }, - { - "args": { - "type": "spline" - }, - "description": "Spline — click control points. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_bspline", - "key": "sk_spline", - "title": "Spline" - }, - { - "args": { - "sides": 3, - "type": "polygon" - }, - "description": "Triangle — click center, then a vertex. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_polygon", - "key": "sk_poly_3", - "title": "Triangle" - }, - { - "args": { - "sides": 4, - "type": "polygon" - }, - "description": "Square — click center, then a vertex. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_polygon", - "key": "sk_poly_4", - "title": "Square" - }, - { - "args": { - "sides": 5, - "type": "polygon" - }, - "description": "Pentagon — click center, then a vertex. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_polygon", - "key": "sk_poly_5", - "title": "Pentagon" - }, - { - "args": { - "sides": 6, - "type": "polygon" - }, - "description": "Hexagon — click center, then a vertex. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_polygon", - "key": "sk_polygon", - "title": "Hexagon" - }, - { - "args": { - "sides": 8, - "type": "polygon" - }, - "description": "Octagon — click center, then a vertex. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_polygon", - "key": "sk_poly_8", - "title": "Octagon" - }, - { - "args": { - "sides": 12, - "type": "polygon" - }, - "description": "Dodecagon — click center, then a vertex. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_polygon", - "key": "sk_poly_12", - "title": "Dodecagon" - }, - { - "args": { - "type": "point" - }, - "description": "Point — click to place. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_point", - "key": "sk_point_t", - "title": "Point" - } - ], "title": "Sketch draw" }, { @@ -16751,8 +16751,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "properties": { "entities": { @@ -16840,8 +16840,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "properties": { "generation": { @@ -16869,6 +16869,29 @@ "title": "Sketch repair" }, { + "actions": [ + { + "args": {}, + "description": "Type the length of this line. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_dimension", + "key": "sk_length", + "title": "Length…" + }, + { + "args": {}, + "description": "Type the radius of this arc, or the diameter of this circle. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_dimension", + "key": "sk_radius", + "title": "Radius / diameter…" + }, + { + "args": {}, + "description": "Type the angle between two lines, or the distance between the two picks. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_dimension", + "key": "sk_angdist", + "title": "Angle / distance…" + } + ], "completion": "immediate", "description": "Set the dimension of the selected sketch entities, as the value field does. A line's length, a circle's diameter, an arc's radius, or the angle or distance between two. Select them with sketch_select first. Reply: kind, before, value, dof and the loops. Called with exactly one of these argument sets and nothing else, it opens that item's tool of the Design tab for a person, as the menu item does: {} (Length…, Radius / diameter…, Angle / distance…).", "destructive": false, @@ -16955,8 +16978,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "if": { "minProperties": 1 @@ -16991,32 +17014,38 @@ "open_world": false, "operations": [], "read_only": false, - "tiles": [ - { - "args": {}, - "description": "Type the length of this line. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_dimension", - "key": "sk_length", - "title": "Length…" - }, - { - "args": {}, - "description": "Type the radius of this arc, or the diameter of this circle. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_dimension", - "key": "sk_radius", - "title": "Radius / diameter…" - }, - { - "args": {}, - "description": "Type the angle between two lines, or the distance between the two picks. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_dimension", - "key": "sk_angdist", - "title": "Angle / distance…" - } - ], "title": "Sketch set value" }, { + "actions": [ + { + "args": { + "type": "move" + }, + "description": "Pick entities, then drag the handle or click the distance; click empty to apply. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_move", + "key": "sk_move", + "title": "Move" + }, + { + "args": { + "type": "rotate" + }, + "description": "Pick entities, then drag around the pivot or click the angle; click empty to apply. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_rotate", + "key": "sk_rotate", + "title": "Rotate" + }, + { + "args": { + "type": "scale" + }, + "description": "Pick entities, then drag the handle or click the factor; click empty to apply. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_scale", + "key": "sk_scale", + "title": "Scale" + } + ], "completion": "immediate", "description": "Move, rotate or scale entities of the open sketch, as the transform tools' Confirm does. move {dx, dy}, rotate {angle, pivot} and scale {scale, pivot} change the entities and release the constraints that no longer hold. pivot defaults to the entities' centroid. Angles are radians, or degrees as angle_deg. Reply: type, moved, released_constraints, pivot, entities, dof. Called with exactly one of these argument sets and nothing else, it opens that item's tool of the Design tab for a person, as the menu item does: {\"type\":\"move\"} (Move), {\"type\":\"rotate\"} (Rotate), {\"type\":\"scale\"} (Scale).", "destructive": false, @@ -17103,8 +17132,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -17166,38 +17195,29 @@ "open_world": false, "operations": [], "read_only": false, - "tiles": [ - { - "args": { - "type": "move" - }, - "description": "Pick entities, then drag the handle or click the distance; click empty to apply. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_move", - "key": "sk_move", - "title": "Move" - }, - { - "args": { - "type": "rotate" - }, - "description": "Pick entities, then drag around the pivot or click the angle; click empty to apply. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_rotate", - "key": "sk_rotate", - "title": "Rotate" - }, - { - "args": { - "type": "scale" - }, - "description": "Pick entities, then drag the handle or click the factor; click empty to apply. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_scale", - "key": "sk_scale", - "title": "Scale" - } - ], "title": "Sketch transform" }, { + "actions": [ + { + "args": { + "type": "linear" + }, + "description": "Pick entities, drag the spacing handle, click the count; click empty to apply. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_array", + "key": "sk_array", + "title": "Linear array" + }, + { + "args": { + "type": "circular" + }, + "description": "Pick entities, drag the sweep handle, click the count; click empty to apply. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", + "icon": "design_polararray", + "key": "sk_array_polar", + "title": "Polar array" + } + ], "completion": "immediate", "description": "Repeat entities of the open sketch in a row or around a point, as the Linear and Polar array tools do. linear adds copies stepped by dx, dy; circular adds copies every angle/count about pivot (angle is the whole sweep, default 360 degrees). count includes the original, and each copy is bound to its source (equal length and parallel, or its radius). Angles are radians, or degrees as angle_deg. Reply: type, first_index, added, bound, pivot (circular), entities, dof. Called with exactly one of these argument sets and nothing else, it opens that item's tool of the Design tab for a person, as the menu item does: {\"type\":\"linear\"} (Linear array), {\"type\":\"circular\"} (Polar array).", "destructive": false, @@ -17283,8 +17303,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -17348,26 +17368,6 @@ "open_world": false, "operations": [], "read_only": false, - "tiles": [ - { - "args": { - "type": "linear" - }, - "description": "Pick entities, drag the spacing handle, click the count; click empty to apply. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_array", - "key": "sk_array", - "title": "Linear array" - }, - { - "args": { - "type": "circular" - }, - "description": "Pick entities, drag the sweep handle, click the count; click empty to apply. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).", - "icon": "design_polararray", - "key": "sk_array_polar", - "title": "Polar array" - } - ], "title": "Sketch pattern" }, { @@ -17413,8 +17413,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "properties": { "generation": { @@ -17530,8 +17530,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "properties": { "cs_a": { @@ -17655,8 +17655,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -17788,8 +17788,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -17849,8 +17849,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -17936,8 +17936,8 @@ ], "group": "Design", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -18000,8 +18000,8 @@ "destructive": false, "group": "Driving the GUI", "guard": "inspect", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -18053,8 +18053,8 @@ "destructive": false, "group": "Driving the GUI", "guard": "recover", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -18129,8 +18129,8 @@ "destructive": false, "group": "Driving the GUI", "guard": "recover", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -18179,8 +18179,8 @@ "destructive": false, "group": "Driving the GUI", "guard": "recover", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -18225,8 +18225,8 @@ "destructive": false, "group": "Driving the GUI", "guard": "recover", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -18411,8 +18411,8 @@ "destructive": false, "group": "Driving the GUI", "guard": "mutate", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -18453,8 +18453,8 @@ "destructive": false, "group": "Driving the GUI", "guard": "recover", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -18492,8 +18492,8 @@ "destructive": false, "group": "Driving the GUI", "guard": "recover", + "has_own_action": false, "idempotent": true, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { @@ -18546,8 +18546,8 @@ "destructive": false, "group": "Driving the GUI", "guard": "recover", + "has_own_action": false, "idempotent": false, - "in_palette": false, "input_schema": { "additionalProperties": false, "properties": { diff --git a/tests/data/speed_dial_tile_calls.json b/tests/data/speed_dial_action_calls.json similarity index 100% rename from tests/data/speed_dial_tile_calls.json rename to tests/data/speed_dial_action_calls.json diff --git a/tests/data/speed_dial_tiles.json b/tests/data/speed_dial_actions.json similarity index 100% rename from tests/data/speed_dial_tiles.json rename to tests/data/speed_dial_actions.json diff --git a/tests/slic3rutils/retired_names.hpp b/tests/slic3rutils/retired_names.hpp index 7a9367753e..3106ae82b2 100644 --- a/tests/slic3rutils/retired_names.hpp +++ b/tests/slic3rutils/retired_names.hpp @@ -26,8 +26,8 @@ inline const std::vector kRetiredTools{ "pick_gizmo_file", "run_javascript", "open_files", "get_settings", "set_settings"}; -// The ids of the menu items that are a tile of a command of another name (the design's Mapping), each the key of -// its tile: those of the project, the objects, the parts and the plates, then those of the presets, the app, the view +// The ids of the menu items that are an action of a command of another name (the design's Mapping), each the key of +// its action: those of the project, the objects, the parts and the plates, then those of the presets, the app, the view // and the rest. inline const std::vector kRetiredMenuItems{ "new_project", "load_project", "import_file", "import_zip_archive", diff --git a/tests/slic3rutils/test_action_source.cpp b/tests/slic3rutils/test_action_source.cpp index bb5e687863..3079de19c6 100644 --- a/tests/slic3rutils/test_action_source.cpp +++ b/tests/slic3rutils/test_action_source.cpp @@ -42,14 +42,15 @@ public: AppActionRunResult run(const nlohmann::json& /*args*/) const override { return {}; } }; -// The action the registry makes of the Speed Dial's tile `key`, a command's own or an item of its tiles; null when no -// command of the process catalog has that tile. -std::unique_ptr tile_action(const std::string& key) +// The AppAction the registry makes of the Speed Dial action with key `key`, a command's own or an item of its actions; +// null when no command of the process catalog has that action. +std::unique_ptr speed_dial_action(const std::string& key) { - const auto [command, tile] = Slic3r::GUI::find_tile(Slic3r::GUI::NativeCommands::instance(), key); + const auto [command, action] = Slic3r::GUI::find_command_action(Slic3r::GUI::NativeCommands::instance(), key); if (command == nullptr) return nullptr; - return tile != nullptr ? Slic3r::GUI::NativeCommands::make_action(*command, *tile) : Slic3r::GUI::NativeCommands::make_action(*command); + return action != nullptr ? Slic3r::GUI::NativeCommands::make_action(*command, *action) : + Slic3r::GUI::NativeCommands::make_action(*command); } } // namespace @@ -135,7 +136,7 @@ TEST_CASE("Command action construction keys by catalog key", "[ActionSource][Spe } // The footer description/wiki link is settings-only: built-in commands leave both fields empty, so -// the palette's detail strip depends on list-level visibility for them. +// the Speed Dial's detail strip depends on list-level visibility for them. TEST_CASE("Actions default to no description or wiki link", "[ActionSource][SpeedDial]") { const TestAppAction action; @@ -150,11 +151,11 @@ TEST_CASE("Actions default to no description or wiki link", "[ActionSource][Spee CHECK(command->help_url.empty()); } -// Two-phase tiles declare the input the palette must collect before they can run. +// Two-phase actions declare the input the Speed Dial must collect before they can run. TEST_CASE("Two-phase commands declare their input phase", "[ActionSource][SpeedDial]") { - const std::unique_ptr layer = tile_action("go_to_layer"); - const std::unique_ptr tab = tile_action("go_to_tab"); + const std::unique_ptr layer = speed_dial_action("go_to_layer"); + const std::unique_ptr tab = speed_dial_action("go_to_tab"); REQUIRE(layer != nullptr); REQUIRE(tab != nullptr); CHECK(layer->input == "percent"); @@ -162,19 +163,20 @@ TEST_CASE("Two-phase commands declare their input phase", "[ActionSource][SpeedD } // The input token vocabulary is a JS<->C++ contract (speeddial.js dispatches "percent"/"tab"). -// A typo here would leave a tile that never enters its second phase, so pin the allowed set. +// A typo here would leave an action that never enters its second phase, so pin the allowed set. TEST_CASE("Command input tokens stay in the known vocabulary", "[ActionSource][SpeedDial]") { - for (const Slic3r::GUI::NativeCommands::PaletteTile& t : Slic3r::GUI::NativeCommands::palette_tiles(Slic3r::GUI::NativeCommands::instance())) { - const std::string key = t.tile != nullptr ? t.tile->at("key").get() : t.command->key; - const std::string input = t.tile != nullptr ? t.tile->value("input", std::string()) : t.command->input; + for (const Slic3r::GUI::NativeCommands::SpeedDialAction& t : + Slic3r::GUI::NativeCommands::speed_dial_actions(Slic3r::GUI::NativeCommands::instance())) { + const std::string key = t.action != nullptr ? t.action->at("key").get() : t.command->key; + const std::string input = t.action != nullptr ? t.action->value("input", std::string()) : t.command->input; INFO(key << " input=" << input); CHECK((input.empty() || input == "percent" || input == "tab")); } } -// The quick-launch cap must stay 10 to match the numbered Alt/Option+1..9,0 keys. The web palette -// mirrors it as K_FAV_LIMIT (asserted in speeddial.test.js); the C++ side pins it here. +// The quick-launch cap must stay 10 to match the numbered Alt/Option+1..9,0 keys. The Speed Dial's +// page mirrors it as K_FAV_LIMIT (asserted in speeddial.test.js); the C++ side pins it here. static_assert(Slic3r::GUI::ActionRegistry::kFavLimit == 10, "kFavLimit must stay 10"); TEST_CASE("Favourite lists are capped and deduped preserving order", "[ActionSource][SpeedDial]") @@ -195,21 +197,22 @@ TEST_CASE("A pin with no live action is dropped, the others keep their order", " CHECK(stored == std::vector{"b", "a"}); CHECK(shown == std::vector{"b", "a"}); #ifndef SLIC3R_CAD - // Without the Design table, a Design tile's pin cannot be told from a removed command's. - CHECK_FALSE(Slic3r::GUI::is_design_tile_id("orca_command:shell:orca")); + // Without the Design table, a Design tab action's pin cannot be told from a removed command's. + CHECK_FALSE(Slic3r::GUI::is_design_action_id("orca_command:shell:orca")); #endif } -TEST_CASE("A pin under a menu item's id is kept, as its tile's", "[ActionSource][SpeedDial]") +TEST_CASE("A pin under a menu item's id is kept, as its action's", "[ActionSource][SpeedDial]") { - // The ids the registry holds of the palette's tiles, which it makes as the Speed Dial starts. + // The ids the registry holds of the Speed Dial's actions, which it makes as the Speed Dial starts. std::set held; - for (const Slic3r::GUI::NativeCommands::PaletteTile& t : Slic3r::GUI::NativeCommands::palette_tiles(Slic3r::GUI::NativeCommands::instance())) - held.insert((t.tile != nullptr ? Slic3r::GUI::NativeCommands::make_action(*t.command, *t.tile) : - Slic3r::GUI::NativeCommands::make_action(*t.command)) + for (const Slic3r::GUI::NativeCommands::SpeedDialAction& t : + Slic3r::GUI::NativeCommands::speed_dial_actions(Slic3r::GUI::NativeCommands::instance())) + held.insert((t.action != nullptr ? Slic3r::GUI::NativeCommands::make_action(*t.command, *t.action) : + Slic3r::GUI::NativeCommands::make_action(*t.command)) ->id()); const auto live = [&held](const std::string& id) { return held.count(id) != 0; }; - // Delete Selected and New Project, whose menu items are tiles of object_delete and project_new. + // Delete Selected and New Project, whose menu items are actions of object_delete and project_new. const std::vector pinned{"orca_command:obj_delete:orca", "orca_command:new_project:orca"}; std::vector stored, shown; Slic3r::GUI::prune_favourites(pinned, live, stored, shown); @@ -294,7 +297,7 @@ TEST_CASE("Native command catalog has unique keys and present titles", "[ActionS CHECK_FALSE(c.title.empty()); // A command's group is what tool_search filters by: its place's heading, or Design. CHECK_FALSE(c.group.empty()); - // A duplicated key would silently shadow the earlier command in the palette. + // A duplicated key would silently shadow the earlier command in the Speed Dial. CHECK(seen.insert(c.key).second); } } @@ -302,7 +305,7 @@ TEST_CASE("Native command catalog has unique keys and present titles", "[ActionS // Every command's tile pictogram is a theme-neutral SVG (the matching GUI control's icon, or the // equivalent settings-group icon); an absent icon gets the page's generic placeholder. Guard // representative names and that every non-empty value resolves to a shipped file, so a rename/typo -// cannot leave broken images in the palette. +// cannot leave broken images in the Speed Dial. TEST_CASE("Native command icons resolve to shipped SVGs", "[ActionSource][SpeedDial]") { struct Expected @@ -327,16 +330,17 @@ TEST_CASE("Native command icons resolve to shipped SVGs", "[ActionSource][SpeedD Expected{"help_about", "OrcaSlicer_gradient_circle"}, Expected{"go_to_tab", ""}}) { INFO(e.key); - const std::unique_ptr action = tile_action(e.key); + const std::unique_ptr action = speed_dial_action(e.key); REQUIRE(action != nullptr); CHECK(action->icon == e.icon); } - // Every tile's icon, a command's own or an item's. + // Every action's icon, a command's own or an item's. const boost::filesystem::path images = boost::filesystem::path(PROFILES_DIR).parent_path() / "images"; - for (const Slic3r::GUI::NativeCommands::PaletteTile& t : Slic3r::GUI::NativeCommands::palette_tiles(Slic3r::GUI::NativeCommands::instance())) { - const std::string key = t.tile != nullptr ? t.tile->at("key").get() : t.command->key; - const std::string icon = t.tile != nullptr ? t.tile->at("icon").get() : t.command->icon; + for (const Slic3r::GUI::NativeCommands::SpeedDialAction& t : + Slic3r::GUI::NativeCommands::speed_dial_actions(Slic3r::GUI::NativeCommands::instance())) { + const std::string key = t.action != nullptr ? t.action->at("key").get() : t.command->key; + const std::string icon = t.action != nullptr ? t.action->at("icon").get() : t.command->icon; if (icon.empty()) continue; INFO(key << " -> " << icon); @@ -344,66 +348,66 @@ TEST_CASE("Native command icons resolve to shipped SVGs", "[ActionSource][SpeedD } } -// The Design tab's tiles are the registry's to show while the tab is shown (materialize_design_actions()), -// so the palette's own tiles, which it holds whatever tab is shown, leave the Design group out. A command of any other -// group, listed as one that runs from its arguments, has its tiles there. -TEST_CASE("the palette's own tiles leave the Design group out", "[ActionSource][SpeedDial]") +// The Design tab's actions are the registry's to show while the tab is shown (materialize_design_actions()), +// so the Speed Dial's own actions, which it holds whatever tab is shown, leave the Design group out. A command of any other +// group, listed as one that runs from its arguments, has its actions there. +TEST_CASE("the Speed Dial's own actions leave the Design group out", "[ActionSource][SpeedDial]") { Slic3r::GUI::CommandCatalog catalog; for (const char* group : {"Design", "Objects"}) { Slic3r::GUI::NativeCommand c; - c.key = std::string(group) + "_tile"; - c.title = group; - c.group = group; - c.listed = c.group != Slic3r::GUI::kDesignGroup; - c.in_palette = true; - c.tiles = nlohmann::json::array({nlohmann::json{{"key", std::string(group) + "_item"}, {"title", group}, {"icon", ""}, - {"description", ""}, {"args", {{"item", true}}}}}); + c.key = std::string(group) + "_action"; + c.title = group; + c.group = group; + c.listed = c.group != Slic3r::GUI::kDesignGroup; + c.has_own_action = true; + c.actions = nlohmann::json::array({nlohmann::json{{"key", std::string(group) + "_item"}, {"title", group}, {"icon", ""}, + {"description", ""}, {"args", {{"item", true}}}}}); catalog.add(std::move(c)); } catalog.seal(); - const std::vector palette = Slic3r::GUI::NativeCommands::palette_tiles(catalog); - REQUIRE(palette.size() == 2); - CHECK(palette[0].command->key == "Objects_tile"); - CHECK(palette[0].tile == nullptr); - REQUIRE(palette[1].tile != nullptr); - CHECK(palette[1].tile->at("key") == "Objects_item"); + const std::vector speed_dial = Slic3r::GUI::NativeCommands::speed_dial_actions(catalog); + REQUIRE(speed_dial.size() == 2); + CHECK(speed_dial[0].command->key == "Objects_action"); + CHECK(speed_dial[0].action == nullptr); + REQUIRE(speed_dial[1].action != nullptr); + CHECK(speed_dial[1].action->at("key") == "Objects_item"); } -// The Help-menu tiles, wiki/YouTube links and the developer-mode toggle are part of the palette. +// The Help-menu actions, wiki/YouTube links and the developer-mode toggle are part of the Speed Dial. // Guard their presence and that they stay grouped with their peers, so a catalog edit cannot drop // or scatter them. Groups are compared to the peer's own group to stay independent of translation. TEST_CASE("Native command catalog includes the Help and developer-mode commands", "[ActionSource][SpeedDial]") { - const std::unique_ptr first = tile_action("help_keyboard_shortcuts"); + const std::unique_ptr first = speed_dial_action("help_keyboard_shortcuts"); REQUIRE(first != nullptr); for (const char* key : {"help_setup_wizard", "help_open_config_folder", "help_migrate_filament_presets", "help_troubleshoot", "help_network_test", "help_benchmark_3d_scene", "help_tip_of_the_day", "help_check_updates", "help_about", "open_wiki", "open_youtube"}) { INFO(key); - const std::unique_ptr action = tile_action(key); + const std::unique_ptr action = speed_dial_action(key); REQUIRE(action != nullptr); CHECK(action->group_en == first->group_en); } - const std::unique_ptr mode_simple = tile_action("mode_simple"); - const std::unique_ptr dev_mode = tile_action("toggle_developer_mode"); + const std::unique_ptr mode_simple = speed_dial_action("mode_simple"); + const std::unique_ptr dev_mode = speed_dial_action("toggle_developer_mode"); REQUIRE(mode_simple != nullptr); REQUIRE(dev_mode != nullptr); CHECK(dev_mode->group_en == mode_simple->group_en); } -// A person takes screenshots and records from the palette, beside Run Script, with no agent involved. Start and -// Stop Recording are tiles of the typed tools, whose arguments skip what the tile does; Take Screenshot's command has +// A person takes screenshots and records from the Speed Dial, beside Run Script, with no agent involved. Start and +// Stop Recording are actions of the typed tools, whose arguments skip what the action does; Take Screenshot's command has // no argument form. TEST_CASE("Native command catalog has the screenshot and recording commands", "[ActionSource][SpeedDial]") { - const std::unique_ptr runner = tile_action("open_action_replay"); + const std::unique_ptr runner = speed_dial_action("open_action_replay"); REQUIRE(runner != nullptr); for (const auto& [key, name] : {std::make_pair("take_screenshot", "window_save_screenshot"), std::make_pair("start_recording", "recording_start"), std::make_pair("stop_recording", "recording_stop")}) { INFO(key); - const std::unique_ptr action = tile_action(key); + const std::unique_ptr action = speed_dial_action(key); REQUIRE(action != nullptr); CHECK(action->group_en == runner->group_en); CHECK(action->input.empty()); @@ -415,14 +419,14 @@ TEST_CASE("Native command catalog has the screenshot and recording commands", "[ } } -// The Run Script panel's tile sits beside Action Replay's, which keeps its id so existing replays and agent sessions +// The Run Script panel's action sits beside Action Replay's, which keeps its id so existing replays and agent sessions // that open it still do. TEST_CASE("Native command catalog has the Run Script panel and Action Replay commands", "[ActionSource][SpeedDial]") { - const std::unique_ptr replay = tile_action("open_action_replay"); + const std::unique_ptr replay = speed_dial_action("open_action_replay"); REQUIRE(replay != nullptr); CHECK(replay->title_en == "Action Replay"); - const std::unique_ptr panel = tile_action("toggle_run_script_panel"); + const std::unique_ptr panel = speed_dial_action("toggle_run_script_panel"); REQUIRE(panel != nullptr); CHECK(panel->group_en == replay->group_en); CHECK(panel->input.empty()); @@ -433,37 +437,37 @@ TEST_CASE("Native command catalog has the Run Script panel and Action Replay com CHECK_FALSE(command->description.empty()); } -// Every "Add Primitive" item and shipped handy model has a palette tile, grouped as in the Add -// menu. Groups are compared to a peer's own group to stay independent of translation. +// Every "Add Primitive" item and shipped handy model has an action in the Speed Dial, grouped as in the +// Add menu. Groups are compared to a peer's own group to stay independent of translation. TEST_CASE("Native command catalog covers the Add menus", "[ActionSource][SpeedDial]") { - const std::unique_ptr primitive = tile_action("add_primitive_cube"); + const std::unique_ptr primitive = speed_dial_action("add_primitive_cube"); REQUIRE(primitive != nullptr); for (const char* key : {"add_primitive_cylinder", "add_primitive_sphere", "add_primitive_cone", "add_primitive_disc", "add_primitive_torus", "add_primitive_text", "add_primitive_svg"}) { INFO(key); - const std::unique_ptr action = tile_action(key); + const std::unique_ptr action = speed_dial_action(key); REQUIRE(action != nullptr); CHECK(action->group_en == primitive->group_en); } - const std::unique_ptr handy = tile_action("add_handy_orca_cube"); + const std::unique_ptr handy = speed_dial_action("add_handy_orca_cube"); REQUIRE(handy != nullptr); for (const char* key : {"add_handy_orcasliced_combo", "add_handy_orca_badge", "add_handy_orca_tolerance_test", "add_handy_3dbenchy", "add_handy_cali_cat", "add_handy_autodesk_fdm_test", "add_handy_voron_cube", "add_handy_stanford_bunny", "add_handy_orca_string_hell"}) { INFO(key); - const std::unique_ptr action = tile_action(key); + const std::unique_ptr action = speed_dial_action(key); REQUIRE(action != nullptr); CHECK(action->group_en == handy->group_en); } - // A handy model's tile is titled by the English label its Add-menu entry is built from, so it is + // A handy model's action is titled by the English label its Add-menu entry is built from, so it is // searchable in English in any UI language. for (const auto& model : Slic3r::GUI::MenuFactory::handy_models()) { const std::string key = "add_handy_" + std::string(model.key); INFO(key); - const std::unique_ptr action = tile_action(key); + const std::unique_ptr action = speed_dial_action(key); REQUIRE(action != nullptr); CHECK(action->title_en == model.label); } diff --git a/tests/slic3rutils/test_command_catalog.cpp b/tests/slic3rutils/test_command_catalog.cpp index 8f9160ac14..7ed0abb9fd 100644 --- a/tests/slic3rutils/test_command_catalog.cpp +++ b/tests/slic3rutils/test_command_catalog.cpp @@ -194,30 +194,30 @@ std::vector group_runs(const CommandCatalog& catalog, const std::ve } // namespace -TEST_CASE("the process catalog's palette is the Speed Dial's tiles", "[CommandCatalog]") +TEST_CASE("the process catalog gives the Speed Dial its 129 command actions", "[CommandCatalog]") { const CommandCatalog& catalog = NativeCommands::instance(); CHECK(catalog.sealed()); - const std::vector palette = NativeCommands::palette_tiles(catalog); - CHECK(palette.size() == 129); - for (const NativeCommands::PaletteTile& t : palette) { + const std::vector speed_dial = NativeCommands::speed_dial_actions(catalog); + CHECK(speed_dial.size() == 129); + for (const NativeCommands::SpeedDialAction& t : speed_dial) { REQUIRE(t.command != nullptr); INFO(t.command->key); - // A command's own tile, or an item of its tiles. - if (t.tile == nullptr) - CHECK(t.command->in_palette); + // A command's own action, or an item of its actions. + if (t.action == nullptr) + CHECK(t.command->has_own_action); else - CHECK(t.command->tiles.is_array()); + CHECK(t.command->actions.is_array()); } // The Speed Dial's own lookup reads the same catalog. CHECK(NativeCommands::find("plate_slice") == catalog.find("plate_slice")); } -TEST_CASE("every Speed Dial tile of today is still a tile", "[CommandCatalog][SpeedDial]") +TEST_CASE("every Speed Dial action of today is still a command's action", "[CommandCatalog][SpeedDial]") { - // The 129 tiles of the Speed Dial, each with its id, title, section, icon and input: each is a tile of - // the palette with that presentation, and the palette has no other. - std::ifstream in(std::string(TEST_DATA_DIR) + "/speed_dial_tiles.json", std::ios::binary); + // The Speed Dial's 129 actions of commands, each with its id, title, section, icon and input: each is an action of + // the Speed Dial with that presentation, and the Speed Dial has no other. + std::ifstream in(std::string(TEST_DATA_DIR) + "/speed_dial_actions.json", std::ios::binary); REQUIRE(in.is_open()); const json fixture = json::parse(in); REQUIRE(fixture.size() == 129); @@ -228,10 +228,11 @@ TEST_CASE("every Speed Dial tile of today is still a tile", "[CommandCatalog][Sp const std::string key = item.at("key"); INFO(key); expected.push_back(key); - const auto [command, tile] = Slic3r::GUI::find_tile(catalog, key); + const auto [command, command_action] = Slic3r::GUI::find_command_action(catalog, key); REQUIRE(command != nullptr); - const std::unique_ptr action = tile != nullptr ? NativeCommands::make_action(*command, *tile) : - NativeCommands::make_action(*command); + const std::unique_ptr action = command_action != nullptr ? + NativeCommands::make_action(*command, *command_action) : + NativeCommands::make_action(*command); REQUIRE(action != nullptr); CHECK(action->id() == "orca_command:" + key + ":orca"); CHECK(action->title_en == item.at("title").get()); @@ -240,31 +241,31 @@ TEST_CASE("every Speed Dial tile of today is still a tile", "[CommandCatalog][Sp CHECK(action->input == item.at("input").get()); } - std::vector tiles; - for (const NativeCommands::PaletteTile& t : NativeCommands::palette_tiles(catalog)) - tiles.push_back(t.tile != nullptr ? t.tile->at("key").get() : t.command->key); + std::vector actions; + for (const NativeCommands::SpeedDialAction& t : NativeCommands::speed_dial_actions(catalog)) + actions.push_back(t.action != nullptr ? t.action->at("key").get() : t.command->key); std::sort(expected.begin(), expected.end()); - std::sort(tiles.begin(), tiles.end()); - CHECK(tiles == expected); + std::sort(actions.begin(), actions.end()); + CHECK(actions == expected); } -TEST_CASE("a menu item's id is a tile's key, not a command", "[CommandCatalog][SpeedDial]") +TEST_CASE("a menu item's id is an action's key, not a command", "[CommandCatalog][SpeedDial]") { const CommandCatalog& catalog = NativeCommands::instance(); REQUIRE(kRetiredMenuItems.size() == 121); for (const std::string& item : kRetiredMenuItems) { INFO(item); CHECK(catalog.find(item) == nullptr); - const auto [command, tile] = Slic3r::GUI::find_tile(catalog, item); + const auto [command, action] = Slic3r::GUI::find_command_action(catalog, item); CHECK(command != nullptr); - CHECK(tile != nullptr); + CHECK(action != nullptr); } } -TEST_CASE("every tile is its command's, with the design's arguments, and they fit its schema", "[CommandCatalog][SpeedDial]") +TEST_CASE("every action is its command's, with the design's arguments, and they fit its schema", "[CommandCatalog][SpeedDial]") { - // Each of the 129 tiles with the command the design folds its menu item into and the arguments it runs it with. - std::ifstream in(std::string(TEST_DATA_DIR) + "/speed_dial_tile_calls.json", std::ios::binary); + // Each of the 129 actions with the command the design folds its menu item into and the arguments it runs it with. + std::ifstream in(std::string(TEST_DATA_DIR) + "/speed_dial_action_calls.json", std::ios::binary); REQUIRE(in.is_open()); const json fixture = json::parse(in); REQUIRE(fixture.size() == 129); @@ -275,39 +276,39 @@ TEST_CASE("every tile is its command's, with the design's arguments, and they fi const std::string key = item.at("key"); const std::string name = item.at("command"); INFO(key << " -> " << name); - const auto [command, tile] = Slic3r::GUI::find_tile(catalog, key); + const auto [command, action] = Slic3r::GUI::find_command_action(catalog, key); REQUIRE(command != nullptr); REQUIRE(command->key == name); ++folded; if (key == name) { - // The command's own tile, a person's form of it. - CHECK(command->in_palette); - CHECK(tile == nullptr); + // The command's own action, a person's form of it. + CHECK(command->has_own_action); + CHECK(action == nullptr); CHECK(item.at("args") == json::object()); CHECK(Mcp::person_form(*command, json::object())); - json none = Slic3r::GUI::tile_call_args(nullptr, json::object()); + json none = Slic3r::GUI::action_call_args(nullptr, json::object()); CHECK(Mcp::argument_error(*command, none).empty()); continue; } - REQUIRE(tile != nullptr); - CHECK(tile->at("args") == item.at("args")); + REQUIRE(action != nullptr); + CHECK(action->at("args") == item.at("args")); const std::string input = item.value("input", std::string()); - CHECK(tile->value("input", std::string()) == input); - CHECK(tile->value("input_arg", std::string()) == item.value("input_arg", std::string())); - // A tile that collects nothing is a person's form of its command; one that collects a value is not, as its + CHECK(action->value("input", std::string()) == input); + CHECK(action->value("input_arg", std::string()) == item.value("input_arg", std::string())); + // An action that collects nothing is a person's form of its command; one that collects a value is not, as its // value comes from the Speed Dial's second phase. - CHECK(Mcp::person_form(*command, tile->at("args")) == input.empty()); - // What a pick runs the command with: the tile's arguments, and the value its second phase collects. + CHECK(Mcp::person_form(*command, action->at("args")) == input.empty()); + // What a pick runs the command with: the action's arguments, and the value its second phase collects. json value = json::object(); if (!input.empty()) value[input] = input == "percent" ? json(50) : json("preview"); - json call = Slic3r::GUI::tile_call_args(tile, value); + json call = Slic3r::GUI::action_call_args(action, value); CHECK(Mcp::argument_error(*command, call).empty()); } - // Every tile of today, under the command the design folds its menu item into. + // Every action of today, under the command the design folds its menu item into. CHECK(folded == 129); - // The tiles that ask need none of what the silent form requires; one more argument is the silent form. + // The actions that ask need none of what the silent form requires; one more argument is the silent form. const NativeCommand* save = catalog.find("project_save"); const NativeCommand* export_ = catalog.find("project_export"); const NativeCommand* import_ = catalog.find("project_import"); @@ -326,13 +327,13 @@ TEST_CASE("every tile is its command's, with the design's arguments, and they fi CHECK_THAT(Mcp::argument_error(*export_, gcode_overwrite), ContainsSubstring("path")); } -TEST_CASE("a menu item's tile runs its command with the item's arguments", "[SpeedDial]") +TEST_CASE("a menu item's action runs its command with the item's arguments", "[SpeedDial]") { - // One tile of each command that has tiles, and each of view_set's kinds of tile: a tile's key, its command, the - // arguments it runs it with, and the Speed Dial's token for the value it collects with the argument that takes it. + // One action of each command that has actions, and each of view_set's kinds of action: an action's key, its command, + // the arguments it runs it with, and the Speed Dial's token for the value it collects with the argument that takes it. struct Pair { - const char* tile; + const char* key; const char* command; json args; const char* input = ""; @@ -403,27 +404,28 @@ TEST_CASE("a menu item's tile runs its command with the item's arguments", "[Spe REQUIRE(pairs.size() == 60); const CommandCatalog& catalog = NativeCommands::instance(); for (const Pair& p : pairs) { - INFO(p.tile << " -> " << p.command << " " << p.args.dump()); - const auto [command, tile] = Slic3r::GUI::find_tile(catalog, p.tile); + INFO(p.key << " -> " << p.command << " " << p.args.dump()); + const auto [command, command_action] = Slic3r::GUI::find_command_action(catalog, p.key); REQUIRE(command != nullptr); CHECK(command->key == p.command); - // The tile's action runs its command, with what tile_call_args() makes of a pick that collects nothing. - const std::unique_ptr action = tile != nullptr ? NativeCommands::make_action(*command, *tile) : - NativeCommands::make_action(*command); + // Its AppAction runs its command, with what action_call_args() makes of a pick that collects nothing. + const std::unique_ptr action = command_action != nullptr ? + NativeCommands::make_action(*command, *command_action) : + NativeCommands::make_action(*command); CHECK(action->command == p.command); - CHECK(Slic3r::GUI::tile_call_args(tile, json::object()) == p.args); + CHECK(Slic3r::GUI::action_call_args(command_action, json::object()) == p.args); CHECK(action->input == p.input); - if (tile != nullptr) - CHECK(tile->value("input_arg", std::string()) == p.input_arg); - // The command's own tile is the one whose key is the command's name. - CHECK((tile == nullptr) == (std::string(p.tile) == p.command)); + if (command_action != nullptr) + CHECK(command_action->value("input_arg", std::string()) == p.input_arg); + // The command's own action is the one whose key is the command's name. + CHECK((command_action == nullptr) == (std::string(p.key) == p.command)); } } -TEST_CASE("outside the Design tab the catalog has its commands and 129 tiles", "[CommandCatalog]") +TEST_CASE("outside the Design tab the catalog has its commands and 129 actions", "[CommandCatalog]") { - // The section the Speed Dial shows each tile in, by its key. - std::ifstream in(std::string(TEST_DATA_DIR) + "/speed_dial_tiles.json", std::ios::binary); + // The section the Speed Dial shows each action in, by its key. + std::ifstream in(std::string(TEST_DATA_DIR) + "/speed_dial_actions.json", std::ios::binary); REQUIRE(in.is_open()); std::map section; for (const json& item : json::parse(in)) @@ -435,19 +437,19 @@ TEST_CASE("outside the Design tab the catalog has its commands and 129 tiles", " if (c.group == Slic3r::GUI::kDesignGroup) continue; ++commands; - if (c.tiles.is_array()) - items += c.tiles.size(); - if (!c.in_palette) + if (c.actions.is_array()) + items += c.actions.size(); + if (!c.has_own_action) continue; INFO(c.key); own.insert(c.key); - // An own tile is in the section the Speed Dial shows its key in. - CHECK(c.tile_group == section.at(c.key)); + // An own action is in the section the Speed Dial shows its key in. + CHECK(c.action_group == section.at(c.key)); } // The commands outside the Design tab: the typed tools, the commands made from menu items, the seven Parts 4a to 4c // add, Part 5a's three, Part 5b's two, Part 5c's one and Part 5d's four. CHECK(commands == 118); - // The eight commands named as their menu items keep a tile of their own; the other 121 tiles are items. + // The eight commands named as their menu items keep an action of their own; the other 121 actions are items. CHECK(own == std::set{"plate_add", "plate_delete", "plate_duplicate", "plate_rename", "filament_add", "filament_delete", "undo", "redo"}); CHECK(items == 121); @@ -602,15 +604,15 @@ TEST_CASE("the plugin commands name the plugin they act on, and an install repla CHECK(install->input_schema.at("properties").at("overwrite").at("type") == "boolean"); } -TEST_CASE("a call with no arguments is not titled as a tile that collects a value", "[CommandCatalog]") +TEST_CASE("a call with no arguments is not titled as an action that collects a value", "[CommandCatalog]") { // view_set's Go to tab and Go to layer have no arguments of their own: their call takes its value from the Speed - // Dial's second phase, so a call with none is view_set's, and a call with the value is the tile's command with it. + // Dial's second phase, so a call with none is view_set's, and a call with the value is the action's command with it. const NativeCommand* view = NativeCommands::find("view_set"); REQUIRE(view != nullptr); - CHECK(Slic3r::GUI::tile_with_args(*view, json::object()) == nullptr); + CHECK(Slic3r::GUI::action_with_args(*view, json::object()) == nullptr); CHECK(Slic3r::GUI::call_title(*view, json::object()) == view->title); - // A tile that collects nothing titles its call. + // An action that collects nothing titles its call. CHECK(Slic3r::GUI::call_title(*view, {{"camera", "top"}}) == "View: Top"); } @@ -653,41 +655,41 @@ TEST_CASE("every key of the process catalog is unique, tools and commands togeth TEST_CASE("the typed tools are listed and the merged commands are both", "[CommandCatalog]") { - // A tool whose menu item is one of its tiles, with the item's title, section and icon. - for (const auto& [key, tile_key, title] : {std::make_tuple("project_new", "new_project", "New Project"), - std::make_tuple("project_save", "save_project", "Save Project"), - std::make_tuple("recording_start", "start_recording", "Start Recording"), - std::make_tuple("recording_stop", "stop_recording", "Stop Recording")}) { + // A tool whose menu item is one of its actions, with the item's title, section and icon. + for (const auto& [key, action_key, title] : {std::make_tuple("project_new", "new_project", "New Project"), + std::make_tuple("project_save", "save_project", "Save Project"), + std::make_tuple("recording_start", "start_recording", "Start Recording"), + std::make_tuple("recording_stop", "stop_recording", "Stop Recording")}) { INFO(key); const NativeCommand* merged = NativeCommands::find(key); REQUIRE(merged != nullptr); CHECK(merged->listed); - CHECK_FALSE(merged->in_palette); - const auto [command, tile] = Slic3r::GUI::find_tile(NativeCommands::instance(), tile_key); + CHECK_FALSE(merged->has_own_action); + const auto [command, action] = Slic3r::GUI::find_command_action(NativeCommands::instance(), action_key); CHECK(command == merged); - REQUIRE(tile != nullptr); - CHECK(tile->at("title") == title); - CHECK(tile->at("group") == "Commands"); - CHECK_FALSE(tile->at("icon").get().empty()); + REQUIRE(action != nullptr); + CHECK(action->at("title") == title); + CHECK(action->at("group") == "Commands"); + CHECK_FALSE(action->at("icon").get().empty()); } const NativeCommand* tool = NativeCommands::find("app_state"); REQUIRE(tool != nullptr); CHECK(tool->listed); - CHECK_FALSE(tool->in_palette); + CHECK_FALSE(tool->has_own_action); - // A command made from menu items is listed too, as it runs from its arguments: its menu items are its tiles. + // A command made from menu items is listed too, as it runs from its arguments: its menu items are its actions. const NativeCommand* menu_items = NativeCommands::find("object_mirror"); REQUIRE(menu_items != nullptr); CHECK(menu_items->listed); - CHECK_FALSE(menu_items->in_palette); - CHECK(menu_items->tiles.size() == 3); + CHECK_FALSE(menu_items->has_own_action); + CHECK(menu_items->actions.size() == 3); } -TEST_CASE("the palette's tiles are under the menu items' keys, not the tools' names", "[CommandCatalog]") +TEST_CASE("the Speed Dial's actions are under the menu items' keys, not the tools' names", "[CommandCatalog]") { - // Every tile of the Speed Dial by its key: a typed tool is there only through its menu items' tiles. - const std::set tiles{ + // Every command's action in the Speed Dial, by its key: a typed tool is there only through its menu items' actions. + const std::set actions{ "add_handy_3dbenchy", "add_handy_autodesk_fdm_test", "add_handy_cali_cat", "add_handy_orca_badge", "add_handy_orca_cube", "add_handy_orca_string_hell", "add_handy_orca_tolerance_test", "add_handy_orcasliced_combo", "add_handy_stanford_bunny", "add_handy_voron_cube", "add_primitive_cone", "add_primitive_cube", @@ -711,17 +713,17 @@ TEST_CASE("the palette's tiles are under the menu items' keys, not the tools' na "sync_ams", "sync_presets", "take_screenshot", "toggle_developer_mode", "toggle_run_script_panel", "undo", "view_bottom", "view_default", "view_fit_bed", "view_front", "view_iso", "view_left", "view_rear", "view_right", "view_toggle_perspective", "view_top"}; - REQUIRE(tiles.size() == 129); + REQUIRE(actions.size() == 129); - std::set palette; - for (const NativeCommands::PaletteTile& t : NativeCommands::palette_tiles(NativeCommands::instance())) - palette.insert(t.tile != nullptr ? t.tile->at("key").get() : t.command->key); - CHECK(palette == tiles); - CHECK(palette.count("new_project") == 1); - CHECK(palette.count("project_new") == 0); - CHECK(palette.count("app_state") == 0); - // plate_slice's tiles are slice_and_preview and slice_all. - CHECK(palette.count("plate_slice") == 0); + std::set speed_dial; + for (const NativeCommands::SpeedDialAction& t : NativeCommands::speed_dial_actions(NativeCommands::instance())) + speed_dial.insert(t.action != nullptr ? t.action->at("key").get() : t.command->key); + CHECK(speed_dial == actions); + CHECK(speed_dial.count("new_project") == 1); + CHECK(speed_dial.count("project_new") == 0); + CHECK(speed_dial.count("app_state") == 0); + // plate_slice's actions are slice_and_preview and slice_all. + CHECK(speed_dial.count("plate_slice") == 0); } TEST_CASE("a merged command accepts silent and publishes its form", "[CommandCatalog]") @@ -746,7 +748,7 @@ TEST_CASE("a merged command accepts silent and publishes its form", "[CommandCat } } -TEST_CASE("a merged command's call with a tile's arguments is the person's form", "[CommandCatalog]") +TEST_CASE("a merged command's call with an action's arguments is the person's form", "[CommandCatalog]") { int tool_calls = 0; json person_args; // what each run of the person's form was given @@ -757,10 +759,10 @@ TEST_CASE("a merged command's call with a tile's arguments is the person's form" ++tool_calls; return ToolResult::ok({{"tool", true}}); }); - tool.in_palette = true; - tool.tiles = json::array({NativeCommands::tile("k_as", "K as", "Commands", "", {{"save_as", true}}, "Saves as.")}); - const NativeCommand merged = NativeCommands::with_person_form(tool, [&person_args](const json& tile_args) { - person_args.push_back(tile_args); + tool.has_own_action = true; + tool.actions = json::array({NativeCommands::action("k_as", "K as", "Commands", "", {{"save_as", true}}, "Saves as.")}); + const NativeCommand merged = NativeCommands::with_person_form(tool, [&person_args](const json& action_args) { + person_args.push_back(action_args); return AppActionRunResult{AppActionRunResult::Level::Succeeded, "Asked"}; }); CHECK(merged.input_schema["properties"].contains("silent")); @@ -779,7 +781,7 @@ TEST_CASE("a merged command's call with a tile's arguments is the person's form" CHECK(given.data["tool"] == true); } -TEST_CASE("a pick of a tile whose menu item and tool are one function runs it in place, and a call runs the tool", "[CommandCatalog]") +TEST_CASE("a pick of an action whose menu item and tool are one function runs it in place, and a call runs the tool", "[CommandCatalog]") { int tool_calls = 0; json person_args = json::array(); // what each run of the shared function for a pick was given @@ -787,23 +789,23 @@ TEST_CASE("a pick of a tile whose menu item and tool are one function runs it in ++tool_calls; return ToolResult::ok({{"tool", true}}); }); - tool.tiles = json::array({NativeCommands::tile("k_item", "Item", "View", "", {{"item", true}}, "The menu item's function."), - NativeCommands::tile("k_tool", "Tool", "View", "", {{"camera", "top"}}, "The tool's function."), - NativeCommands::tile("k_input", "Input", "View", "", json::object(), "A value it collects.", "percent", - "level")}); + tool.actions = json::array({NativeCommands::action("k_item", "Item", "View", "", {{"item", true}}, "The menu item's function."), + NativeCommands::action("k_tool", "Tool", "View", "", {{"camera", "top"}}, "The tool's function."), + NativeCommands::action("k_input", "Input", "View", "", json::object(), "A value it collects.", "percent", + "level")}); const NativeCommand merged = NativeCommands::with_menu_item_forms( tool, - [&person_args](const json& tile_args) { - person_args.push_back(tile_args); + [&person_args](const json& action_args) { + person_args.push_back(action_args); return AppActionRunResult{AppActionRunResult::Level::Succeeded}; }, /*person_form_behind_dialogs=*/false, std::vector{json{{"camera", "top"}}}); - // The menu item's tile and the tool's are person's forms of the command; the tile that collects a value is not. + // The menu item's action and the tool's are person's forms of the command; the action that collects a value is not. CHECK(Mcp::person_form(merged, {{"item", true}})); CHECK(Mcp::person_form(merged, {{"camera", "top"}})); CHECK_FALSE(Mcp::person_form(merged, {{"level", 50}})); - // An automated call: the menu item's tile runs the item, the tool's own form and the input tile's call run the tool. + // An automated call: the menu item's action runs the item, the tool's own form and the input action's call run the tool. TestContext agent; merged.run({{"item", true}}, agent); CHECK(person_args == json::array({{{"item", true}}})); @@ -812,7 +814,7 @@ TEST_CASE("a pick of a tile whose menu item and tool are one function runs it in CHECK(tool_calls == 2); CHECK(agent.submitted.empty()); - // A person's pick of the tool's own form, and of the input tile with its value, runs the shared function in place: + // A person's pick of the tool's own form, and of the input action with its value, runs the shared function in place: // nothing is submitted as a job, and the tool's function does not run. TestContext person(/*person=*/true); const ToolResult picked = merged.run({{"camera", "top"}}, person); @@ -834,9 +836,9 @@ TEST_CASE("an agent's call of a person's form is checked as a mutate call, a per auto tool = NativeCommands::long_command("k", "K", "", no_arguments(), [](const json&, ToolContext&) { return ToolResult::ok(); }); - tool.guard = GuardClass::Inspect; // as the recording tools run, behind dialogs - tool.in_palette = true; - const auto person = [&person_calls](const json&) { + tool.guard = GuardClass::Inspect; // as the recording tools run, behind dialogs + tool.has_own_action = true; + const auto person = [&person_calls](const json&) { ++person_calls; return AppActionRunResult{AppActionRunResult::Level::Succeeded, "Asked"}; }; @@ -865,7 +867,7 @@ TEST_CASE("a silent call is journaled silent", "[CommandCatalog]") ctx.set_journal_args(args); return ToolResult::ok(); }); - tool.in_palette = true; + tool.has_own_action = true; const NativeCommand merged = NativeCommands::with_person_form(tool, [](const json&) { return AppActionRunResult{}; }); TestContext agent; @@ -906,7 +908,7 @@ TEST_CASE("a command made from menu items is found by the one lookup", "[Command { const CommandCatalog& catalog = NativeCommands::instance(); CHECK(catalog.lookup("object_mirror") != nullptr); - // A misspelt key is answered with the closest command, which tool_call runs, not with a tile's action_run. + // A misspelt key is answered with the closest command, which tool_call runs, not with action_run of an action. const std::string unknown = catalog.unknown_command("object_miror", /*suggest=*/true); CHECK_THAT(unknown, ContainsSubstring("object_mirror")); CHECK_THAT(unknown, !ContainsSubstring("action_run")); @@ -971,33 +973,33 @@ TEST_CASE("the process catalog is built once", "[CommandCatalog]") CHECK(&NativeCommands::instance() == &catalog); } -TEST_CASE("the palette is the commands' own tiles and their items, in the catalog's order", "[CommandCatalog]") +TEST_CASE("the Speed Dial has the commands' own actions and their items, in the catalog's order", "[CommandCatalog]") { CommandCatalog catalog; catalog.add(command("first", true)); catalog.add(command("typed_tool", false)); NativeCommand folded = command("folded", true); - folded.tiles = json::array({NativeCommands::tile("folded_x", "X", "View", "", {{"axis", "x"}}, "Along X."), - NativeCommands::tile("folded_y", "Y", "View", "", {{"axis", "y"}}, "Along Y.")}); + folded.actions = json::array({NativeCommands::action("folded_x", "X", "View", "", {{"axis", "x"}}, "Along X."), + NativeCommands::action("folded_y", "Y", "View", "", {{"axis", "y"}}, "Along Y.")}); catalog.add(std::move(folded)); - // A listed command's tiles are the palette's as any other's. + // A listed command's actions are in the Speed Dial as any other's are. NativeCommand items_only = command("items_only", false); items_only.listed = true; - items_only.tiles = json::array({NativeCommands::tile("items_only_tab", "Tab", "Commands", "", json::object(), "A tab.", "tab")}); + items_only.actions = json::array({NativeCommands::action("items_only_tab", "Tab", "Commands", "", json::object(), "A tab.", "tab")}); catalog.add(std::move(items_only)); catalog.seal(); - const std::vector palette = NativeCommands::palette_tiles(catalog); - REQUIRE(palette.size() == 5); - CHECK(palette[0].command == catalog.find("first")); - CHECK(palette[0].tile == nullptr); - CHECK(palette[1].command == catalog.find("folded")); - CHECK(palette[1].tile == nullptr); - CHECK(palette[2].tile == &catalog.find("folded")->tiles[0]); - CHECK(palette[3].tile == &catalog.find("folded")->tiles[1]); - CHECK(palette[4].command == catalog.find("items_only")); - REQUIRE(palette[4].tile != nullptr); - CHECK(palette[4].tile->at("input") == "tab"); + const std::vector speed_dial = NativeCommands::speed_dial_actions(catalog); + REQUIRE(speed_dial.size() == 5); + CHECK(speed_dial[0].command == catalog.find("first")); + CHECK(speed_dial[0].action == nullptr); + CHECK(speed_dial[1].command == catalog.find("folded")); + CHECK(speed_dial[1].action == nullptr); + CHECK(speed_dial[2].action == &catalog.find("folded")->actions[0]); + CHECK(speed_dial[3].action == &catalog.find("folded")->actions[1]); + CHECK(speed_dial[4].command == catalog.find("items_only")); + REQUIRE(speed_dial[4].action != nullptr); + CHECK(speed_dial[4].action->at("input") == "tab"); } TEST_CASE("a sealed catalog is read from eight threads", "[CommandCatalog]") @@ -1136,19 +1138,19 @@ TEST_CASE("an Export command called with arguments takes the project, and with n CHECK(either.operations == 0); } -TEST_CASE("a tile with a second phase takes its value, typed as its command's argument", "[CommandCatalog]") +TEST_CASE("an action with a second phase takes its value, typed as its command's argument", "[CommandCatalog]") { const CommandCatalog& catalog = NativeCommands::instance(); for (const auto& [key, input, value] : {std::make_tuple("go_to_tab", "tab", json("preview")), std::make_tuple("go_to_layer", "percent", json(50))}) { INFO(key); - const auto [command, tile] = Slic3r::GUI::find_tile(catalog, key); + const auto [command, command_action] = Slic3r::GUI::find_command_action(catalog, key); REQUIRE(command != nullptr); - REQUIRE(tile != nullptr); - const std::unique_ptr action = NativeCommands::make_action(*command, *tile); + REQUIRE(command_action != nullptr); + const std::unique_ptr action = NativeCommands::make_action(*command, *command_action); CHECK(action->input == input); CHECK(action->input_schema["required"] == json::array({input})); // The pick's value reaches view_set under its argument, which checks it. - json call = Slic3r::GUI::tile_call_args(tile, {{input, value}}); + json call = Slic3r::GUI::action_call_args(command_action, {{input, value}}); CHECK(Mcp::argument_error(*command, call).empty()); } // The layer is a share of the layer range. @@ -1175,7 +1177,7 @@ TEST_CASE("undo takes a history", "[CommandCatalog]") INFO(key); const NativeCommand* command = NativeCommands::find(key); REQUIRE(command != nullptr); - CHECK(command->in_palette); + CHECK(command->has_own_action); CHECK(command->listed); json design{{"history", "design"}}; CHECK(Mcp::argument_error(*command, design).empty()); @@ -1218,7 +1220,7 @@ TEST_CASE("a command's result reads as action_run's did", "[CommandCatalog]") CHECK(done.data == json{{"ran", "k"}, {"level", "success"}, {"message", "Done"}}); CHECK(NativeCommands::from_run_result("k", {Level::Busy, "Wait"}).is_error); CHECK(NativeCommands::from_run_result("k", {Level::Error, "Failed"}).is_error); - // A command that did nothing fails, though the palette shows it as information. + // A command that did nothing fails, though the Speed Dial shows it as information. CHECK(NativeCommands::from_run_result("k", {Level::Info, "Select an object first.", false}).is_error); // What a command adds to its reply joins the reply's fields. @@ -1321,7 +1323,7 @@ TEST_CASE("the reference shows both forms of a two-form command", "[CommandCatal CommandCatalog catalog = catalog_with_design(); catalog.seal(); const json reference = Slic3r::GUI::catalog_reference(catalog); - // Each with what its person's forms are: {} alone, or the arguments of each of its tiles. + // Each with what its person's forms are: {} alone, or the arguments of each of its actions. std::vector> two_forms{ {"project_save", {{"not", {{"enum", json::array({json::object(), {{"save_as", true}}})}}}}}}; #ifdef SLIC3R_CAD diff --git a/tests/slic3rutils/test_mcp_cad.cpp b/tests/slic3rutils/test_mcp_cad.cpp index 0900d0e78a..0a92a65050 100644 --- a/tests/slic3rutils/test_mcp_cad.cpp +++ b/tests/slic3rutils/test_mcp_cad.cpp @@ -328,7 +328,7 @@ TEST_CASE("the CAD commands are the Design table's entries but its greyed and fo CHECK(keys.insert(c.key).second); CHECK(c.group == "Design"); CHECK_FALSE(c.listed); - // Its title is the item's name, the one the right-click menu and its tile show. + // Its title is the item's name, the one the right-click menu and its Speed Dial action show. CHECK(c.title == design_row(c.key).name); } CHECK(keys.size() == 88); @@ -373,7 +373,7 @@ TEST_CASE("a menu item and the command that runs its job are one command", "[Mcp "sketch_constrain", "feature_edit"}) { INFO(key); const GUI::NativeCommand& command = command_of(catalog, key); - CHECK(command.in_palette); + CHECK(command.has_own_action); CHECK(two_forms(command)); const GUI::DesignTool* entry = GUI::Mcp::find_design_tool(key); REQUIRE(entry != nullptr); @@ -503,18 +503,18 @@ TEST_CASE("a command has silent when a call with no arguments opens a tool", "[M const GUI::DesignTool& entry = design_row(c.key); if (entry.doc != nullptr) CHECK(two_forms(c) == (GUI::Mcp::opened_item(entry, json::object()) != nullptr)); - // A command that has a tile is the one whose entry has an action, and it carries the item's icon. - CHECK(c.in_palette == (entry.action != nullptr)); + // A command that has an action of its own is the one whose entry has a handler, and it carries the item's icon. + CHECK(c.has_own_action == (entry.action != nullptr)); CHECK(c.icon == (entry.icon != nullptr ? entry.icon : "")); - // A tile with no icon would be a blank square in the Speed Dial. - if (c.in_palette) + // An action with no icon would be a blank square in the Speed Dial. + if (c.has_own_action) CHECK_FALSE(c.icon.empty()); } - // Their items are folded into them, and their tiles are the items'. + // Their items are folded into them, and their actions are the items'. for (const char* key : {"body_set", "sketch_set_value"}) { INFO(key); CHECK(two_forms(command_of(catalog, key))); - CHECK_FALSE(command_of(catalog, key).in_palette); + CHECK_FALSE(command_of(catalog, key).has_own_action); } CHECK(two_forms(command_of(catalog, "shell"))); CHECK_FALSE(two_forms(command_of(catalog, "describe_design"))); @@ -571,7 +571,7 @@ TEST_CASE("a call opens a tool only with the arguments that choose it", "[Mcp][C INFO(runs.dump()); CHECK(GUI::Mcp::opened_item(body_set, runs) == nullptr); } - // sketch_set_value's three value items are one action. + // sketch_set_value's three value items share one handler. const GUI::DesignTool* value = GUI::Mcp::opened_item(design_row("sketch_set_value"), json::object()); REQUIRE(value != nullptr); REQUIRE(value->action != nullptr); @@ -626,7 +626,7 @@ TEST_CASE("a folded item opens only in its own mode", "[Mcp][CAD]") REQUIRE(in_sketch.has_value()); CHECK(std::string(in_sketch->what()) == "This tool works on the model: finish or cancel the sketch first"); CHECK_FALSE(GUI::Mcp::open_refusal(colour, false, int(GUI::OfferSel::BodySolid)).has_value()); - // Its action is a btn: one, which the menu greys for a selection it does not take. + // Its handler is a btn: one, which the menu greys for a selection it does not take. const std::optional nothing = GUI::Mcp::open_refusal(colour, false, int(GUI::OfferSel::None)); REQUIRE(nothing.has_value()); CHECK(std::string(nothing->what()) == "This tool does not apply to what is selected"); @@ -705,44 +705,44 @@ TEST_CASE("a Design command carries its menu item's icon", "[Mcp][CAD]") const GUI::CommandCatalog catalog = cad_catalog(); CHECK(command_of(catalog, "sketch_create").icon == "design_sketch"); CHECK(command_of(catalog, "body_transform").icon == "design_move"); - // Its tile, titled as the right-click menu names its entry, in the tests' English UI. - const std::unique_ptr tile = GUI::NativeCommands::make_action(command_of(catalog, "sketch_create")); - REQUIRE(tile != nullptr); - CHECK(tile->id() == "orca_command:sketch_create:orca"); - CHECK(tile->group == "Design"); - CHECK(tile->title() == "Sketch"); - CHECK(GUI::NativeCommands::tile_title(command_of(catalog, "sketch_create")) == "Sketch"); + // Its Speed Dial action, titled as the right-click menu names its entry, in the tests' English UI. + const std::unique_ptr action = GUI::NativeCommands::make_action(command_of(catalog, "sketch_create")); + REQUIRE(action != nullptr); + CHECK(action->id() == "orca_command:sketch_create:orca"); + CHECK(action->group == "Design"); + CHECK(action->title() == "Sketch"); + CHECK(GUI::NativeCommands::action_title(command_of(catalog, "sketch_create")) == "Sketch"); CHECK(std::string(GUI::title_context(command_of(catalog, "sketch_create"))) == "Design"); - CHECK(tile->icon == "design_sketch"); - CHECK(tile->command == "sketch_create"); + CHECK(action->icon == "design_sketch"); + CHECK(action->command == "sketch_create"); } -TEST_CASE("the Design tiles' icons resolve to shipped SVGs", "[Mcp][CAD][SpeedDial]") +TEST_CASE("the Design tab actions' icons resolve to shipped SVGs", "[Mcp][CAD][SpeedDial]") { // An icon comes from a hand-edited atlas row, so a typo would be a blank tile and a blank menu item. const boost::filesystem::path images = boost::filesystem::path(PROFILES_DIR).parent_path() / "images"; const GUI::CommandCatalog catalog = catalog_with_cad(); - std::size_t tiles = 0; + std::size_t actions = 0; for (const GUI::NativeCommand& c : catalog.commands()) { if (c.group != "Design") continue; if (!c.icon.empty()) { INFO(c.key << " -> " << c.icon); CHECK(boost::filesystem::exists(images / (c.icon + ".svg"))); - tiles += c.in_palette ? 1 : 0; + actions += c.has_own_action ? 1 : 0; } - if (!c.tiles.is_array()) + if (!c.actions.is_array()) continue; - for (const json& tile : c.tiles) { - const std::string icon = tile.at("icon").get(); - INFO(c.key << " / " << tile.at("key") << " -> " << icon); + for (const json& action : c.actions) { + const std::string icon = action.at("icon").get(); + INFO(c.key << " / " << action.at("key") << " -> " << icon); CHECK_FALSE(icon.empty()); CHECK(boost::filesystem::exists(images / (icon + ".svg"))); - ++tiles; + ++actions; } } - // One per entry with an action: the 52 commands' own and the 37 folded items'. - CHECK(tiles == 89); + // One per entry with a handler: the 52 commands' own and the 37 folded items'. + CHECK(actions == 89); } TEST_CASE("a tool refused for the selection says it does not apply and what it takes", "[Mcp][CAD]") @@ -786,7 +786,7 @@ TEST_CASE("a tool refused for the selection says it does not apply and what it t } CHECK(greyed > 0); CHECK(never_greyed > 0); - // A key: action runs whatever is selected, as its key does. + // A key: handler runs whatever is selected, as its key does. CHECK_FALSE(GUI::Mcp::open_refusal(design_row("shell"), false, int(GUI::OfferSel::None)).has_value()); } @@ -813,7 +813,7 @@ TEST_CASE("the menu items that act on the Feature list's row are not refused for CHECK(GUI::kDesignTools[i].feature_row == (feature_rows.count(GUI::kDesignTools[i].id) == 1)); } // With nothing picked in the view: refused for the selection as the menu greys them, and nothing when a call - // targets the selected row of the Feature list, whose action says itself what it cannot do. + // targets the selected row of the Feature list, whose handler says itself what it cannot do. const int none = int(GUI::OfferSel::None); for (const std::string& id : feature_rows) { INFO(id); @@ -862,20 +862,20 @@ TEST_CASE("a Design tool opens only in the mode its menu item belongs to", "[Mcp CHECK_FALSE(GUI::Mcp::open_refusal(design_row("sk_rect"), true, int(GUI::OfferSel::SkNone)).has_value()); } -TEST_CASE("a pinned Design tile stays pinned while its tile is not shown", "[Mcp][CAD][SpeedDial]") +TEST_CASE("a pinned Design tab action stays pinned while it is not shown", "[Mcp][CAD][SpeedDial]") { - CHECK(GUI::is_design_tile_id("orca_command:shell:orca")); - CHECK(GUI::is_design_tile_id("orca_command:sk_rect:orca")); - CHECK(GUI::is_design_tile_id("orca_command:sk_array:orca")); // a folded item's, which runs sketch_pattern - CHECK_FALSE(GUI::is_design_tile_id("orca_command:describe_design:orca")); // a Design command with no tile - CHECK_FALSE(GUI::is_design_tile_id("orca_command:align_to:orca")); // an entry with no command - CHECK_FALSE(GUI::is_design_tile_id("orca_command:sk_trim:orca")); // no entry's: the Trim item is sketch_trim's - CHECK_FALSE(GUI::is_design_tile_id("orca_command:save_project:orca")); - CHECK_FALSE(GUI::is_design_tile_id("orca_plate_goto:shell:orca")); - CHECK_FALSE(GUI::is_design_tile_id("shell")); - // On the Prepare tab no Design tile is live, and the third plate is gone. A pin under an id no entry has, as - // the Trim item's tile had before it took sketch_trim's key, has no live action either: it is dropped, and the - // pins on either side of it stay. + CHECK(GUI::is_design_action_id("orca_command:shell:orca")); + CHECK(GUI::is_design_action_id("orca_command:sk_rect:orca")); + CHECK(GUI::is_design_action_id("orca_command:sk_array:orca")); // a folded item's, which runs sketch_pattern + CHECK_FALSE(GUI::is_design_action_id("orca_command:describe_design:orca")); // a Design command with no action + CHECK_FALSE(GUI::is_design_action_id("orca_command:align_to:orca")); // an entry with no command + CHECK_FALSE(GUI::is_design_action_id("orca_command:sk_trim:orca")); // no entry's: the Trim item is sketch_trim's + CHECK_FALSE(GUI::is_design_action_id("orca_command:save_project:orca")); + CHECK_FALSE(GUI::is_design_action_id("orca_plate_goto:shell:orca")); + CHECK_FALSE(GUI::is_design_action_id("shell")); + // On the Prepare tab no Design tab action is live, and the third plate is gone. A pin under an id no entry has, + // as the Trim item's action had before it took sketch_trim's key, has no live action either: it is dropped, and + // the pins on either side of it stay. const std::string shell = "orca_command:shell:orca", rect = "orca_command:sk_rect:orca"; const std::string array = "orca_command:sk_array:orca", trim = "orca_command:sk_trim:orca"; const std::string save = "orca_command:save_project:orca", plate = "orca_plate_goto:2:orca"; @@ -889,7 +889,7 @@ TEST_CASE("a pinned Design tile stays pinned while its tile is not shown", "[Mcp TEST_CASE("a hidden Design pin takes no place on the favourites bar", "[Mcp][CAD][SpeedDial]") { - // Ten stored pins on the Prepare tab, three of them Design tiles, which are not live there. + // Ten stored pins on the Prepare tab, three of them Design tab actions, which are not live there. const std::vector design = {"orca_command:shell:orca", "orca_command:sk_rect:orca", "orca_command:fillet:orca"}; std::vector favs; for (int i = 1; i <= 7; ++i) @@ -909,30 +909,30 @@ TEST_CASE("a hidden Design pin takes no place on the favourites bar", "[Mcp][CAD CHECK(shown.size() == 8); } -TEST_CASE("the Design tab's tiles are its mode's tools, and none with the CAD feature off", "[Mcp][CAD][SpeedDial]") +TEST_CASE("the Design tab's actions are its mode's tools, and none with the CAD feature off", "[Mcp][CAD][SpeedDial]") { const GUI::CommandCatalog catalog = cad_catalog(); for (const bool sketching : {false, true}) { INFO("sketching " << sketching); - // The entry of each tile, in the order design_tiles() gives them. + // The entry of each action, in the order design_actions() gives them. std::vector ids; - for (const GUI::Mcp::DesignTile& tile : GUI::Mcp::design_tiles(catalog, sketching, /*cad_on=*/true)) { - REQUIRE(tile.command != nullptr); - const std::string id = tile.tile != nullptr ? tile.tile->at("key").get() : tile.command->key; + for (const GUI::Mcp::DesignAction& action : GUI::Mcp::design_actions(catalog, sketching, /*cad_on=*/true)) { + REQUIRE(action.command != nullptr); + const std::string id = action.action != nullptr ? action.action->at("key").get() : action.command->key; INFO(id); const GUI::DesignTool& entry = design_row(id); if (entry.fold_into != nullptr) { - // A folded item's tile runs the command it is folded into with the item's arguments. - REQUIRE(tile.tile != nullptr); - CHECK(tile.command->key == entry.fold_into); - CHECK(tile.tile->at("args") == json::parse(entry.args)); + // A folded item's action runs the command it is folded into with the item's arguments. + REQUIRE(action.action != nullptr); + CHECK(action.command->key == entry.fold_into); + CHECK(action.action->at("args") == json::parse(entry.args)); } else { - CHECK(tile.tile == nullptr); - CHECK(tile.command->in_palette); + CHECK(action.action == nullptr); + CHECK(action.command->has_own_action); } ids.push_back(id); } - // Every entry with an action has its tile in its own mode and none in the other, in the table's order. + // Every entry with a handler has its action in its own mode and none in the other, in the table's order. std::vector offered; for (int i = 0; i < GUI::kDesignToolCount; ++i) if (GUI::kDesignTools[i].action != nullptr && GUI::kDesignTools[i].sketch_mode == sketching) @@ -942,19 +942,19 @@ TEST_CASE("the Design tab's tiles are its mode's tools, and none with the CAD fe INFO(id); CHECK(std::count(ids.begin(), ids.end(), id) == 1); } - // Turned off while the app runs, the tab stays until a restart, and has no tile. - CHECK(GUI::Mcp::design_tiles(catalog, sketching, /*cad_on=*/false).empty()); + // Turned off while the app runs, the tab stays until a restart, and has no action. + CHECK(GUI::Mcp::design_actions(catalog, sketching, /*cad_on=*/false).empty()); } } -TEST_CASE("a folded item's tile runs its command with the item's arguments", "[Mcp][CAD][SpeedDial]") +TEST_CASE("a folded item's action runs its command with the item's arguments", "[Mcp][CAD][SpeedDial]") { const GUI::CommandCatalog catalog = cad_catalog(); const GUI::NativeCommand& sketch_pattern = command_of(catalog, "sketch_pattern"); - const auto [pattern_owner, array] = GUI::find_tile(catalog, "sk_array"); + const auto [pattern_owner, array] = GUI::find_command_action(catalog, "sk_array"); REQUIRE(pattern_owner == &sketch_pattern); REQUIRE(array != nullptr); - // The Linear array item's tile, under the id it has had, titled and pictured as the item, in the tests' English UI. + // The Linear array item's action, under the id it has had, titled and pictured as the item, in the tests' English UI. const std::unique_ptr action = GUI::NativeCommands::make_action(sketch_pattern, *array); REQUIRE(action != nullptr); CHECK(action->id() == "orca_command:sk_array:orca"); @@ -972,68 +972,68 @@ TEST_CASE("a folded item's tile runs its command with the item's arguments", "[M CHECK(GUI::Mcp::action_args_error(*action, {{"type", "linear"}}).empty()); CHECK_FALSE(GUI::Mcp::action_args_error(*action, {{"count", 3}}).empty()); CHECK_FALSE(GUI::Mcp::action_args_error(*action, {{"type", "circular"}}).empty()); - // A call of the command with the item's arguments is titled as the item's tile; with any other, as the command. + // A call of the command with the item's arguments is titled as the item's action; with any other, as the command. CHECK(GUI::call_title(sketch_pattern, {{"type", "linear"}}) == "Linear array"); CHECK(GUI::call_title(sketch_pattern, {{"type", "linear"}, {"count", 3}}) == sketch_pattern.title); // The Color item runs body_set with no arguments: its preset is an empty object, not null. const GUI::NativeCommand& body_set = command_of(catalog, "body_set"); - const auto [colour_owner, colour_tile] = GUI::find_tile(catalog, "colour"); + const auto [colour_owner, colour_action] = GUI::find_command_action(catalog, "colour"); REQUIRE(colour_owner == &body_set); - REQUIRE(colour_tile != nullptr); - const std::unique_ptr colour = GUI::NativeCommands::make_action(body_set, *colour_tile); + REQUIRE(colour_action != nullptr); + const std::unique_ptr colour = GUI::NativeCommands::make_action(body_set, *colour_action); REQUIRE(colour != nullptr); CHECK(colour->preset.is_object()); CHECK(colour->preset.empty()); CHECK(GUI::call_title(body_set, json::object()) == "Color"); - // The three value items are one action under three labels, all with no arguments: a call with none is titled as + // The three value items are one tool under three labels, all with no arguments: a call with none is titled as // the first of them. CHECK(GUI::call_title(command_of(catalog, "sketch_set_value"), json::object()) == "Length\xE2\x80\xA6"); - // A command's own tile is found under its key, with no tile of the command's tiles; an id no entry has is none. - const auto [trim, trim_tile] = GUI::find_tile(catalog, "sketch_trim"); + // A command's own action is found under its key, with none of the command's actions; an id no entry has is none. + const auto [trim, trim_action] = GUI::find_command_action(catalog, "sketch_trim"); CHECK(trim == &command_of(catalog, "sketch_trim")); - CHECK(trim_tile == nullptr); - const auto [none, none_tile] = GUI::find_tile(catalog, "sk_trim"); + CHECK(trim_action == nullptr); + const auto [none, none_action] = GUI::find_command_action(catalog, "sk_trim"); CHECK(none == nullptr); - CHECK(none_tile == nullptr); + CHECK(none_action == nullptr); - // Every tile's arguments are a call its command takes, and that call opens the tile's item. - std::size_t tiles = 0; + // Every action's arguments are a call its command takes, and that call opens the action's item. + std::size_t actions = 0; for (const GUI::NativeCommand& c : catalog.commands()) { - if (c.tiles.is_null()) + if (c.actions.is_null()) continue; const GUI::DesignTool* entry = GUI::Mcp::find_design_tool(c.key); REQUIRE(entry != nullptr); - for (const json& tile : c.tiles) { - INFO(c.key << " / " << tile.at("key")); - json args = tile.at("args"); + for (const json& command_action : c.actions) { + INFO(c.key << " / " << command_action.at("key")); + json args = command_action.at("args"); CHECK(GUI::Mcp::argument_error(c, args).empty()); - const GUI::DesignTool* item = GUI::Mcp::opened_item(*entry, tile.at("args")); + const GUI::DesignTool* item = GUI::Mcp::opened_item(*entry, command_action.at("args")); REQUIRE(item != nullptr); - CHECK(std::string(item->action) == design_row(tile.at("key").get()).action); - ++tiles; + CHECK(std::string(item->action) == design_row(command_action.at("key").get()).action); + ++actions; } } - CHECK(tiles == 37); // one per folded item + CHECK(actions == 37); // one per folded item } -TEST_CASE("the Action Replay window titles a step that calls a folded item's tile as that item", "[Mcp][CAD][SpeedDial]") +TEST_CASE("the Action Replay window titles a step that calls a folded item's action as that item", "[Mcp][CAD][SpeedDial]") { const GUI::CommandCatalog catalog = cad_catalog(); const std::string pattern = command_of(catalog, "sketch_pattern").title; const json step{{"kind", "command"}, {"key", "sketch_pattern"}}; - // describe_step()'s `what` for a call of sketch_pattern with the Linear array item's arguments names the item's tile: - // the window shows that tile's title, in the tests' English UI. - json tiled = step; - tiled["tile"] = "sk_array"; - CHECK(GUI::replay_what_text(tiled, catalog).first == "Linear array"); - // With no tile, or a tile that is not the command's (body_set's Color, or none at all), the command's own title. + // describe_step()'s `what` for a call of sketch_pattern with the Linear array item's arguments names the item's + // action: the window shows that action's title, in the tests' English UI. + json with_action = step; + with_action["action"] = "sk_array"; + CHECK(GUI::replay_what_text(with_action, catalog).first == "Linear array"); + // With no action, or an action that is not the command's (body_set's Color, or none at all), the command's own title. CHECK(GUI::replay_what_text(step, catalog).first == pattern); for (const char* other : {"colour", "sk_none"}) { INFO(other); - json given = step; - given["tile"] = other; + json given = step; + given["action"] = other; CHECK(GUI::replay_what_text(given, catalog).first == pattern); } } @@ -1550,7 +1550,7 @@ TEST_CASE("a CAD command's summary is one sentence of at most 120 characters", " CHECK_THAT(command_of(catalog, "sketch_transform").description, ContainsSubstring("pivot")); CHECK_THAT(command_of(catalog, "shell").description, ContainsSubstring("ok is false")); CHECK_THAT(command_of(catalog, "extrude").description, !ContainsSubstring("ok is false")); - // One with an action only does what its menu item does, which for Zoom to selection is to act at once. + // One with a handler only does what its menu item does, which for Zoom to selection is to act at once. CHECK_THAT(command_of(catalog, "zoom_to_selection").description, ContainsSubstring("act at once")); CHECK_THAT(command_of(catalog, "zoom_to_selection").description, !ContainsSubstring("opens the tool")); } @@ -1565,7 +1565,7 @@ TEST_CASE("a Design command with a person's form says which mode it runs in", "[ if (item.action == nullptr) continue; INFO(c.key); - // An action only: its description says it of the command, which takes no arguments. Both forms: the `silent` + // A handler only: its description says it of the command, which takes no arguments. Both forms: the `silent` // property says it of the call with no arguments, whose item's mode the argument form need not share. const bool both = item.doc != nullptr; const std::string text = both ? property_of(c, "silent").value("description", std::string()) : c.description; @@ -1576,7 +1576,7 @@ TEST_CASE("a Design command with a person's form says which mode it runs in", "[ CHECK_THAT(text, !ContainsSubstring("It runs only")); ++told; } - CHECK(told == 52); // the commands whose entry has an action + CHECK(told == 52); // the commands whose entry has a handler CHECK_THAT(command_of(catalog, "sketch_polygon_inscribed").description, ContainsSubstring("It " + in_sketch)); CHECK_THAT(command_of(catalog, "zoom_to_selection").description, ContainsSubstring("It " + outside)); CHECK_THAT(property_of(command_of(catalog, "shell"), "silent").value("description", std::string()), @@ -1998,7 +1998,7 @@ TEST_CASE("every CAD command with a silent form has one to three examples", "[Mc const GUI::CommandCatalog catalog = cad_catalog(); for (const GUI::NativeCommand& c : catalog.commands()) { INFO(c.key); - // A command with an action and no silent form takes no arguments, so there is no call to show. + // A command with a handler and no silent form takes no arguments, so there is no call to show. if (design_row(c.key).doc == nullptr) { CHECK(c.examples.is_null()); continue; @@ -2973,10 +2973,10 @@ TEST_CASE("sketch_edit re-opens a committed sketch by its index, as a sketch com const GUI::CommandCatalog catalog = cad_catalog(); const GUI::NativeCommand& command = command_of(catalog, "sketch_edit"); const GUI::DesignTool& entry = design_row("sketch_edit"); - // A command with no menu item of its own: no menu item, no tile and no person's form. + // A command with no menu item of its own: no menu item, no Speed Dial action and no person's form. CHECK(entry.row == -1); CHECK(entry.action == nullptr); - CHECK_FALSE(command.in_palette); + CHECK_FALSE(command.has_own_action); CHECK_FALSE(two_forms(command)); REQUIRE(entry.section != nullptr); CHECK(std::string(entry.section) == "Sketch"); diff --git a/tests/slic3rutils/test_mcp_config.cpp b/tests/slic3rutils/test_mcp_config.cpp index 73e166a1f3..761903704e 100644 --- a/tests/slic3rutils/test_mcp_config.cpp +++ b/tests/slic3rutils/test_mcp_config.cpp @@ -1803,6 +1803,6 @@ TEST_CASE("filament_sync_ams takes the sync dialog's choice, map or overwrite, a } json other{{"mode", "merge"}}; CHECK_THAT(argument_error(*sync, other), Catch::Matchers::ContainsSubstring("mode")); - // Its tile's call, with no arguments, is the person's form, which opens the sync dialog. + // Its Speed Dial action's call, with no arguments, is the person's form, which opens the sync dialog. CHECK(Mcp::person_form(*sync, json::object())); } diff --git a/tests/slic3rutils/test_mcp_core.cpp b/tests/slic3rutils/test_mcp_core.cpp index ee7fd14e4e..75af83ddb4 100644 --- a/tests/slic3rutils/test_mcp_core.cpp +++ b/tests/slic3rutils/test_mcp_core.cpp @@ -15,7 +15,7 @@ #include #include -// The dispatch core's cases that name a type of the GUI library: the automation runtime and a tile's +// The dispatch core's cases that name a type of the GUI library: the automation runtime and an action's // context. The others are in tests/automation/test_mcp_core.cpp. using namespace Slic3r::GUI; @@ -62,17 +62,17 @@ TEST_CASE("a context with no runtime refuses", "[Mcp]") CHECK_FALSE(acted.data.contains("status")); } -TEST_CASE("a tile's journal update stays inside action_run's envelope", "[Mcp]") +TEST_CASE("an action's journal update stays inside action_run's envelope", "[Mcp]") { Harness h; h.registry.add(tool("action_run", GuardClass::Mutate, [](const json&, ToolContext& ctx) { - // The command's function, as action_run runs a tile with it. + // The command's function, as action_run runs an action with it. const auto command = [](const json&, ToolContext& own) { own.set_journal_args({{"a", 1}}); return ToolResult::ok(); }; - TileContext tile(ctx, "orca_command:k:orca"); - return command(json::object(), tile); + ActionContext action(ctx, "orca_command:k:orca"); + return command(json::object(), action); })); h.start(); const ToolResult ran = h.call("action_run", {{"id", "k"}}); @@ -84,27 +84,27 @@ TEST_CASE("a tile's journal update stays inside action_run's envelope", "[Mcp]") CHECK(steps[0]["args"] == json{{"id", "orca_command:k:orca"}, {"args", {{"a", 1}}}}); } -TEST_CASE("a tile of fixed arguments is journaled with the arguments action_run takes for it", "[Mcp]") +TEST_CASE("an action of fixed arguments is journaled with the arguments action_run takes for it", "[Mcp]") { - // What action_run takes for the tile: a folded item's own arguments, none for a command's own tile outside the - // Design tab, or the value a tile with an input collects. - const json tile_args = GENERATE(json{{"type", "circular"}}, json::object(), json{{"percent", 50}}); + // What action_run takes for the action: a folded item's own arguments, none for a command's own action outside the + // Design tab, or the value an action with an input collects. + const json action_args = GENERATE(json{{"type", "circular"}}, json::object(), json{{"percent", 50}}); Harness h; - h.registry.add(tool("action_run", GuardClass::Mutate, [tile_args](const json&, ToolContext& ctx) { + h.registry.add(tool("action_run", GuardClass::Mutate, [action_args](const json&, ToolContext& ctx) { // The command's function records what it ran with, as object_arrange records the settings in force and a // Design command its arguments with their refs as locators. const auto command = [](const json&, ToolContext& own) { own.set_journal_args({{"type", "circular"}, {"spacing", 6}}); return ToolResult::ok(); }; - TileContext tile(ctx, "orca_command:k:orca", tile_args); - return command(json::object(), tile); + ActionContext action(ctx, "orca_command:k:orca", action_args); + return command(json::object(), action); })); h.start(); REQUIRE_FALSE(h.call("action_run", {{"id", "k"}}).is_error); const json steps = h.journal.to_replay("s")["steps"]; REQUIRE(steps.size() == 1); CHECK(steps[0]["tool"] == "action_run"); - // action_run refuses any other arguments for such a tile, so the step holds the tile's, which its replay runs. - CHECK(steps[0]["args"] == json{{"id", "orca_command:k:orca"}, {"args", tile_args}}); + // action_run refuses any other arguments for such an action, so the step holds the action's, which its replay runs. + CHECK(steps[0]["args"] == json{{"id", "orca_command:k:orca"}, {"args", action_args}}); } diff --git a/tests/slic3rutils/test_mcp_recording.cpp b/tests/slic3rutils/test_mcp_recording.cpp index b8d9da81d6..f651091861 100644 --- a/tests/slic3rutils/test_mcp_recording.cpp +++ b/tests/slic3rutils/test_mcp_recording.cpp @@ -1010,19 +1010,19 @@ TEST_CASE("a caption keeps the context its title is translated in", "[Mcp][Recor CHECK(board.current(t0)->context == "Design"); } -TEST_CASE("a call with a tile's arguments is captioned with the tile's title", "[Mcp][Recording]") +TEST_CASE("a call with an action's arguments is captioned with the action's title", "[Mcp][Recording]") { - // A Design command whose Linear array item is folded into it: the call that item's tile makes is titled as the - // tile, untranslated and in the command's context, as McpRecorder::call_started() hands it to the board. + // A Design command whose Linear array item is folded into it: the call that item's action makes is titled as the + // action, untranslated and in the command's context, as McpRecorder::call_started() hands it to the board. NativeCommand pattern; - pattern.key = "sketch_pattern"; - pattern.title = "Pattern sketch entities"; - pattern.group = kDesignGroup; - pattern.tiles = json::array({{{"key", "sk_array"}, - {"title", "Linear array"}, - {"icon", "design_array"}, - {"description", ""}, - {"args", {{"type", "linear"}}}}}); + pattern.key = "sketch_pattern"; + pattern.title = "Pattern sketch entities"; + pattern.group = kDesignGroup; + pattern.actions = json::array({{{"key", "sk_array"}, + {"title", "Linear array"}, + {"icon", "design_array"}, + {"description", ""}, + {"args", {{"type", "linear"}}}}}); CaptionBoard board; const auto t0 = CaptionBoard::Clock::now(); board.call_started(1, call_title(pattern, {{"type", "linear"}}), "", t0, title_context(pattern)); @@ -1035,10 +1035,10 @@ TEST_CASE("a call with a tile's arguments is captioned with the tile's title", " CHECK(board.current(t0)->title == "Pattern sketch entities"); } -TEST_CASE("a tile's call is captioned with the tile's title, run by its id or as its command with its arguments", "[Mcp][Recording]") +TEST_CASE("an action's call is captioned with the action's title, run by its id or as its command with its arguments", "[Mcp][Recording]") { - // As McpRecorder::call_started() hands a call to the board: action_run of a tile, and a call of the tile's command - // with the tile's arguments. + // As McpRecorder::call_started() hands a call to the board: action_run of an action, and a call of the action's + // command with the action's arguments. const CommandCatalog& catalog = NativeCommands::instance(); const NativeCommand* action_run = catalog.find("action_run"); const NativeCommand* mirror = catalog.find("object_mirror"); @@ -1056,24 +1056,24 @@ TEST_CASE("a tile's call is captioned with the tile's title, run by its id or as REQUIRE(board.current(t0).has_value()); CHECK(board.current(t0)->title == "Mirror X"); - // The name inside the id, as action_run takes it; a command's own tile, titled as its command. + // The name inside the id, as action_run takes it; a command's own action, titled as its command. CHECK(shown_title(catalog, *action_run, {{"id", "obj_arrange"}}).first == "Auto-Arrange"); CHECK(shown_title(catalog, *action_run, {{"id", "orca_command:undo:orca"}}).first == "Undo"); - // Any other action, and an id no tile has, are action_run's own. + // An action that is not a command's, and an id no action has, are action_run's own. CHECK(shown_title(catalog, *action_run, {{"id", "orca_recent_project:C:/p/a.3mf:orca"}}).first == action_run->title); - CHECK(shown_title(catalog, *action_run, {{"id", "orca_command:no_such_tile:orca"}}).second == action_run); + CHECK(shown_title(catalog, *action_run, {{"id", "orca_command:no_such_action:orca"}}).second == action_run); CHECK(shown_title(catalog, *mirror, {{"axis", "x"}, {"silent", true}}).first == mirror->title); } -TEST_CASE("an Action Replay step that runs a tile is titled as the tile, with the value it collects", "[Mcp][Recording]") +TEST_CASE("an Action Replay step that runs an action is titled as the action, with the value it collects", "[Mcp][Recording]") { // describe_step()'s `what` for action_run of Go to layer with {percent: 50}, and of Mirror X. const CommandCatalog& catalog = NativeCommands::instance(); - const json layer{{"kind", "command"}, {"key", "view_set"}, {"tile", "go_to_layer"}, {"args", {"layer_percent: 50"}}}; + const json layer{{"kind", "command"}, {"key", "view_set"}, {"action", "go_to_layer"}, {"args", {"layer_percent: 50"}}}; const auto [layer_title, layer_detail] = replay_what_text(layer, catalog); CHECK(layer_title == "Go to layer (percent)"); CHECK(layer_detail == "layer_percent: 50"); - const json mirror{{"kind", "command"}, {"key", "object_mirror"}, {"tile", "obj_mirror_x"}}; + const json mirror{{"kind", "command"}, {"key", "object_mirror"}, {"action", "obj_mirror_x"}}; const auto [mirror_title, mirror_detail] = replay_what_text(mirror, catalog); CHECK(mirror_title == "Mirror X"); CHECK(mirror_detail.empty()); @@ -1190,7 +1190,7 @@ TEST_CASE("captions name what a call acts on and never show secrets", "[Mcp][Rec CHECK(settings.find("s3cret") == std::string::npos); CHECK(settings.find("nozzle_diameter = 0.4") != std::string::npos); CHECK(caption_detail("project_import", {{"paths", {"C:/models/part.stl", "/tmp/b.3mf"}}}) == "part.stl, b.3mf"); - // A menu item's tile is its command's call; a command's own tile given arguments shows them. + // A menu item's action is its command's call; a command's own action given arguments shows them. CHECK(caption_detail("action_run", {{"id", "orca_command:obj_arrange:orca"}}) == "object_arrange"); CHECK(caption_detail("action_run", {{"id", "orca_command:undo:orca"}, {"args", {{"history", "design"}}}}) == "undo history: design"); CHECK(caption_detail("webview_run_javascript", {{"code", "login('s3cret')"}}).empty()); @@ -1560,7 +1560,7 @@ TEST_CASE("an exported replay encodes the recording it makes and leaves other so CHECK(steps[3]["args"]["path"] == "D:/videos/old.mkv"); } -TEST_CASE("an exported replay records a silent recording into its own folder and keeps a pick of the tile as it is", "[Mcp][Recording]") +TEST_CASE("an exported replay records a silent recording into its own folder and keeps a pick of the action as it is", "[Mcp][Recording]") { Journal j; auto ok = [&](const std::string& tool, const json& args) { j.end(j.begin(tool, args), ToolResult::ok()); }; @@ -1568,7 +1568,7 @@ TEST_CASE("an exported replay records a silent recording into its own folder and ok("recording_start", {{"silent", true}, {"save_path", "C:/Users/me/mcp/recording-20261113.mkv"}}); ok("recording_stop", {{"silent", true}}); ok("recording_encode", {{"path", "C:/Users/me/mcp/recording-20261113.mkv"}, {"save_path", "C:/Users/me/mcp/take.mp4"}}); - // action_run of the Start Recording tile, which takes no arguments: the person's form, which opens the Start + // action_run of the Start Recording action, which takes no arguments: the person's form, which opens the Start // Recording dialog and names no file. ok("action_run", {{"id", "orca_command:start_recording:orca"}}); const json steps = j.to_replay("s")["steps"]; diff --git a/tests/slic3rutils/test_mcp_results.cpp b/tests/slic3rutils/test_mcp_results.cpp index aee5bc7372..fa981eeaa8 100644 --- a/tests/slic3rutils/test_mcp_results.cpp +++ b/tests/slic3rutils/test_mcp_results.cpp @@ -2707,15 +2707,15 @@ TEST_CASE("an upload's row reaches 100 percent only once the host has answered", CHECK(percent(4096, 4096) == 99); } -TEST_CASE("the send command is a Slice & Export tile that takes no arguments", "[Mcp][SpeedDial]") +TEST_CASE("the send command is a Slice & Export action that takes no arguments", "[Mcp][SpeedDial]") { const NativeCommand* send = NativeCommands::find("printer_send"); REQUIRE(send != nullptr); CHECK(send->title == "Send G-code to printer host"); - const auto [command, tile] = Slic3r::GUI::find_tile(NativeCommands::instance(), "send_gcode"); + const auto [command, action] = Slic3r::GUI::find_command_action(NativeCommands::instance(), "send_gcode"); CHECK(command == send); - REQUIRE(tile != nullptr); - CHECK(tile->at("group") == "Slice & Export"); + REQUIRE(action != nullptr); + CHECK(action->at("group") == "Slice & Export"); CHECK(send->input_schema.at("properties").empty()); CHECK(send->completion == CommandCompletion::Immediate); CHECK(send->description.find("app_state.uploads") != std::string::npos); diff --git a/tests/slic3rutils/test_mcp_scene.cpp b/tests/slic3rutils/test_mcp_scene.cpp index 87a697aeec..d519006255 100644 --- a/tests/slic3rutils/test_mcp_scene.cpp +++ b/tests/slic3rutils/test_mcp_scene.cpp @@ -132,7 +132,7 @@ TEST_CASE("the arrange options keep Align to Y axis off while auto rotation is o CHECK(settings.enable_rotation); } -// A command that replaces a dialog takes, as JSON arguments, what the dialog asks; Go to layer and Go to tab, tiles of +// A command that replaces a dialog takes, as JSON arguments, what the dialog asks; Go to layer and Go to tab, actions of // view_set, take the value of the Speed Dial's second phase, which they need. TEST_CASE("the commands that replace a dialog take the arguments the table gives", "[Mcp][Scene]") { @@ -155,7 +155,7 @@ TEST_CASE("the commands that replace a dialog take the arguments the table gives INFO(name); CHECK(view.count(name) == 1); } - // A command whose tile asks takes, in its place, the arguments of the tile and silent. + // A command whose action asks takes, in its place, the arguments of the action and silent. REQUIRE(names("project_open") == Names{"path", "discard_changes", "silent"}); REQUIRE(names("project_import") == Names{"paths", "entries", "archive", "silent"}); REQUIRE(names("project_save") == Names{"path", "overwrite", "save_as", "silent"}); @@ -198,9 +198,9 @@ TEST_CASE("the commands that replace a dialog take the arguments the table gives CHECK(names("object_arrange").count("fill_object") == 1); CHECK(names("object_arrange").count("fill") == 0); - // A command with a tile of its own requires nothing: it does its person's form when it is given no arguments. - for (const NativeCommands::PaletteTile& t : NativeCommands::palette_tiles(NativeCommands::instance())) { - if (t.tile != nullptr) + // A command with an action of its own requires nothing: it does its person's form when it is given no arguments. + for (const NativeCommands::SpeedDialAction& t : NativeCommands::speed_dial_actions(NativeCommands::instance())) { + if (t.action != nullptr) continue; INFO(t.command->key); CHECK_FALSE(t.command->input_schema.contains("required")); @@ -337,7 +337,7 @@ struct FakeWorker }; // A core with stand-ins for the tools that start an arrange (the typed object_arrange, action_run of the -// obj_arrange tile, a click on a plate's Arrange icon, which queues its event), change the scene (a +// obj_arrange action, a click on a plate's Arrange icon, which queues its event), change the scene (a // mutate tool, a key on the canvas), answer a dialog, read, and cancel. struct Harness { @@ -503,7 +503,7 @@ TEST_CASE("a cancelled worker job keeps admission until the worker is really idl TEST_CASE("a change is refused while an arrange an MCP call started runs, however it started", "[Mcp][Scene]") { - // The typed object_arrange, action_run of the obj_arrange tile, and a recover input whose click queues the job. + // The typed object_arrange, action_run of the obj_arrange action, and a recover input whose click queues the job. for (const char* starter : {"object_arrange", "action_run", "widget_click"}) { DYNAMIC_SECTION(starter) { @@ -1118,7 +1118,7 @@ TEST_CASE("a shape's size needs one positive number per field of the size dialog } } -// The object list's context-menu items are tiles of commands beside the other object and part commands. +// The object list's context-menu items are actions of commands beside the other object and part commands. TEST_CASE("the object structure commands sit beside the other object commands", "[Mcp][Scene]") { const NativeCommand* objects = NativeCommands::find("object_delete"); @@ -1132,9 +1132,9 @@ TEST_CASE("the object structure commands sit beside the other object commands", REQUIRE(c != nullptr); CHECK(c->group == (std::string(key).rfind("part_", 0) == 0 ? parts : objects)->group); CHECK_FALSE(c->description.empty()); - REQUIRE(c->tiles.is_array()); - for (const json& tile : c->tiles) - CHECK_FALSE(tile.at("description").get().empty()); + REQUIRE(c->actions.is_array()); + for (const json& action : c->actions) + CHECK_FALSE(action.at("description").get().empty()); } } @@ -1205,7 +1205,7 @@ TEST_CASE("a mirror needs its axis, a centring takes a plate and no part, and a REQUIRE(primitive != nullptr); json placed{{"shape", "cube"}, {"size", json::array({20, 20, 20})}, {"plate", 1}, {"position", json::array({100, 100, 0})}, {"name", "block"}}; CHECK(Mcp::argument_error(*primitive, placed).empty()); - // A call with more than a tile's shape is the silent form, which asks for no size. + // A call with more than an action's shape is the silent form, which asks for no size. CHECK_FALSE(Mcp::person_form(*primitive, placed)); // Its size is checked as part_add's is: the size dialog's fields, each above 0. const std::vector cylinder = Mcp::part_shape_size("cylinder", json::array({30, 10})); diff --git a/tests/slic3rutils/test_mcp_tools.cpp b/tests/slic3rutils/test_mcp_tools.cpp index a9ed492fbd..5cf24cba83 100644 --- a/tests/slic3rutils/test_mcp_tools.cpp +++ b/tests/slic3rutils/test_mcp_tools.cpp @@ -135,9 +135,9 @@ TEST_CASE("a search matches query words at the start of a text's words, CamelCas CHECK(match_score(query_words("retract"), "retraction_length", "") == std::pair{1, 1}); } -TEST_CASE("an action search ranks by the query's words and puts the plainer tile first", "[Mcp]") +TEST_CASE("an action search ranks by the query's words and puts the plainer action first", "[Mcp]") { - // Four of the Speed Dial's tiles as it lists them. + // Four of the Speed Dial's actions as it lists them. const json listed = json::array({ {{"id", "orca_command:obj_delete_all:orca"}, {"title", "Delete All Objects"}, {"group", "Object"}, {"description", "Delete all objects."}}, @@ -154,8 +154,8 @@ TEST_CASE("an action search ranks by the query's words and puts the plainer tile return out; }; - // No entry holds "delete object" as one text. Two are the Object group's deletes, which the palette - // names by group and title, and the shorter name, the plainer tile, leads; the third only + // No entry holds "delete object" as one text. Two are the Object group's deletes, which the Speed Dial + // names by group and title, and the shorter name, the plainer action, leads; the third only // mentions objects. CHECK(ids(rank_actions(listed, query_words("delete object"))) == std::vector{"orca_command:obj_delete:orca", "orca_command:obj_delete_all:orca", "orca_command:filament_delete:orca"}); @@ -177,7 +177,7 @@ TEST_CASE("action_run refuses arguments for an action that takes none", "[Mcp][S CHECK_THAT(action_args_error(action, {{"plate", 2}}), Catch::Matchers::ContainsSubstring("takes no arguments")); CHECK(action_args_error(action, json::object()).empty()); } - // A command's own tile outside the Design tab takes none, as an item with no arguments does: the refusal names the + // A command's own action outside the Design tab takes none, as an item with no arguments does: the refusal names the // command that takes them. const NativeCommand* filament_delete = NativeCommands::find("filament_delete"); REQUIRE(filament_delete != nullptr); @@ -186,8 +186,8 @@ TEST_CASE("action_run refuses arguments for an action that takes none", "[Mcp][S CHECK(action_args_error(*own, json::object()).empty()); const std::string refused = action_args_error(*own, {{"filament_slot", 2}}); CHECK_THAT(refused, Catch::Matchers::ContainsSubstring("filament_delete")); - // A menu item's tile takes no arguments, or exactly its own; an item's former arguments are refused, naming the command. - const auto [export_command, export_gcode] = find_tile(NativeCommands::instance(), "export_gcode"); + // A menu item's action takes no arguments, or exactly its own; an item's former arguments are refused, naming the command. + const auto [export_command, export_gcode] = find_command_action(NativeCommands::instance(), "export_gcode"); REQUIRE(export_gcode != nullptr); const std::unique_ptr gcode = NativeCommands::make_action(*export_command, *export_gcode); CHECK(action_args_error(*gcode, json::object()).empty()); @@ -196,55 +196,56 @@ TEST_CASE("action_run refuses arguments for an action that takes none", "[Mcp][S CHECK_FALSE(with_path.empty()); CHECK_THAT(with_path, Catch::Matchers::ContainsSubstring("call project_export")); #ifdef SLIC3R_CAD - // A Design command's own tile takes the command's arguments, which the command checks. + // A Design command's own action takes the command's arguments, which the command checks. CommandCatalog design; NativeCommands::register_all_commands(design, {true}); design.seal(); const NativeCommand* shell = design.find("shell"); REQUIRE(shell != nullptr); - REQUIRE(shell->in_palette); - const std::unique_ptr design_tile = NativeCommands::make_action(*shell); - CHECK(design_tile->input_schema == shell->input_schema); - CHECK(action_args_error(*design_tile, {{"thickness", 2}}).empty()); + REQUIRE(shell->has_own_action); + const std::unique_ptr design_action = NativeCommands::make_action(*shell); + CHECK(design_action->input_schema == shell->input_schema); + CHECK(action_args_error(*design_action, {{"thickness", 2}}).empty()); #endif } -TEST_CASE("what action_run journals for a tile of fixed arguments is a call it takes", "[Mcp][SpeedDial]") +TEST_CASE("what action_run journals for an action of fixed arguments is a call it takes", "[Mcp][SpeedDial]") { - // Every command's tile: its journal step's arguments are the tile's own, or the value a tile with an input + // Every command's action: its journal step's arguments are the action's own, or the value an action with an input // collects, and action_run takes them, so a replay of the step is never refused. - const auto check_tiles = [](const CommandCatalog& catalog) { - int tiles = 0; + const auto check_actions = [](const CommandCatalog& catalog) { + int checked = 0; for (const NativeCommand& command : catalog.commands()) { std::vector> actions; - if (command.in_palette) + if (command.has_own_action) actions.push_back(NativeCommands::make_action(command)); - if (command.tiles.is_array()) - for (const json& tile : command.tiles) - actions.push_back(NativeCommands::make_action(command, tile)); + if (command.actions.is_array()) + for (const json& item : command.actions) + actions.push_back(NativeCommands::make_action(command, item)); for (const std::unique_ptr& action : actions) { INFO(action->id()); const json given = action->input.empty() ? json::object() : json{{action->input, 1}}; - const json recorded = tile_journal_args(*action, given); + const json recorded = action_journal_args(*action, given); if (action->preset.is_null()) { - // A Design command's own tile takes its command's arguments: the command's rewrite stands. + // A Design command's own action takes its command's arguments: the command's rewrite stands. CHECK(recorded.is_null()); continue; } - ++tiles; + ++checked; CHECK(recorded == (action->input.empty() ? action->preset : given)); CHECK(action_args_error(*action, recorded).empty()); } } - return tiles; + return checked; }; - // The 129 Speed Dial entries outside the Design tab are commands' tiles: eight own and 121 items. - CHECK(check_tiles(NativeCommands::instance()) == 129); + // The 129 Speed Dial entries outside the Design tab are commands' actions: eight own and 121 items. + CHECK(check_actions(NativeCommands::instance()) == 129); const auto recorded_for = [](const CommandCatalog& catalog, const char* key, const json& given) { - const auto [command, tile] = find_tile(catalog, key); + const auto [command, action] = find_command_action(catalog, key); REQUIRE(command != nullptr); - return tile_journal_args(*(tile != nullptr ? NativeCommands::make_action(*command, *tile) : NativeCommands::make_action(*command)), given); + return action_journal_args( + *(action != nullptr ? NativeCommands::make_action(*command, *action) : NativeCommands::make_action(*command)), given); }; CHECK(recorded_for(NativeCommands::instance(), "obj_arrange", json::object()) == json::object()); CHECK(recorded_for(NativeCommands::instance(), "go_to_layer", {{"percent", 50}}) == json{{"percent", 50}}); @@ -252,15 +253,15 @@ TEST_CASE("what action_run journals for a tile of fixed arguments is a call it t CommandCatalog design; NativeCommands::register_all_commands(design, {true}); design.seal(); - CHECK(check_tiles(design) > 129); + CHECK(check_actions(design) > 129); CHECK(recorded_for(design, "sk_array_polar", json::object()) == json{{"type", "circular"}}); #endif } -TEST_CASE("a call with a tile's arguments asks, and one more argument runs", "[Mcp]") +TEST_CASE("a call with an action's arguments asks, and one more argument runs", "[Mcp]") { - // The commands whose tiles ask, as the design's table "When a call does what a menu item does" lists them: called with - // exactly a tile's arguments a command is its person's form, and with silent beside them its silent form. + // The commands whose actions ask, as the design's table "When a call does what a menu item does" lists them: called with + // exactly an action's arguments a command is its person's form, and with silent beside them its silent form. const CommandCatalog& catalog = NativeCommands::instance(); for (const char* key : {"project_open", "project_import", "project_save", "project_export", "object_add_primitive", "object_rename", "plate_rename", "object_set_instances", "calibration_generate_test", "preset_import", "preset_export", @@ -277,7 +278,7 @@ TEST_CASE("a call with a tile's arguments asks, and one more argument runs", "[M CHECK_FALSE(person_form(*command, silent)); } } - // The tiles each is called with, by the table: their arguments are a person's form. + // The actions each is called with, by the table: their arguments are a person's form. for (const auto& [key, args] : std::vector>{ {"project_import", {{"archive", true}}}, {"project_save", {{"save_as", true}}}, @@ -288,7 +289,7 @@ TEST_CASE("a call with a tile's arguments asks, and one more argument runs", "[M INFO(key << " " << args.dump()); CHECK(person_form(*catalog.find(key), args)); } - // Where the table's silent form is silent: true, the schema takes it beside the tile's arguments, and the call is + // Where the table's silent form is silent: true, the schema takes it beside the action's arguments, and the call is // valid: the default size of a primitive, a test with its dialog's defaults. for (const auto& [key, args] : std::vector>{{"object_add_primitive", {{"shape", "cube"}}}, {"calibration_generate_test", {{"test", "temperature"}}}}) { @@ -300,23 +301,23 @@ TEST_CASE("a call with a tile's arguments asks, and one more argument runs", "[M silent["silent"] = true; CHECK(argument_error(*command, silent).empty()); // Neither form needs more than the variant; with nothing at all the silent form is refused for it. - json tile = args; - CHECK(argument_error(*command, tile).empty()); + json action = args; + CHECK(argument_error(*command, action).empty()); json none = json::object(); CHECK_FALSE(argument_error(*command, none).empty()); } // silent says what a person's form of the command is: a call with no arguments where that is the only one, else a - // call with a tile's arguments. + // call with an action's arguments. const auto silent_text = [&catalog](const char* key) { return catalog.find(key)->input_schema.at("properties").at("silent").at("description").get(); }; CHECK_THAT(silent_text("project_new"), Catch::Matchers::ContainsSubstring("no arguments")); CHECK_THAT(silent_text("project_export"), !Catch::Matchers::ContainsSubstring("no arguments")); - CHECK_THAT(silent_text("project_export"), Catch::Matchers::ContainsSubstring("tile")); - CHECK_THAT(silent_text("calibration_generate_test"), Catch::Matchers::ContainsSubstring("tile")); + CHECK_THAT(silent_text("project_export"), Catch::Matchers::ContainsSubstring("Speed Dial action")); + CHECK_THAT(silent_text("calibration_generate_test"), Catch::Matchers::ContainsSubstring("Speed Dial action")); } -TEST_CASE("a tile that collects a value takes exactly that argument", "[Mcp][SpeedDial]") +TEST_CASE("an action that collects a value takes exactly that argument", "[Mcp][SpeedDial]") { json given; // what the command's function was last called with NativeCommand view = NativeCommands::ui_command( @@ -328,13 +329,13 @@ TEST_CASE("a tile that collects a value takes exactly that argument", "[Mcp][Spe given = args; return Slic3r::GUI::AppActionRunResult{Slic3r::GUI::AppActionRunResult::Level::Succeeded}; }); - view.tiles = json::array({NativeCommands::tile("view_it_tab", "Go to tab", "Commands", "", json::object(), "Goes to a tab.", "tab"), - NativeCommands::tile("view_it_layer", "Go to layer", "Commands", "", json::object(), "Goes to a layer.", - "percent", "layer_percent"), - NativeCommands::tile("view_it_x", "Along X", "View", "", {{"axis", "x"}}, "Along X.")}); + view.actions = json::array({NativeCommands::action("view_it_tab", "Go to tab", "Commands", "", json::object(), "Goes to a tab.", "tab"), + NativeCommands::action("view_it_layer", "Go to layer", "Commands", "", json::object(), "Goes to a layer.", + "percent", "layer_percent"), + NativeCommands::action("view_it_x", "Along X", "View", "", {{"axis", "x"}}, "Along X.")}); // Go to tab's value is the command's argument of the same name. - const std::unique_ptr tab = NativeCommands::make_action(view, view.tiles[0]); + const std::unique_ptr tab = NativeCommands::make_action(view, view.actions[0]); CHECK(tab->input == "tab"); CHECK(tab->group_en == "Commands"); REQUIRE(tab->input_schema["properties"].size() == 1); @@ -346,25 +347,25 @@ TEST_CASE("a tile that collects a value takes exactly that argument", "[Mcp][Spe tab->run({{"tab", "preview"}}); CHECK(given == json{{"tab", "preview"}}); - // Go to layer's value goes to the command's argument the tile names. - const std::unique_ptr layer = NativeCommands::make_action(view, view.tiles[1]); + // Go to layer's value goes to the command's argument the action names. + const std::unique_ptr layer = NativeCommands::make_action(view, view.actions[1]); CHECK(layer->input == "percent"); REQUIRE(layer->input_schema["properties"].size() == 1); CHECK(layer->input_schema["properties"]["percent"]["type"] == "number"); CHECK(layer->input_schema["required"] == json::array({"percent"})); layer->run({{"percent", 50}}); CHECK(given == json{{"layer_percent", 50}}); - CHECK(tile_call_args(&view.tiles[1], {{"percent", 50}}) == json{{"layer_percent", 50}}); + CHECK(action_call_args(&view.actions[1], {{"percent", 50}}) == json{{"layer_percent", 50}}); // An item made without a group has none, and is in its command's section. - const json grouped_with_command = NativeCommands::tile("view_it_y", "Along Y", "", "", {{"axis", "y"}}, "Along Y."); + const json grouped_with_command = NativeCommands::action("view_it_y", "Along Y", "", "", {{"axis", "y"}}, "Along Y."); CHECK_FALSE(grouped_with_command.contains("group")); CHECK(NativeCommands::make_action(view, grouped_with_command)->group_en == "View"); - // A tile that collects nothing runs its command with its own arguments, and a command's own tile with the call's. - CHECK(tile_call_args(&view.tiles[2], json::object()) == json{{"axis", "x"}}); - CHECK(tile_call_args(nullptr, {{"plate", 2}}) == json{{"plate", 2}}); - CHECK(tile_call_args(nullptr, json::object()) == json::object()); + // An action that collects nothing runs its command with its own arguments, and a command's own action with the call's. + CHECK(action_call_args(&view.actions[2], json::object()) == json{{"axis", "x"}}); + CHECK(action_call_args(nullptr, {{"plate", 2}}) == json{{"plate", 2}}); + CHECK(action_call_args(nullptr, json::object()) == json::object()); } TEST_CASE("Go to tab takes the Device tab as device and any other page by its id", "[Mcp][SpeedDial]") @@ -383,14 +384,14 @@ TEST_CASE("Go to tab takes the Device tab as device and any other page by its id CHECK_FALSE(view_tab_page("no_such_page", pages).has_value()); CHECK_FALSE(view_tab_page("device", {"home", "prepare"}).has_value()); - // The tab picker sends the page's id, which the tile gives view_set as the page's word. - const auto [command, tile] = find_tile(NativeCommands::instance(), "go_to_tab"); + // The tab picker sends the page's id, which the action gives view_set as the page's word. + const auto [command, action] = find_command_action(NativeCommands::instance(), "go_to_tab"); REQUIRE(command != nullptr); - REQUIRE(tile != nullptr); + REQUIRE(action != nullptr); CHECK(command->key == "view_set"); - CHECK(tile_call_args(tile, {{"tab", "monitor"}}) == json{{"tab", "device"}}); - CHECK(tile_call_args(tile, {{"tab", "preview"}}) == json{{"tab", "preview"}}); - CHECK(tile_call_args(tile, {{"tab", "a_plugin_page"}}) == json{{"tab", "a_plugin_page"}}); + CHECK(action_call_args(action, {{"tab", "monitor"}}) == json{{"tab", "device"}}); + CHECK(action_call_args(action, {{"tab", "preview"}}) == json{{"tab", "preview"}}); + CHECK(action_call_args(action, {{"tab", "a_plugin_page"}}) == json{{"tab", "a_plugin_page"}}); // view_set takes a plugin's page by its id. json plugin{{"tab", "a_plugin_page"}}; CHECK(argument_error(*command, plugin).empty()); @@ -413,8 +414,8 @@ TEST_CASE("the filament commands take the filaments they mix, and the slot a del const NativeCommand* mixed = NativeCommands::find("filament_add_mixed"); REQUIRE(mixed != nullptr); CHECK(mixed->listed); - CHECK_FALSE(mixed->in_palette); - CHECK(mixed->tiles.is_null()); + CHECK_FALSE(mixed->has_own_action); + CHECK(mixed->actions.is_null()); CHECK(mixed->input_schema["required"] == json::array({"components", "ratios"})); json half{{"components", json::array({1, 2})}, {"ratios", json::array({50, 50})}}; CHECK(argument_error(*mixed, half).empty()); @@ -430,10 +431,10 @@ TEST_CASE("the filament commands take the filaments they mix, and the slot a del json no_ratios{{"components", json::array({1, 2})}}; CHECK_THAT(argument_error(*mixed, no_ratios), ContainsSubstring("ratios")); - // Delete Filament Slot keeps its tile of its own, which deletes the last physical slot, and takes the slot to merge into. + // Delete Filament Slot keeps an action of its own, which deletes the last physical slot, and takes the slot to merge into. const NativeCommand* remove = NativeCommands::find("filament_delete"); REQUIRE(remove != nullptr); - CHECK(remove->in_palette); + CHECK(remove->has_own_action); CHECK_FALSE(remove->input_schema.contains("required")); json merge{{"filament_slot", 2}, {"merge_into", 1}}; CHECK(argument_error(*remove, merge).empty()); @@ -466,7 +467,7 @@ TEST_CASE("action_run says where an action it cannot find is", "[Mcp][SpeedDial] { CHECK_THAT(unknown_action("obj_arange", NativeCommands::instance()), Catch::Matchers::ContainsSubstring("action_search")); #ifdef SLIC3R_CAD - // A Design tab tile, by its id or its key, while it is not shown: in a run with the CAD feature on at startup + // A Design tab action, by its id or its key, while it is not shown: in a run with the CAD feature on at startup // tool_call runs its command from any tab, and in one with it off there is no such command. for (const bool cad : {true, false}) { CommandCatalog catalog; @@ -479,23 +480,23 @@ TEST_CASE("action_run says where an action it cannot find is", "[Mcp][SpeedDial] CHECK_THAT(why, Catch::Matchers::ContainsSubstring("while the Design tab is shown")); CHECK_THAT(why, Catch::Matchers::ContainsSubstring("tool_call {\"tool\": \"shell\"}")); } else { - CHECK(why == id + " is a Design tab tile, and the CAD feature was off when OrcaSlicer started: a person " + CHECK(why == id + " is a Design tab action, and the CAD feature was off when OrcaSlicer started: a person " "turns it on in Preferences > Features and restarts OrcaSlicer, or starts it with " "--cad"); } } - // A folded item's tile names the call of its command that runs it; with the feature off at startup, there is - // neither, as for any other tile. + // A folded item's action names the call of its command that runs it; with the feature off at startup, there is + // neither, as for any other action. const std::string folded = "orca_command:sk_array:orca"; INFO(folded << (cad ? ", the CAD feature on" : ", the CAD feature off")); if (cad) CHECK_THAT(unknown_action(folded, catalog), Catch::Matchers::ContainsSubstring("tool_call {\"tool\": \"sketch_pattern\", \"args\": {\"type\": \"linear\"}}")); else - CHECK(unknown_action(folded, catalog) == folded + " is a Design tab tile, and the CAD feature was off when OrcaSlicer " + CHECK(unknown_action(folded, catalog) == folded + " is a Design tab action, and the CAD feature was off when OrcaSlicer " "started: a person turns it on in Preferences > Features and restarts " "OrcaSlicer, or starts it with --cad"); - // A Design command without a tile is any unknown action. + // A Design command with no Speed Dial action is refused as any unknown action is. CHECK_THAT(unknown_action("orca_command:describe_design:orca", catalog), Catch::Matchers::ContainsSubstring("action_search")); } #endif @@ -760,9 +761,9 @@ TEST_CASE("tool_search reads one inventory", "[Mcp]") }; CommandCatalog catalog; catalog.add(command("measure_bed", "Plugins", true, "Measure the bed. In mm.")); - NativeCommand tile = command("measure_tile", "View", false, "Measure what the view shows."); - tile.in_palette = true; - catalog.add(tile); + NativeCommand measure = command("measure_action", "View", false, "Measure what the view shows."); + measure.has_own_action = true; + catalog.add(measure); catalog.add_source( std::make_unique(command("plugin.fixture.measure", "Plugins", false, "Offered by a plugin. Doubles a."))); catalog.seal(); @@ -777,7 +778,7 @@ TEST_CASE("tool_search reads one inventory", "[Mcp]") CHECK(items["measure_bed"]["listed"] == true); CHECK(items["measure_bed"]["summary"] == "Measure the bed."); CHECK_FALSE(items["measure_bed"].contains("input_schema")); - for (const char* unlisted : {"measure_tile", "plugin.fixture.measure"}) { + for (const char* unlisted : {"measure_action", "plugin.fixture.measure"}) { INFO(unlisted); CHECK(items[unlisted]["listed"] == false); CHECK(items[unlisted]["input_schema"]["properties"].contains("a")); @@ -787,18 +788,18 @@ TEST_CASE("tool_search reads one inventory", "[Mcp]") CHECK(found["use"].get().find("tool_call {tool, args}") != std::string::npos); // {tool} describes any of them. - const json described = search_commands(catalog, {{"tool", "measure_tile"}}); + const json described = search_commands(catalog, {{"tool", "measure_action"}}); CHECK(described["listed"] == false); CHECK(described["input_schema"]["properties"].contains("a")); CHECK_THROWS_AS(search_commands(catalog, {{"tool", "measure_nothing"}}), ToolFailure); // group narrows the names and the matches, in any case, a source's commands included. - CHECK(search_commands(catalog, json::object())["names"] == json::array({"measure_bed", "measure_tile", "plugin.fixture.measure"})); + CHECK(search_commands(catalog, json::object())["names"] == json::array({"measure_bed", "measure_action", "plugin.fixture.measure"})); CHECK(search_commands(catalog, {{"group", "PLUGINS"}})["names"] == json::array({"measure_bed", "plugin.fixture.measure"})); - CHECK(search_commands(catalog, {{"group", "view"}})["names"] == json::array({"measure_tile"})); + CHECK(search_commands(catalog, {{"group", "view"}})["names"] == json::array({"measure_action"})); const json in_view = search_commands(catalog, {{"group", "View"}, {"query", "measure"}}); REQUIRE(in_view["items"].size() == 1); - CHECK(in_view["items"][0]["name"] == "measure_tile"); + CHECK(in_view["items"][0]["name"] == "measure_action"); // A group no command has is refused with the groups there are. try { search_commands(catalog, {{"group", "commands"}}); diff --git a/tests/slic3rutils/test_operations.cpp b/tests/slic3rutils/test_operations.cpp index 28683f575b..3d60d6b544 100644 --- a/tests/slic3rutils/test_operations.cpp +++ b/tests/slic3rutils/test_operations.cpp @@ -2207,14 +2207,14 @@ TEST_CASE("the exception list names only commands the catalog has under the rule // scripts/check_operation_calls.py leaves McpToolsCad.cpp out. TEST_CASE("the operations rule leaves the Design group and the read-only commands out", "[Operations]") { - Slic3r::GUI::NativeCommand tile; - tile.key = "shell"; - tile.group = "Design"; - CHECK_FALSE(under_operations_rule(tile)); - tile.group = "Objects"; - CHECK(under_operations_rule(tile)); - tile.read_only = true; - CHECK_FALSE(under_operations_rule(tile)); + Slic3r::GUI::NativeCommand shell; + shell.key = "shell"; + shell.group = "Design"; + CHECK_FALSE(under_operations_rule(shell)); + shell.group = "Objects"; + CHECK(under_operations_rule(shell)); + shell.read_only = true; + CHECK_FALSE(under_operations_rule(shell)); // With the CAD feature on, no Design command is under the rule, and none is on the exception list. Slic3r::GUI::CommandCatalog catalog; diff --git a/tools/mcp/README.md b/tools/mcp/README.md index 862bc5b659..f0444df4e9 100644 --- a/tools/mcp/README.md +++ b/tools/mcp/README.md @@ -118,20 +118,20 @@ reports only that its job is still running. Every `McpError` it raises starts wi (`"extrude: ..."`) and has the original error as its cause. `tool_search {group: "Design"}` names the Design commands, and `tool_search {tool}` gives one's arguments and examples. -## The skill's list of tiles +## The skill's list of actions `gen_skill_reference.py [--check]` writes `skills/orcaslicer-mcp-skills/references/actions.md` in a checkout of the orcaslicer-mcp-skills repository: -the Speed Dial's tiles section by section, from the command reference `tests/data/command_catalog.json` -(`docs/HLSD/mcp-server.md`, "Making a feature reachable"), and before them what the reference says of -particular commands: the Design commands with one form, which needs its value, and the commands of tiles -the tool list does not show. Outside the Design tab a section is a Speed Dial section (a tile's `group`, or -the `tile_group` of a command's own tile), and each tile has a row with its key, its title, the command and -arguments it runs (`project_export {"format": "gcode"}` for Export G-code) and its description. In the -Design section a command has a row of its own when it has a tile of its own (`in_palette`), and each Design -menu item folded into a command follows it as a row with the command's key, the item's title and the -arguments that open its tool (`sketch_pattern` with `{"type": "linear"}` for Linear array). It needs no -running app. With `--check` it writes +the commands' Speed Dial actions section by section, from the command reference +`tests/data/command_catalog.json` (`docs/HLSD/mcp-server.md`, "Making a feature reachable"), and before them +what the reference says of particular commands: the Design commands with one form, which needs its value, +and the commands of actions the tool list does not show. Outside the Design tab a section is a Speed Dial +section (an action's `group`, or the `action_group` of a command's own action), and each action has a row +with its key, its title, the command and arguments it runs (`project_export {"format": "gcode"}` for Export +G-code) and its description. In the Design section a command has a row of its own when it has an action of +its own (`has_own_action`), and each Design menu item folded into a command follows it as a row with the +command's key, the item's title and the arguments that open its tool (`sketch_pattern` with +`{"type": "linear"}` for Linear array). It needs no running app. With `--check` it writes nothing, prints the difference and exits 1 when the file is not what it would write. When a command changed, regenerate the reference first: run `slic3rutils_tests "[Reference]"` with `ORCA_UPDATE_COMMAND_REFERENCE=1` in the environment. @@ -180,9 +180,9 @@ the run that outlives its reply budget runs with the budget capped at 4 s (`ORCA `test_plugin_tools.py` checks a plugin's calls into the tools in the running app: it side-loads `tests/plugins/mcp_tools_fixture` into a fresh data folder and launches twice: over MCP, with the Design tab on (its operation is in the group Plugins, reached through `tool_search` and `tool_call` and out of -`tools/list`; a menu item's command is found among `tool_search`'s commands with its schema and its tile not -among its actions, and `tool_call` runs it; a group is a place's heading, in any case; a Design command is -found there too, in no section of its own; calls from its Script worker +`tools/list`; a menu item's command is found among `tool_search`'s commands with its schema and its Speed Dial +action is not among the actions it lists, and `tool_call` runs it; a group is a place's heading, in any case; a +Design command is found there too, in no section of its own; calls from its Script worker and a thread it starts reach the tools, an auto-answer rule it sets is the plugin's, `replay_export` is refused, nothing it calls is journaled, a script that finds its progress dialog handle can use it, `tests/plugins/mcp_tools_broken`, whose load fails, offers none of its operations, and unticking the @@ -341,13 +341,13 @@ does not take), `preset_changes: "keep"` keeping an edit, and `project_new` drop starts from the harness's default printer and reruns on the same datadir. `tests/ops_*.json` drive each operation of the operations layer (`docs/HLSD/mcp-server.md`, "The -operations layer") through the routes that reach it: the command, a Speed Dial tile run with `action_run` +operations layer") through the routes that reach it: the command, a Speed Dial action run with `action_run` where one runs it from a call, and, for presets, a pick in the sidebar and the plugin API called from a `script_run` step. One replay per operation, named after it: G-code, sliced 3MF, model 3MF and STL exports, a model import, a project opened, started anew and saved, a plate selected and locked, arrange, slice, the Preview's layer range, a printer or process preset selected (`ops_select_preset`), a filament assigned to a slot on a printer with one slot and with several (`ops_assign_filament_preset_one_slot`, -`_multi_slot`), presets imported, an object's instance count, and the refusals of `printer_send`'s tile, +`_multi_slot`), presets imported, an object's instance count, and the refusals of `printer_send`'s action, whose id is `send_gcode`, which never sets a print host, so nothing is sent. Each records what a call leaves: its reply or its refusal's text, the state read back after it, and the undo snapshots it took, which `tests/fixtures/ops_undo.py` reads from the app's log since no tool lists the undo history. Their @@ -361,9 +361,9 @@ need a fresh `--out`, since some of those calls write without `overwrite`. Launc holds no `.py` files, since the app's working directory is on Python's module path and a file there can shadow a standard module that `script_run` needs. -`test_operation_routes.py` asserts what those replays only record: that a command, a Speed Dial tile that +`test_operation_routes.py` asserts what those replays only record: that a command, a Speed Dial action that runs it and the plugin API's binding refuse the same states with the same code and words, and accept the -same ones: a layer asked of a Preview with none (the Go to layer tile and `view_set`), a mixed-colour +same ones: a layer asked of a Preview with none (the Go to layer action and `view_set`), a mixed-colour filament slot, and a hidden printer selected through the plugin API. It also checks what a command refuses or does in those states alone: a project saved under a `.gcode.3mf` name, the exports of a project with no objects, and an arrangement from the assemble view and with a gizmo open. Run @@ -437,7 +437,7 @@ constraints, loops and degrees of freedom; `sketch_edit` and its replace, cancel `sketch_project` with and without an open sketch, `sketch_text`, `sketch_insert_svg` and Scale artwork; `feature_edit`'s `refs` and a card's picks while it edits a feature; `view_set`'s Design options; `select_geometry`, `confirm_tool`, `cancel_tool` and `body_place`; the Boolean card a call opens; and a -pick of a folded item's tile from the Speed Dial, and its replay. Its docstring lists the rungs. +pick of a folded item's action from the Speed Dial, and its replay. Its docstring lists the rungs. Three more harness tests on a `--cad` instance drive the Design tab the way a person does. Every action goes through the UI tools (`view_set`, `widget_click`, `mouse_gesture`, `keyboard_press`, `widget_set_value`, @@ -518,7 +518,7 @@ kind of page control, action and what it changed on its page, refusal, locator, the pages of a fixture plugin, in a modal dialog, a modeless window, a dock panel and the Plugins dialog's configuration frame, a token in a page's URL shown redacted, and the permission prompt the plugin's thread opens, answered with `dialog_answer` and with a rule registered while it is open, and the -plugin's page among the main window's tabs, which the Go to tab tile shows by its id. +plugin's page among the main window's tabs, which the Go to tab action shows by its id. Side-load the plugin into the datadir first: ```bash @@ -591,7 +591,7 @@ the update a setting change scheduled, and checks that it never starts. `test_re uses ImGui refs after their items changed (the Text gizmo's font button, whose label shows the font, and a Texture Displacement layer row renamed by its place when a layer before it goes) and checks that the exported session replays. `test_worker_admission.py` starts a long arrange three ways -(`object_arrange` with arguments, `action_run` of its Auto-Arrange tile, whose id is `obj_arrange`, a click on +(`object_arrange` with arguments, `action_run` of its Auto-Arrange action, whose id is `obj_arrange`, a click on the Arrange options panel's button) and checks that changes, canvas keys and toolbar clicks are refused while it runs, reads answer, and `job_cancel` stops it. `test_export_running_job.py` exports while a call's job runs past @@ -599,20 +599,20 @@ its reply budget (left out, named in `left_out_running`), after it ends (an `awa replays) and while a dialog holds its call (kept); it takes about 100 s, or about 45 s with the reply budget capped at 10 s by `ORCA_MCP_REPLY_BUDGET_MS=10000` for the app and the test, as the sweep runs it. `test_send_gcode.py` starts an OctoPrint-compatible stub host and sends a sliced cube to it with -`printer_send`'s Speed Dial tile, `send_gcode`, the Send dialog answered with `widget_set_value` and `dialog_answer`: the -tile is refused for a Bambu network printer and one without a print host, an upload the stub accepts +`printer_send`'s Speed Dial action, `send_gcode`, the Send dialog answered with `widget_set_value` and `dialog_answer`: the +action is refused for a Bambu network printer and one without a print host, an upload the stub accepts reads uploading at 99 until the stub answers and then completed in `app_state.uploads`, its exported replay uploads again, and one the stub refuses with HTTP 500 never reads completed and ends as an error whose dialog `dialog_answer` closes. -`tests/tiles_ask.json` and `test_person_forms.py` check a call with exactly a tile's arguments, which may ask -as a person's pick of the tile does: `calibration_generate_test {test}` asks in the test's dialog and with +`tests/actions_ask.json` and `test_person_forms.py` check a call with exactly an action's arguments, which may +ask as a person's pick of the action does: `calibration_generate_test {test}` asks in the test's dialog and with `silent` runs with its defaults, View: Top turns the Design tab's camera, Go to tab and Go to layer take their -value through `action_run`, and the slice tiles slice and show the Preview tab (the replay, on an instance +value through `action_run`, and the slice actions slice and show the Preview tab (the replay, on an instance launched with `--cad`); `project_save {save_as: true}` and `project_export {format: gcode}` open their file pickers while a path writes without one, `preset_export` always opens its dialog, `object_arrange {}` and -`object_select {all: true}` (and `action_run` of their tiles) reply as their commands do, the selection in the -assemble view's too, and the Speed Dial's own picks of a view tile, Deselect All, Go to layer, Auto-Arrange and +`object_select {all: true}` (and `action_run` of their actions) reply as their commands do, the selection in the +assemble view's too, and the Speed Dial's own picks of a view action, Deselect All, Go to layer, Auto-Arrange and Select All Objects run in place (the script). `test_project_open_settings.py` launches its own app, whose Preferences load a project's geometry only, and checks that `project_open` loads the settings a project was saved with all the same. @@ -640,12 +640,12 @@ on a fresh data folder and printers the sweep does not seed: `test_install_print `test_printer_extruders.py` (a printer of two extruders) and `test_sidebar_floating.py` (`view_set`'s `sidebar_width` refused while the sidebar floats). -`test_every_tile.py` runs each of the 129 Speed Dial tiles of `tests/data/speed_dial_tiles.json` through +`test_every_action.py` runs each of the 129 Speed Dial actions of `tests/data/speed_dial_actions.json` through `action_run`, each from a state its table sets up afresh, answers the dialog or file picker it opens, and reads what -its menu item's job leaves: a change only that tile makes, the window it opens, the file it writes, or the refusal of a -tile that needs a printer or an account. It also checks the reply's `ran` and the step `replay_export` keeps against -`tests/data/speed_dial_tile_calls.json`. Its web-page and configuration-folder tiles hand over to the system's -browser and file manager, so the sweep runs it on its own. +its menu item's job leaves: a change only that action makes, the window it opens, the file it writes, or the refusal +of an action that needs a printer or an account. It also checks the reply's `ran` and the step `replay_export` keeps +against `tests/data/speed_dial_action_calls.json`. Its web-page and configuration-folder actions hand over to the +system's browser and file manager, so the sweep runs it on its own. ## The sweep diff --git a/tools/mcp/gen_skill_reference.py b/tools/mcp/gen_skill_reference.py index 58749dc638..b4edfef7df 100644 --- a/tools/mcp/gen_skill_reference.py +++ b/tools/mcp/gen_skill_reference.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Write the skill's list of the Speed Dial's tiles from the command reference. +"""Write the skill's list of the commands' Speed Dial actions from the command reference. python tools/mcp/gen_skill_reference.py # rewrite actions.md python tools/mcp/gen_skill_reference.py --check # exit 1 when it differs @@ -7,15 +7,15 @@ Reads tests/data/command_catalog.json, the reference of the command catalog that the unit test "the checked-in command reference matches the catalog" keeps current, and writes skills/orcaslicer-mcp-skills/references/actions.md in the checkout of the orcaslicer-mcp-skills -repository: every tile a person can pick, section by section in the order the catalog adds them. -Outside the Design tab a section is a Speed Dial section (a tile's group, or the tile_group of a -command's own tile), and each tile has a row with its key, its title, the command and arguments it -runs and its description. In the Design section a command with a tile of its own (in_palette) has a -row with its key, title, arguments and description, and each Design menu item folded into a command -(its tiles) a row after it, with the command's key, the tile's title, the arguments that open it and -its description. The file is generated: edit the commands in OrcaSlicer and regenerate it. A header -that names a command the reference does not have is an error, so that a renamed or removed command -cannot leave it stale. Standard library only. +repository: every action a person can pick, section by section in the order the catalog adds them. +Outside the Design tab a section is a Speed Dial section (an action's group, or the action_group of +a command's own action), and each action has a row with its key, its title, the command and +arguments it runs and its description. In the Design section a command with an action of its own +(has_own_action) has a row with its key, title, arguments and description, and each Design menu item +folded into a command (its actions) a row after it, with the command's key, the action's title, the +arguments that open it and its description. The file is generated: edit the commands in OrcaSlicer +and regenerate it. A header that names a command the reference does not have is an error, so that a +renamed or removed command cannot leave it stale. Standard library only. """ import argparse @@ -37,38 +37,38 @@ HEADER = """\ Generated by OrcaSlicer's `tools/mcp/gen_skill_reference.py` from its command reference (`tests/data/command_catalog.json`); do not edit it by hand. -These are the tiles a person picks in the Speed Dial, by section. Each runs a command with the arguments +These are the actions a person picks in the Speed Dial, by section. Each runs a command with the arguments its row gives. Call the command by its name, with those arguments or others, and one the tool list does not show with `tool_call {"tool": "", "args": {...}}`; `tool_search {"tool": ""}` gives its whole -schema, and its examples when it has some. `action_run {"id": ""}` runs a tile as a call with the -tile's arguments does. Action Replay, Run Script, Take Screenshot and the calibration dialogs have a command +schema, and its examples when it has some. `action_run {"id": ""}` runs an action as a call with the +action's arguments does. Action Replay, Run Script, Take Screenshot and the calibration dialogs have a command for agents (`replay_run`, `script_run`, `window_screenshot`, `calibration_generate_test`); the wiki and YouTube links, About, the plugin hub and the configuration folder (`app_open_web_page`, `window_open {"window": "about"}`, `app_show_config_folder`) are left to the person. -A call with exactly a tile's arguments is the tile's own call: where the tile asks in a dialog, the call opens -it, which it reports as `blocked_by_dialog`, and where the tile acts on the selection, so does the call. A -tile whose menu item does what its command does (a camera view, Select All, Deselect All, Auto-Arrange, +A call with exactly an action's arguments is the action's own call: where the action asks in a dialog, the call +opens it, which it reports as `blocked_by_dialog`, and where the action acts on the selection, so does the call. +An action whose menu item does what its command does (a camera view, Select All, Deselect All, Auto-Arrange, Auto-Orient, Refresh Plugins) runs the command's own function and replies as the command does. Any other arguments, or `silent: true` where the schema has `silent`, run the command without asking, with the arguments its schema marks required. Go to tab and Go to layer collect their value in the Speed Dial: `action_run` gives -such a tile its one value (`{"tab": "preview"}`, `{"percent": 50}`), and the command takes it as the argument +such an action its one value (`{"tab": "preview"}`, `{"percent": 50}`), and the command takes it as the argument its row names. A command whose dialog is what it does opens it with arguments too (`preset_export {"path": "/abs/dir"}` only spares it the folder question). -The Design section lists the Design tab's commands that have a tile; `tool_search {"group": "Design"}` lists +The Design section lists the Design tab's commands that have an action; `tool_search {"group": "Design"}` lists them all, and `references/cad.md` covers them. They run only with the CAD feature on, which a person turns on in Preferences > Features before restarting OrcaSlicer: `app_state.design_tab` says whether the Design tab is on, and `cad_note`, while its commands cannot run, how to turn it on (a test instance gets it with -`tools/mcp/orca_mcp.py launch --cad`). A Design tile is in the Speed Dial, and `action_run` runs it, only while -the Design tab is shown in the tile's mode (in a sketch or outside one); `tool_call` runs its command from any -tab. Called with no arguments, a tile's command does what its right-click menu item does, which may be to act -at once (a Delete item deletes what is selected) or to decline. +`tools/mcp/orca_mcp.py launch --cad`). A Design tab action is in the Speed Dial, and `action_run` runs it, only +while the Design tab is shown in the action's mode (in a sketch or outside one); `tool_call` runs its command +from any tab. Called with no arguments, an action's command does what its right-click menu item does, which may +be to act at once (a Delete item deletes what is selected) or to decline. A Design row whose arguments are written as a call's own (`{"type": "linear"}`, or `{}`) is one tool of its -command: `tool_call` given exactly those arguments opens that tool, as a person's pick of its tile does, and any -other call runs the command from its arguments. The tile has an id of its own, which `action_search` gives, and -`action_run` runs it with no arguments or with exactly those. +command: `tool_call` given exactly those arguments opens that tool, as a person's pick of its action does, and +any other call runs the command from its arguments. The action has an id of its own, which `action_search` +gives, and `action_run` runs it with no arguments or with exactly those. """ # The words HEADER writes in backticks that name no command: an argument, a reply's status and a field. @@ -119,9 +119,10 @@ def names(commands): def header(design, unlisted): - """HEADER, with what it says of particular commands read from the reference: the Design commands with a tile of - their own that need a value (a top-level `required`), and the commands of tiles the tool list does not show.""" - needs = [c for c in design if c["in_palette"] and c["input_schema"].get("required")] + """HEADER, with what it says of particular commands read from the reference: the Design commands with an action + of their own that need a value (a top-level `required`), and the commands of actions the tool list does not + show.""" + needs = [c for c in design if c["has_own_action"] and c["input_schema"].get("required")] facts = [] if needs: facts.append("%s %s." % (names(needs), "needs its value" if len(needs) == 1 else "need their value")) @@ -133,12 +134,12 @@ def header(design, unlisted): return HEADER + "\n" + "\n".join(textwrap.wrap(" ".join(facts), width=110)) + "\n" -def runs(command, tile): - """The call a tile runs: its command with the tile's arguments, and the value an input tile collects under the - argument that takes it.""" - args = json.dumps(tile["args"]) if tile else "{}" - if tile and tile.get("input"): - args = '{"%s": <%s>}' % (tile.get("input_arg") or tile["input"], tile["input"]) +def runs(command, action): + """The call an action runs: its command with the action's arguments, and the value an input action collects + under the argument that takes it.""" + args = json.dumps(action["args"]) if action else "{}" + if action and action.get("input"): + args = '{"%s": <%s>}' % (action.get("input_arg") or action["input"], action["input"]) return "`%s %s`" % (command["key"], args) @@ -148,26 +149,27 @@ def row(key, title, args, does): def render(reference): - # A command is in the palette with a tile of its own, or through the tiles folded into it. Outside the Design tab - # each tile is a row of its Speed Dial section; a Design command's rows stay together in the Design section. - palette = [command for command in reference["commands"] if command["in_palette"] or command.get("tiles")] + # A command is in the Speed Dial with an action of its own, or through the actions folded into it. Outside the + # Design tab each action is a row of its Speed Dial section; a Design command's rows stay together in the Design + # section. + in_speed_dial = [command for command in reference["commands"] if command["has_own_action"] or command.get("actions")] sections = {} - for c in palette: + for c in in_speed_dial: if c["group"] == DESIGN: rows = sections.setdefault(DESIGN, []) - if c["in_palette"]: + if c["has_own_action"]: rows.append(row(c["key"], c["title"], arguments(c["input_schema"]), c["description"])) - for tile in c.get("tiles", []): - rows.append(row(c["key"], tile["title"], "`%s`" % json.dumps(tile["args"]), tile["description"])) + for action in c.get("actions", []): + rows.append(row(c["key"], action["title"], "`%s`" % json.dumps(action["args"]), action["description"])) continue - if c["in_palette"]: - sections.setdefault(c.get("tile_group") or c["group"], []).append(row(c["key"], c["title"], runs(c, None), - c["description"])) - for tile in c.get("tiles", []): - sections.setdefault(tile.get("group") or c["group"], []).append(row(tile["key"], tile["title"], runs(c, tile), - tile["description"])) - unlisted = [c for c in palette if c["group"] != DESIGN and not c["listed"]] - out = [header([c for c in palette if c["group"] == DESIGN], unlisted)] + if c["has_own_action"]: + sections.setdefault(c.get("action_group") or c["group"], []).append(row(c["key"], c["title"], runs(c, None), + c["description"])) + for action in c.get("actions", []): + sections.setdefault(action.get("group") or c["group"], []).append( + row(action["key"], action["title"], runs(c, action), action["description"])) + unlisted = [c for c in in_speed_dial if c["group"] != DESIGN and not c["listed"]] + out = [header([c for c in in_speed_dial if c["group"] == DESIGN], unlisted)] for section, rows in sections.items(): columns = "arguments" if section == DESIGN else "runs" out.append("\n## %s\n\n| key | title | %s | does |\n|---|---|---|---|\n" % (section, columns)) diff --git a/tools/mcp/sweep.json b/tools/mcp/sweep.json index cc578eae1d..3cd2af371f 100644 --- a/tools/mcp/sweep.json +++ b/tools/mcp/sweep.json @@ -52,7 +52,7 @@ "scene": {"path": "tests/scene.json"}, "settings_targets": {"path": "tests/settings_targets.json"}, "slice_stats": {"path": "tests/slice_stats.json"}, - "tiles_ask": {"path": "tests/tiles_ask.json", "cad": true}, + "actions_ask": {"path": "tests/actions_ask.json", "cad": true}, "view_switches": {"path": "tests/view_switches.json"}, "web_dialogs": {"path": "tests/web_dialogs.json"}, "test_action_replay_hidden": {"path": "test_action_replay_hidden.py"}, @@ -67,7 +67,7 @@ "test_cad_slow_build": {"path": "test_cad_slow_build.py", "cad": true}, "test_cancel_pending_slice": {"path": "test_cancel_pending_slice.py"}, "test_command_line": {"path": "test_command_line.py", "launch": "own", "args": ["--bin", "{bin}"], "locks": ["port-13694"], "why": "both serve on the fixed port 13694"}, - "test_every_tile": {"path": "test_every_tile.py", "exclusive": true, "why": "its tiles open web pages in the system's browser and the configuration folder in the file manager, which take the focus from the other instances"}, + "test_every_action": {"path": "test_every_action.py", "exclusive": true, "why": "its actions open web pages in the system's browser and the configuration folder in the file manager, which take the focus from the other instances"}, "test_export_running_job": {"path": "test_export_running_job.py", "env": {"ORCA_MCP_REPLY_BUDGET_MS": "10000"}}, "test_install_filaments": {"path": "test_install_filaments.py", "launch": "own", "args": ["--bin", "{bin}"]}, "test_install_printers": {"path": "test_install_printers.py", "launch": "own", "args": ["--bin", "{bin}"]}, diff --git a/tools/mcp/test_additions_refusals.py b/tools/mcp/test_additions_refusals.py index 355218ca26..7fa956a971 100644 --- a/tools/mcp/test_additions_refusals.py +++ b/tools/mcp/test_additions_refusals.py @@ -4,13 +4,14 @@ tools/mcp/orca_mcp.py launch tools/mcp/test_additions_refusals.py -preset_sync while signed out is refused, and so is filament_sync_ams, as its tile and with each mode, with no printer -connected. view_set of a layer on a plate with no slice is refused, and leaves the legend's -fold and the G-code window, given beside it, as they were. project_export of each object as its own STL, as its tile and with a folder, -is refused for a project with no objects, and of the toolpaths as an OBJ while the Preview shows none; a pick of either -tile from the Speed Dial (Space on the 3D view, the search field, a click on the tile) shows the refusal as a notice and -opens no dialog. project_import of an entry a ZIP archive lacks is refused with the names the archive has, and imports -nothing (the archive is written by tests/fixtures/filaments_and_files.py, in the configuration folder). +preset_sync while signed out is refused, and so is filament_sync_ams, as its Speed Dial action and with each mode, with +no printer connected. view_set of a layer on a plate with no slice is refused, and leaves the legend's fold and the +G-code window, given beside it, as they were. project_export of each object as its own STL, as its Speed Dial action +and with a folder, is refused for a project with no objects, and of the toolpaths as an OBJ while the Preview shows +none; a pick of either action from the Speed Dial (Space on the 3D view, the search field, a click on its row) shows +the refusal as a notice and opens no dialog. project_import of an entry a ZIP archive lacks is refused with the names +the archive has, and imports nothing (the archive is written by tests/fixtures/filaments_and_files.py, in the +configuration folder). On a cube with a modifier and two height ranges, settings_set of layer_height on the modifier, and settings_get of it, are refused naming where it is set (an object or a height range); settings_set of a null layer_height on a height range @@ -87,7 +88,7 @@ def main(): return len(client.call("app_state")["presets"]["filaments"]) def dial_pick(title): - """Opens the Speed Dial on the shown 3D view and picks the tile titled `title`, as a person's click does.""" + """Opens the Speed Dial on the shown 3D view and picks the action titled `title`, as a person's click does.""" client.call("keyboard_press", keys="space", target=CANVAS) client.call("widget_set_value", target={"web": "Search actions"}, value=title, submit=False) return client.call("widget_click", target={"web": f"{title} from Orcaslicer", "kind": "button"}) @@ -124,7 +125,7 @@ def main(): # ---- Exports of a project with no objects, and of toolpaths the Preview does not show ---- check("the project has no objects", client.call("object_list").get("total") == 0) - refused("project_export of each object as an STL, as its tile, is refused for a project with no objects", "project_export", + refused("project_export of each object as an STL, as its action, is refused for a project with no objects", "project_export", {"format": "stl", "per_object": True}, "no objects", "no_objects") folder = tempfile.mkdtemp(prefix="per_object_") refused("project_export of each object as an STL into a folder is refused for a project with no objects", "project_export", diff --git a/tools/mcp/test_cad_commands.py b/tools/mcp/test_cad_commands.py index e2b83c41f3..9587765cc1 100644 --- a/tools/mcp/test_cad_commands.py +++ b/tools/mcp/test_cad_commands.py @@ -92,10 +92,10 @@ where it stands. place_follows deletes the feature that made the first of two pl placement as it becomes body 0, a box added afterwards has none, and undo brings the first back where it stood. boolean_opens calls boolean {} and boolean {operation: "cut"} with two bodies and nothing selected: each replies that a tool is open, and the card it opened, confirmed with confirm_tool, adds a join and a cut; with target and tool the -cut runs. tile_pick opens the Speed Dial in a sketch with a line selected and picks the Polar array tile, an item folded -into sketch_pattern, which arms the polar array tool, and the Trim tile, sketch_trim's own, which arms the trim tool. -tile_replay runs the Polar array tile with action_run, exports the session, whose step carries the item's arguments -{"type": "circular"}, and replays it in a new project to the same armed tool. +cut runs. action_pick opens the Speed Dial in a sketch with a line selected and picks the Polar array action, an item +folded into sketch_pattern, which arms the polar array tool, and the Trim action, sketch_trim's own, which arms the trim +tool. action_pick_replay runs the Polar array action with action_run, exports the session, whose step carries the +item's arguments {"type": "circular"}, and replays it in a new project to the same armed tool. """ import json @@ -1857,7 +1857,7 @@ def rung_boolean_opens(): def dial_pick(title): - """Opens the Speed Dial on the Design view and picks the tile titled `title` from it, as a person's click does.""" + """Opens the Speed Dial on the Design view and picks the action titled `title` from it, as a person's click does.""" gui.keys("space", target=CANVAS) gui.client.call("widget_set_value", target={"web": "Search actions"}, value=title, submit=False) return gui.client.call("widget_click", target={"web": f"{title} from Orcaslicer", "kind": "button"}) @@ -1871,42 +1871,44 @@ def line_selected(): gui.cad("sketch_select", entities=[0]) -def rung_tile_pick(): - # A pick from the Speed Dial runs its tile's action: a folded item's with the item's arguments, a merged item's as its - # command's own tile. +def rung_action_pick(): + # A pick from the Speed Dial runs the action picked: a folded item's action with the item's arguments, a merged + # item's as its command's own action. line_selected() dial_pick("Polar array") - gui.check("tile_pick: the Polar array tile arms the polar array tool", gui.sketch()["tool"] == "array_polar", + gui.check("action_pick: the Polar array action arms the polar array tool", gui.sketch()["tool"] == "array_polar", gui.sketch()["tool"]) gui.keys("Escape", target=CANVAS) dial_pick("Trim") - gui.check("tile_pick: the Trim tile arms the trim tool", gui.sketch()["tool"] == "trim", gui.sketch()["tool"]) + gui.check("action_pick: the Trim action arms the trim tool", gui.sketch()["tool"] == "trim", gui.sketch()["tool"]) gui.cad("sketch_cancel") -def rung_tile_replay(): - # action_run of a folded item's tile is journaled with the item's arguments, so the exported session replays the pick. +def rung_action_pick_replay(): + # action_run of a folded item's action is journaled with the item's arguments, so the exported session replays the + # pick. gui.new_design() gui.client.call("replay_export", clear=True) gui.cad("sketch_create", plane="XY") gui.cad("sketch_draw", type="line", p0=[0, 0], p1=[10, 0]) gui.cad("sketch_select", entities=[0]) r = gui.client.call("action_run", id="sk_array_polar") - gui.check("tile_replay: action_run of the Polar array tile opens its tool", r.get("result", {}).get("interactive") is True, r) - gui.check("tile_replay: it arms the polar array tool", gui.sketch()["tool"] == "array_polar", gui.sketch()["tool"]) - out_dir = tempfile.mkdtemp(prefix="orca-mcp-tile-replay-") + gui.check("action_pick_replay: action_run of the Polar array action opens its tool", + r.get("result", {}).get("interactive") is True, r) + gui.check("action_pick_replay: it arms the polar array tool", gui.sketch()["tool"] == "array_polar", gui.sketch()["tool"]) + out_dir = tempfile.mkdtemp(prefix="orca-mcp-action-pick-replay-") path = os.path.join(out_dir, "session.json") gui.client.call("replay_export", path=path, overwrite=True) picks = [s for s in steps_of(path) if s["tool"] == "action_run"] - gui.check("tile_replay: the export keeps the pick with the item's arguments", + gui.check("action_pick_replay: the export keeps the pick with the item's arguments", len(picks) == 1 and picks[0]["args"].get("id") == "orca_command:sk_array_polar:orca" and picks[0]["args"].get("args") == {"type": "circular"}, picks) gui.cad("sketch_cancel") gui.client.call("project_new", discard_changes=True) replay = gui.client.await_job(gui.client.call("replay_run", path=path, out_dir=out_dir), timeout=900) - gui.check("tile_replay: the exported session replays", replay.get("passed") is True, + gui.check("action_pick_replay: the exported session replays", replay.get("passed") is True, [s for s in replay.get("steps", []) if not s.get("ok")][:1]) - gui.check("tile_replay: the replayed pick arms the polar array tool", gui.sketch()["tool"] == "array_polar", + gui.check("action_pick_replay: the replayed pick arms the polar array tool", gui.sketch()["tool"] == "array_polar", gui.sketch()["tool"]) gui.cad("sketch_cancel") gui.show_design() @@ -1927,8 +1929,8 @@ RUNGS = {"words": rung_words, "shapes_match_tools": rung_shapes_match_tools, "sk "text_dialog": rung_text_dialog, "confirm_nothing": rung_confirm_nothing, "confirm_disabled": rung_confirm_disabled, "confirm_refused_add": rung_confirm_refused_add, "confirm_failed_add": rung_confirm_failed_add, "place": rung_place, "place_select": rung_place_select, - "place_follows": rung_place_follows, "boolean_opens": rung_boolean_opens, "tile_pick": rung_tile_pick, - "tile_replay": rung_tile_replay} + "place_follows": rung_place_follows, "boolean_opens": rung_boolean_opens, "action_pick": rung_action_pick, + "action_pick_replay": rung_action_pick_replay} def main(): diff --git a/tools/mcp/test_every_tile.py b/tools/mcp/test_every_action.py similarity index 88% rename from tools/mcp/test_every_tile.py rename to tools/mcp/test_every_action.py index ae3236ec18..5ec31ff46a 100644 --- a/tools/mcp/test_every_tile.py +++ b/tools/mcp/test_every_action.py @@ -1,22 +1,23 @@ #!/usr/bin/env python3 -"""Runs every Speed Dial tile of tests/data/speed_dial_tiles.json through action_run and checks that it does its row's -job: the change its variant alone makes, the window it opens, the file it writes, or the refusal of a tile this harness -cannot give a state to (a printer, an AMS, an account). +"""Runs every Speed Dial action of tests/data/speed_dial_actions.json through action_run and checks that it does its +row's job: the change its variant alone makes, the window it opens, the file it writes, or the refusal of an action this +harness cannot give a state to (a printer, an AMS, an account). tools/mcp/orca_mcp.py launch - tools/mcp/test_every_tile.py [--out DIR] + tools/mcp/test_every_action.py [--out DIR] -ROWS holds one row per tile key; a key of the tiles file with no row, or a row of a key the file lacks, fails the test. -Before each tile its state is set up afresh by calls (STATES), so that no tile sees what another left: New Project and -Delete All among them. A row's dialog is answered as the row says: a button of one of the app's own dialogs, a text -typed into it first, or a rule for a native file picker registered beforehand, with a file in the output folder. +ROWS holds one row per action key; a key of the actions file with no row, or a row of a key the file lacks, fails the +test. Before each action its state is set up afresh by calls (STATES), so that no action sees what another left: New +Project and Delete All among them. A row's dialog is answered as the row says: a button of one of the app's own +dialogs, a text typed into it first, or a rule for a native file picker registered beforehand, with a file in the +output folder. -For every tile that ran, the reply's ran is the tile's id, and the step replay_export writes for the call is the tile's -action_run with the arguments of tests/data/speed_dial_tile_calls.json (for Go to tab and Go to layer the value under -the tile's input token), the tile naming the fixture's command in action_search. A tile expected to be refused has -neither: action_run adds ran only when the command ran, and a failed call is not exported. +For every action that ran, the reply's ran is the action's id, and the step replay_export writes for the call is an +action_run of that id with the arguments of tests/data/speed_dial_action_calls.json (for Go to tab and Go to layer the +value under the action's input token), the action naming the fixture's command in action_search. An action expected to +be refused has neither: action_run adds ran only when the command ran, and a failed call is not exported. -Three tiles open a web page in the system's browser and one opens the configuration folder in the file manager; the +Three actions open a web page in the system's browser and one opens the configuration folder in the file manager; the test runs them once and leaves what they opened. Send G-code, Synchronize Filament List from AMS and Sync Presets are expected to be refused: the seeded printer prints through the Bambu network and nothing is signed in. Import, Import Configs and SVG open a file picker that dialog_auto_answer cannot give a file (a multi-select picker, and one whose @@ -24,7 +25,7 @@ caller reads GetPaths()): the rule cancels it, and the row checks that the picke dialogs whose choices are a person's (Export Preset Bundle, the Setup Wizard, the Network Test) are closed. Every file the test writes is in its output folder (a new temporary folder unless --out names one) or in the app's configuration folder; Start Recording's folder, where Take Screenshot saves too, is set to the output folder through the Start -Recording dialog before the tiles run. Exits 0 when every check passes. +Recording dialog before the actions run. Exits 0 when every check passes. """ import argparse @@ -50,18 +51,18 @@ IMPORTED_PRESET = "MCP Import PLA" # the filament fixtures/mcp_import_pla.json LOCAL_PLUGIN, SIDE_LOADED = "MCP Tools Fixture", "MCP Web Fixture" # the fixture plugins' names, from their manifests -def tile_id(key): +def action_id(key): return PREFIX + key + SUFFIX class Run: - """The client, the output folder and what one tile's checks read.""" + """The client, the output folder and what one action's checks read.""" def __init__(self, client, out, datadir): self.client, self.out, self.datadir = client, out, datadir - self.reply = None # the tile's final reply + self.reply = None # the action's final reply self.before = None # what the row's before() read after the state was set up - self.windows = [] # the titles window_list gave before the tile ran + self.windows = [] # the titles window_list gave before the action ran self.seen = [] # the titles of the dialogs the row's answers found open def call(self, tool, /, **args): @@ -115,12 +116,12 @@ class Run: return [line.split('"')[1] for line in "\n".join(texts).splitlines() if "imgui_window" in line and '"' in line] def new_windows(self): - """The windows the tile opened: those its answers found open, and those still open that were not before.""" + """The windows the action opened: those its answers found open, and those still open that were not before.""" shown = [w["title"] for w in self.call("window_list").get("items", []) if w["title"] not in self.windows] return self.seen + [t for t in shown if t not in self.seen] -# ---- The files the tiles read ---- +# ---- The files the actions read ---- def box(x0, size): """The twelve facets of an axis-aligned cube of `size` mm whose corner is at (x0, 0, 0), as ASCII STL text.""" @@ -132,7 +133,7 @@ def box(x0, size): def write_inputs(out): - """The files the import, open and install tiles pick: an STL of one mesh with two shells, a ZIP holding it, the + """The files the import, open and install actions pick: an STL of one mesh with two shells, a ZIP holding it, the fixture preset, SVG and plugin.""" stl = os.path.join(out, "two_shells.stl") with open(stl, "w") as f: @@ -146,7 +147,7 @@ def write_inputs(out): os.makedirs(os.path.join(out, folder), exist_ok=True) -# ---- States: each set up afresh by calls before its tile ---- +# ---- States: each set up afresh by calls before its action ---- RESTORE = {"match": "restore", "button": "no"} # the prompt to restore unsaved items after a start @@ -250,7 +251,7 @@ STATES = {"empty": empty, "two_cubes": two_cubes, "sliced": sliced, "assembled": # ---- Answers ---- def picker(name): - """A rule for the native file or folder picker the tile opens: it returns `name` in the output folder.""" + """A rule for the native file or folder picker the action opens: it returns `name` in the output folder.""" return ("picker", name) @@ -294,7 +295,7 @@ def app_state(fn): def window(title): - """The tile opened the window or dialog titled `title`, which it had not shown before.""" + """The action opened the window or dialog titled `title`, which it had not shown before.""" return ("window", lambda r: (any(title.lower() in t.lower() for t in r.new_windows()), r.new_windows())) @@ -325,7 +326,7 @@ PATHLESS = "dialog_auto_answer cannot give this picker a file, so its rule cance def picked(unchanged): - """The tile opened its file picker, which the row's rule answered, and with nothing chosen `unchanged` holds.""" + """The action opened its file picker, which the row's rule answered, and with nothing chosen `unchanged` holds.""" def check(r): uses = [rule.get("uses", 0) for rule in r.state().get("auto_answer_rules", []) if rule.get("path")] return uses == [1] and unchanged(r), (uses, r.names()) @@ -393,7 +394,7 @@ LIFTED = call("object_transform", object=0, translate=[0, 0, 15], drop_to_bed=Fa TWO_SLOTS = call("filament_add") ORDER_NAMES = (call("object_rename", object=0, name="b_cube"), call("object_rename", object=1, name="a_cube")) # Three objects in an order that is neither ascending nor descending by height or by size, and whose order by height -# is the reverse of their order by size: a tile that sorts by the other key, or reverses an order it finds sorted +# is the reverse of their order by size: an action that sorts by the other key, or reverses an order it finds sorted # (ObjectList::order_objects()), leaves another order. ORDER_SIZES = (call("object_select", none=True), call("object_add_primitive", shape="cube", silent=True, size=[10, 10, 30], position=[BED_CENTRE, 200, 15]), @@ -420,8 +421,8 @@ CALIBRATIONS = {"temperature": ("Temperature calibration", "Nozzle temperature t "vfa": ("VFA test", "VFA test")} -def dialog_tile(key, title, why=""): - """A Help or window tile whose job is to show one of the app's dialogs, which the test then closes.""" +def dialog_action(key, title, why=""): + """A Help or window action whose job is to show one of the app's dialogs, which the test then closes.""" return row(key, "empty", window(title), answers=[button(title, "close")], why=why) @@ -457,7 +458,7 @@ ROWS = dict([ why="the Run Script panel is kept from automation, so widget_list reads the 3D view it docks under"), row("open_action_replay", "empty", window("Action Replay"), why="Action Replay is the person's window, which no tool closes: it stays open"), - dialog_tile("open_preferences", "Preferences"), + dialog_action("open_preferences", "Preferences"), row("take_screenshot", "two_cubes", ("file", lambda r: (bool(r.reply.get("path")) and os.path.isfile(r.reply["path"]) and os.path.dirname(r.reply["path"]) == r.out, r.reply))), # ---- Mode ---- @@ -517,13 +518,13 @@ ROWS = dict([ [(o["name"], o["plate"]) for o in r.objects()])), pre=[CUBE_OFF_PLATE]), row("obj_orient", "two_cubes", objects(lambda r: (near(r.objects()[0]["bbox"]["size"][2], 20, 0.5), r.objects()[0]["bbox"])), pre=[call("object_transform", object=0, rotate=[45, 0, 0]), call("object_select", objects=[0])]), - *[row("obj_type_" + tile, "part_selected", objects(lambda r, t=t: (part_types(r) == sorted(["part", t]), part_types(r)))) - for tile, t in (("negative", "negative"), ("modifier", "modifier"), ("support_blocker", "support_blocker"), - ("support_enforcer", "support_enforcer"), ("precise_seam", "precise_seam"))], + *[row("obj_type_" + action, "part_selected", objects(lambda r, t=t: (part_types(r) == sorted(["part", t]), part_types(r)))) + for action, t in (("negative", "negative"), ("modifier", "modifier"), ("support_blocker", "support_blocker"), + ("support_enforcer", "support_enforcer"), ("precise_seam", "precise_seam"))], row("obj_type_part", "part_selected", objects(lambda r: (part_types(r) == ["part", "part"], part_types(r))), pre=[call("part_change_type", parts=[[0, 1]], type="modifier"), call("object_select", parts=[[0, 1]])]), - row("obj_rename", "two_cubes", objects(lambda r: (r.names()[0] == "Renamed by its tile", r.names())), - answers=[typed("Renaming", "wxTextCtrl", "Renamed by its tile")]), + row("obj_rename", "two_cubes", objects(lambda r: (r.names()[0] == "Renamed by its action", r.names())), + answers=[typed("Renaming", "wxTextCtrl", "Renamed by its action")]), row("obj_set_instances", "two_cubes", objects(lambda r: (len(r.objects()[0]["instances"]) == 3, len(r.objects()[0]["instances"]))), answers=[typed("Copies of the selected object", "wxSpinCtrl", 3)]), @@ -555,15 +556,15 @@ ROWS = dict([ # The plate goes and its objects stay, off every plate (PartPlateList::delete_plate()). row("plate_delete", "two_plates", plates(lambda r: (len(r.plates()) == 1 and [o["plate"] for o in r.objects()] == [0, None], (len(r.plates()), [o["plate"] for o in r.objects()])))), - row("plate_rename", "two_cubes", plates(lambda r: (r.plates()[0]["name"] == "Plate by its tile", r.plates()[0]["name"])), - answers=[typed("Edit Plate Name", "TextInput", "Plate by its tile")]), + row("plate_rename", "two_cubes", plates(lambda r: (r.plates()[0]["name"] == "Plate by its action", r.plates()[0]["name"])), + answers=[typed("Edit Plate Name", "TextInput", "Plate by its action")]), row("plate_toggle_lock", "two_cubes", plates(lambda r: (r.plates()[0]["locked"] is True, r.plates()[0]["locked"]))), row("plate_goto", "two_plates", plates(lambda r: (r.state()["plates"]["current"] == 0, r.state()["plates"]))), # ---- Printer, Filament, Presets ---- row("sync_ams", "two_cubes", refused("no_printer", "no printer is connected, and the test connects to none")), row("filament_add", "empty", app_state(lambda r: (r.slots() == 2, r.slots()))), row("filament_delete", "empty", app_state(lambda r: (r.slots() == 1, r.slots())), pre=[TWO_SLOTS]), - dialog_tile("preset_bundle", "Preset Bundle"), + dialog_action("preset_bundle", "Preset Bundle"), row("sync_presets", "empty", refused("not_signed_in", "nothing is signed in, and the test signs in to no account")), # ---- Import ---- row("import_file", "empty", picked(lambda r: r.objects() == []), answers=[picker("two_shells.stl")], @@ -582,13 +583,13 @@ ROWS = dict([ row("export_config", "empty", window("Export Preset Bundle"), answers=[button("Export Preset Bundle", "cancel")], why="the dialog's kinds and presets are the person's to pick, so the test closes it"), # ---- Help ---- - dialog_tile("help_keyboard_shortcuts", "Keyboard Shortcuts"), - dialog_tile("help_setup_wizard", "Setup Wizard", why="the wizard installs printers on Finish, so the test closes it"), + dialog_action("help_keyboard_shortcuts", "Keyboard Shortcuts"), + dialog_action("help_setup_wizard", "Setup Wizard", why="the wizard installs printers on Finish, so the test closes it"), row("help_open_config_folder", "empty", external("it opens the configuration folder in the system's file manager")), row("help_migrate_filament_presets", "empty", window("Migrate Filament Presets"), answers=[button("Migrate Filament Presets", "ok")]), - dialog_tile("help_troubleshoot", "Troubleshoot Center"), - dialog_tile("help_network_test", "Network Test", why="its tests reach the network, so the test closes it"), + dialog_action("help_troubleshoot", "Troubleshoot Center"), + dialog_action("help_network_test", "Network Test", why="its tests reach the network, so the test closes it"), # Once Start is pressed the OrcaSliced Combo replaces the empty project, and the benchmark's own window, which times # the views and slices, stays open beside the main window (run_scene_benchmark()). row("help_benchmark_3d_scene", "empty", objects(lambda r: (lambda shown: ( @@ -599,7 +600,7 @@ ROWS = dict([ row("help_tip_of_the_day", "empty", ("widget", lambda r: ("Daily Tips" in r.imgui_windows(), r.imgui_windows()))), row("help_check_updates", "empty", ("window", lambda r: (r.new_windows() != [], r.new_windows())), answers=[button("", "ok")], why="the dialog says whether a newer version exists, which depends on the day"), - dialog_tile("help_about", "About Orca Slicer"), + dialog_action("help_about", "About Orca Slicer"), row("open_wiki", "empty", external("it opens the wiki in the system's browser")), row("open_youtube", "empty", external("it opens the YouTube channel in the system's browser")), # ---- Plugins ---- @@ -641,22 +642,22 @@ def use_capture_folder(run): def journal_step(run, key): - """The step replay_export writes for the tile's action_run, or None.""" + """The action_run step replay_export writes for the action of `key`, or None.""" steps = run.call("replay_export", clear=True)["replay"]["steps"] - return next((s for s in steps if s.get("tool") == "action_run" and s.get("args", {}).get("id") == tile_id(key)), None) + return next((s for s in steps if s.get("tool") == "action_run" and s.get("args", {}).get("id") == action_id(key)), None) def main(): ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) ap.add_argument("--out", help="output folder (default: a new temporary one)") - ap.add_argument("--only", nargs="+", metavar="KEY", help="run these tiles alone") + ap.add_argument("--only", nargs="+", metavar="KEY", help="run these actions alone") args = ap.parse_args() - out = os.path.abspath(args.out) if args.out else tempfile.mkdtemp(prefix="every-tile-") + out = os.path.abspath(args.out) if args.out else tempfile.mkdtemp(prefix="every-action-") os.makedirs(out, exist_ok=True) write_inputs(out) - with open(os.path.join(DATA, "speed_dial_tiles.json"), encoding="utf-8") as f: - tiles = json.load(f) - with open(os.path.join(DATA, "speed_dial_tile_calls.json"), encoding="utf-8") as f: + with open(os.path.join(DATA, "speed_dial_actions.json"), encoding="utf-8") as f: + actions = json.load(f) + with open(os.path.join(DATA, "speed_dial_action_calls.json"), encoding="utf-8") as f: fixture = {c["key"]: c for c in json.load(f)} client, session = orca_mcp.session_client() @@ -668,10 +669,10 @@ def main(): checks.append((name, bool(ok), detail)) print(("PASS " if ok else "FAIL ") + name + ("" if ok else f": {str(detail)[:600]}"), flush=True) - keys = [t["key"] for t in tiles] - check("every tile has a row", set(keys) <= set(ROWS), sorted(set(keys) - set(ROWS))) - check("every row is a tile", set(ROWS) <= set(keys), sorted(set(ROWS) - set(keys))) - check("every tile has a call in the fixture", set(keys) <= set(fixture), sorted(set(keys) - set(fixture))) + keys = [a["key"] for a in actions] + check("every action has a row", set(keys) <= set(ROWS), sorted(set(keys) - set(ROWS))) + check("every row is an action", set(ROWS) <= set(keys), sorted(set(ROWS) - set(keys))) + check("every action has a call in the fixture", set(keys) <= set(fixture), sorted(set(keys) - set(fixture))) commands, offset = {}, 0 while True: page = client.call("action_search", group="", limit=200, offset=offset) @@ -701,7 +702,7 @@ def main(): run.call("replay_export", clear=True) kind = r["expect"][0] try: - first = run.call("action_run", id=tile_id(key), **({"args": r["value"]} if r["value"] else {})) + first = run.call("action_run", id=action_id(key), **({"args": r["value"]} if r["value"] else {})) except orca_mcp.McpError as e: if kind == "refused": code = json.loads(str(e).rpartition("\n")[2] or "{}").get("code") @@ -725,21 +726,21 @@ def main(): continue run.call("app_wait", **{"for": "idle", "timeout_s": 50}) if kind == "external": - check(f"{name} runs, handing over to another program", run.reply.get("ran") == tile_id(key), run.reply) + check(f"{name} runs, handing over to another program", run.reply.get("ran") == action_id(key), run.reply) shown_otherwise.append((key, "external", r["expect"][1])) else: ok, detail = r["expect"][1](run) check(f"{name} does its row's job ({kind})", ok, detail) if not cancelled: - check(f"{name}: its reply names the tile it ran", run.reply.get("ran") == tile_id(key), run.reply) + check(f"{name}: its reply names the action it ran", run.reply.get("ran") == action_id(key), run.reply) step = journal_step(run, key) spec = fixture.get(key, {}) given = step.get("args", {}).get("args", {}) if step else None wanted = ({spec["input"]: list(r["value"].values())[0]} if spec.get("input") else spec.get("args")) - check(f"{name}: the journal keeps the tile's action_run with the fixture's arguments", + check(f"{name}: the journal keeps its action_run with the fixture's arguments", step is not None and given in ({}, wanted) and (given == wanted or not spec.get("input")), step) - check(f"{name}: whose tile names the fixture's command", commands.get(tile_id(key)) == spec.get("command"), - (commands.get(tile_id(key)), spec.get("command"))) + check(f"{name}: its action names the fixture's command", commands.get(action_id(key)) == spec.get("command"), + (commands.get(action_id(key)), spec.get("command"))) if r["why"]: shown_otherwise.append((key, kind, r["why"])) except orca_mcp.McpError as e: @@ -757,7 +758,7 @@ def main(): print(f" after {key}: {tool} failed: {e}", flush=True) empty(run) - print("\nTiles shown by a refusal or as handing over, and rows that read less than a change of their own:") + print("\nActions shown by a refusal or as handing over, and rows that read less than a change of their own:") for key, kind, why in shown_otherwise: print(f" {key}: {kind}: {why}") failed = [c for c in checks if not c[1]] diff --git a/tools/mcp/test_menu_items_refusals.py b/tools/mcp/test_menu_items_refusals.py index 1ede844e7e..4bdfb12872 100644 --- a/tools/mcp/test_menu_items_refusals.py +++ b/tools/mcp/test_menu_items_refusals.py @@ -12,7 +12,7 @@ object_delete of an object the project lacks names its index. object_select with and object_delete by index leaves the view shown (the assemble view). A selection of a kind a command does not take: object_rename with an instance selected is refused as wrong_selection, -and a pick of Rename from the Speed Dial (Space on the 3D view, the search field, a click on the tile) says to select +and a pick of Rename from the Speed Dial (Space on the 3D view, the search field, a click on its row) says to select one object or part, as its menu item did, and opens no dialog. A pick of Set as Individual Objects with a part selected separates that part's instance alone. A pick of Delete with an object's last solid part selected shows the object list's message, as the menu item did, where object_delete of that part by index is refused as last_solid_part; object_delete @@ -42,11 +42,11 @@ Named objects, or a plate, of which nothing is printable (an Assembly of a cube not_printable and turn no other object, while a pick of Auto-Orient on that object turns the other object, as its menu item's job did, and names it. -The plates: a pick of Duplicate Plate is one undo step, which Undo takes back alone. The Rename Plate tile run with its -name dialog cancelled is told the plate was not renamed (not_renamed), while a pick of it, cancelled, shows nothing, as -its menu item did. plate_delete, plate_duplicate, plate_rename, plate_lock and plate_select of a plate the project lacks are -refused as no_such_plate, each leaving the plates as they were; a rename of a plate to the name it has changes neither -the current plate nor the undo history. +The plates: a pick of Duplicate Plate is one undo step, which Undo takes back alone. The Rename Plate action run with +its name dialog cancelled is told the plate was not renamed (not_renamed), while a pick of it, cancelled, shows +nothing, as its menu item did. plate_delete, plate_duplicate, plate_rename, plate_lock and plate_select of a plate the +project lacks are refused as no_such_plate, each leaving the plates as they were; a rename of a plate to the name it +has changes neither the current plate nor the undo history. A refusal is an error a replay cannot expect, which is why this is a script. Exits 0 when every check passes. """ @@ -98,7 +98,7 @@ def main(): return (client.call("app_state").get("gizmo") or {}).get("name") def dial_pick(title): - """Opens the Speed Dial on the shown 3D view and picks the tile titled `title`, as a person's click does.""" + """Opens the Speed Dial on the shown 3D view and picks the action titled `title`, as a person's click does.""" client.call("keyboard_press", keys="space", target=CANVAS) client.call("widget_set_value", target={"web": "Search actions"}, value=title, submit=False) return client.call("widget_click", target={"web": f"{title} from Orcaslicer", "kind": "button"}) @@ -535,7 +535,7 @@ def main(): client.call("dialog_auto_answer", rules=[{"match": "Edit Plate Name", "button": "cancel"}]) before = rule_uses("Edit Plate Name") - refused("Rename Plate's tile with its dialog cancelled says the plate was not renamed", "action_run", + refused("Rename Plate's action with its dialog cancelled says the plate was not renamed", "action_run", {"id": "orca_command:plate_rename:orca"}, "not renamed", "not_renamed") check("and its dialog was asked", rule_uses("Edit Plate Name") == before + 1, f"{before} -> {rule_uses('Edit Plate Name')}") before = rule_uses("Edit Plate Name") diff --git a/tools/mcp/test_operation_routes.py b/tools/mcp/test_operation_routes.py index 8618aa5763..4904287bb7 100644 --- a/tools/mcp/test_operation_routes.py +++ b/tools/mcp/test_operation_routes.py @@ -4,9 +4,9 @@ tools/mcp/orca_mcp.py launch tools/mcp/test_operation_routes.py -A command, a Speed Dial tile that runs it (with action_run) and the plugin API's binding run one +A command, a Speed Dial action that runs it (with action_run) and the plugin API's binding run one operation of GUI/Operations, so each pair here gets one answer: a layer asked of a Preview that has none -(the Go to layer tile and view_set); a preset for a mixed-colour filament slot; and a hidden printer +(the Go to layer action and view_set); a preset for a mixed-colour filament slot; and a hidden printer selected by name through the plugin API, as preset_select selects one. It also checks what a command refuses or does in those states alone: a project saved under a .gcode.3mf name; an export of a project with no objects (a .3mf is written, an STL and a sliced file are refused); an arrangement from the @@ -61,8 +61,8 @@ def main(): return "blocked_by_dialog", json.dumps(reply.get("dialogs")) return None, client.await_job(reply) - def tile(name, **tile_args): - return answer("action_run", id="orca_command:%s:orca" % name, args=tile_args) + def action(name, **action_args): + return answer("action_run", id="orca_command:%s:orca" % name, args=action_args) def plugin_api(**args): code = "import ops_presets\nresult = ops_presets.preset_api(args)" @@ -87,9 +87,9 @@ def main(): check("project_export refuses %s of a project with no objects" % fmt, code == "no_objects", (code, text)) check("and writes no file (%s)" % fmt, not os.path.exists(path("model" + ext))) - code_c, text_c = tile("go_to_layer", percent=50) + code_c, text_c = action("go_to_layer", percent=50) code_t, text_t = answer("view_set", layer=1) - check("the Go to layer tile refuses a layer of a Preview with none", code_c == "no_layers", (code_c, text_c)) + check("the Go to layer action refuses a layer of a Preview with none", code_c == "no_layers", (code_c, text_c)) check("view_set refuses a layer of a Preview with none", code_t == "no_layers", (code_t, text_t)) check("in the same words (layer)", text_c == text_t, (text_c, text_t)) client.call("view_set", tab="prepare") diff --git a/tools/mcp/test_person_forms.py b/tools/mcp/test_person_forms.py index 1d867bd9ea..1b255b74aa 100644 --- a/tools/mcp/test_person_forms.py +++ b/tools/mcp/test_person_forms.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -"""Checks that a call with exactly a tile's arguments asks as a person's pick does, that one with a path does not, and -that a person's pick of a view tile or Deselect All runs in place, as its menu item did. +"""Checks that a call with exactly an action's arguments asks as a person's pick does, that one with a path does not, +and that a person's pick of a view action or Deselect All runs in place, as its menu item did. tools/mcp/orca_mcp.py launch tools/mcp/test_person_forms.py @@ -16,14 +16,14 @@ Picks from the Speed Dial, opened with Space on the 3D view and searched by titl the camera, Deselect All on the Preview tab clears the Prepare selection without leaving the tab, and Go to layer takes its percentage from the second phase. None of them starts a job or shows a notice. -Auto-Arrange and Select All Objects, on a plate of three cubes: object_arrange {} and action_run of the tile wait and -reply as the command does (the settings in force, what was left off the plates); the journal keeps the call with the -settings in force, and action_run of the tile with the tile's arguments, whose exported replay runs. object_select -{all: true} and action_run of its tile reply with the selection; in the assemble view the call selects there and leaves -the view shown, and with the Measure gizmo open there it is refused as gizmo_open. A pick of either runs in place: -Auto-Arrange puts a cube moved off the plate back on it, and Select All Objects selects the three, in Prepare, which it -shows when picked in the assemble view. A replay cannot expect a failed step, which is why this is a script. Exits 0 -when every check passes. +Auto-Arrange and Select All Objects, on a plate of three cubes: object_arrange {} and action_run of its action wait +and reply as the command does (the settings in force, what was left off the plates); the journal keeps the call with +the settings in force, and action_run of the action with its own arguments, whose exported replay runs. object_select +{all: true} and action_run of its action reply with the selection; in the assemble view the call selects there and +leaves the view shown, and with the Measure gizmo open there it is refused as gizmo_open. A pick of either runs in +place: Auto-Arrange puts a cube moved off the plate back on it, and Select All Objects selects the three, in Prepare, +which it shows when picked in the assemble view. A replay cannot expect a failed step, which is why this is a script. +Exits 0 when every check passes. """ import json @@ -80,7 +80,7 @@ def main(): return out def dial_pick(title): - """Opens the Speed Dial on the shown 3D view and picks the tile titled `title`, as a person's click does.""" + """Opens the Speed Dial on the shown 3D view and picks the action titled `title`, as a person's click does.""" client.call("keyboard_press", keys="space", target=CANVAS) client.call("widget_set_value", target={"web": "Search actions"}, value=title, submit=False) return client.call("widget_click", target={"web": f"{title} from Orcaslicer", "kind": "button"}) @@ -132,7 +132,7 @@ def main(): check("project_save with a path writes the file", os.path.isfile(path), os.listdir(work)) check("with no picker", picker_uses() == before, f"{before} -> {picker_uses()}") - # ---- The tiles' arguments open the pickers, which the rule cancels ---- + # ---- The actions' arguments open the pickers, which the rule cancels ---- last = last_output_dir(session) folders = [work] + ([last] if last and os.path.isdir(last) else []) since = time.time() @@ -233,19 +233,19 @@ def main(): check("and the journal keeps it with the settings in force", step.get("tool") == "object_arrange" and "spacing" in step.get("args", {}), step) - # action_run names the tile it ran in ran, whatever the command replies; the menu item replied level besides. + # action_run names the action it ran in ran, whatever the command replies; the menu item replied level besides. cube_off_plate("action_run of Auto-Arrange") arranged = client.await_job(client.call("action_run", id="orca_command:obj_arrange:orca")) check("action_run of Auto-Arrange replies with the settings in force and what it left off the plates", "settings" in arranged and arranged.get("off_plate") == [], arranged) check("and not with the menu item's level", "level" not in arranged, arranged) - check("and with ran, the tile's id", arranged.get("ran") == "orca_command:obj_arrange:orca", arranged) + check("and with ran, the action's id", arranged.get("ran") == "orca_command:obj_arrange:orca", arranged) check("and puts the cube back on the plate", outside() == [], outside()) - # action_run takes the tile with its own arguments alone, none here, so the journal keeps those in place of the + # action_run takes the action with its own arguments alone, none here, so the journal keeps those in place of the # settings the command records, and the step replays. exported = client.call("replay_export", clear=True)["replay"] step = (exported["steps"] or [{}])[-1] - check("and the journal keeps the tile's call", step.get("tool") == "action_run" + check("and the journal keeps the action's call", step.get("tool") == "action_run" and step.get("args") == {"id": "orca_command:obj_arrange:orca", "args": {}}, step) exported["steps"] = [s for s in exported["steps"] if s.get("tool") in ("object_transform", "action_run")] replayed = client.await_job(client.call("replay_run", replay=exported)) @@ -281,7 +281,7 @@ def main(): check("action_run of Select All Objects replies with the selection, the three cubes", chosen.get("objects") == [0, 1, 2], chosen) check("and not with the menu item's level", "level" not in chosen, chosen) - check("and with ran, the tile's id", chosen.get("ran") == "orca_command:select_all:orca", chosen) + check("and with ran, the action's id", chosen.get("ran") == "orca_command:select_all:orca", chosen) client.call("view_set", canvas="assemble") client.call("object_select", none=True) diff --git a/tools/mcp/test_plugin_commands.py b/tools/mcp/test_plugin_commands.py index 3390671ac4..170fc41f35 100644 --- a/tools/mcp/test_plugin_commands.py +++ b/tools/mcp/test_plugin_commands.py @@ -239,7 +239,7 @@ def run(orca, datadir, scratch): check("uninstalling it again is refused: no plugin has that key", gone is not None and gone[1].get("code") == "no_such_plugin", gone) # --- Refresh Plugins picked in the Speed Dial as a person picks it (the pick of test_person_forms.py; action_run of - # the tile is an automated call, which waits as plugin_refresh does): it returns at once and its refresh ends with + # it is an automated call, which waits as plugin_refresh does): it returns at once and its refresh ends with # its "Plugins refreshed." notification. It goes before the calls below, as the notification manager shows that # text once for every refresh that ends with it. Each refresh rescans the plugins, which the log says # (PluginManager::rescan_plugins()). Two refreshes that overlap take turns: the unit case of Ops::RefreshRun shows diff --git a/tools/mcp/test_plugin_tools.py b/tools/mcp/test_plugin_tools.py index 49325bdcb7..267c1fa800 100644 --- a/tools/mcp/test_plugin_tools.py +++ b/tools/mcp/test_plugin_tools.py @@ -4,8 +4,8 @@ Launches OrcaSlicer on a fresh data folder with the Design tab on (in a build wi tests/plugins/mcp_tools_fixture side-loaded, and tests/plugins/mcp_tools_broken, whose load fails after declaring an operation: over MCP, then once without MCP, running a replay with --run, so the plugin's calls go to the runtime started without its endpoint. The first launch also checks that the plugin is sent the NewProject event when -project_new or its Speed Dial tile starts a project, and ends by unticking the fixture in the Plugins dialog, as a person -unloads it. +project_new or its Speed Dial action starts a project, and ends by unticking the fixture in the Plugins dialog, as a +person unloads it. Run it as python tools/mcp/test_plugin_tools.py [--bin PATH]. """ import json @@ -165,7 +165,7 @@ def main(): command = next((i for i in found["items"] if i["name"] == "settings_toggle_developer_mode"), {}) check("tool_search's search finds a menu item's command among the commands, with its schema", command.get("listed") is False and "input_schema" in command, found) - check("and not its tile among the actions", + check("and does not list its Speed Dial action among the actions", not any("toggle_developer_mode" in a["id"] for a in found.get("actions", {}).get("items", [])), found) found = orca.call("tool_search", query="fixture") check("tool_search's search finds the Speed Dial's other actions", @@ -201,13 +201,13 @@ def main(): journal) broken = orca.call_raw("tool_search", {"tool": f"plugin.{BROKEN}.measure"}) check("a plugin whose load failed offers none of its operations", broken.get("isError"), broken) - # A project started by project_new or by its tile tells plugins, as File > New Project does. + # A project started by project_new or by its Speed Dial action tells plugins, as File > New Project does. started = lambda: lines_of(os.path.join(plugin_dir, "new_projects.txt")) before = started() orca.call("project_new", discard_changes=True) check("project_new sends plugins the NewProject event", wait_for(lambda: started() == before + 1, 10), started()) orca.call("action_run", id="orca_command:new_project:orca") - check("and so does its tile, new_project", wait_for(lambda: started() == before + 2, 10), started()) + check("and so does its action, new_project", wait_for(lambda: started() == before + 2, 10), started()) held = run_plugin_script(orca, plugin_dir, "handle", CAPABILITIES[4]) check("the plugin opens a progress dialog and keeps its handle", held.get("ok") is True, held) grab = orca.await_job(orca.call("script_run", code=GRAB_HANDLE)) diff --git a/tools/mcp/test_send_gcode.py b/tools/mcp/test_send_gcode.py index 040855416b..939e9241d3 100755 --- a/tools/mcp/test_send_gcode.py +++ b/tools/mcp/test_send_gcode.py @@ -1,13 +1,13 @@ #!/usr/bin/env python3 -"""Checks sending G-code to a print host with printer_send's Speed Dial tile, send_gcode, read back through +"""Checks sending G-code to a print host with printer_send's Speed Dial action, send_gcode, read back through app_state.uploads. tools/mcp/orca_mcp.py launch tools/mcp/test_send_gcode.py -Starts an OctoPrint-compatible stub host on a free loopback port. The tile first refuses a printer that +Starts an OctoPrint-compatible stub host on a free loopback port. The action first refuses a printer that prints through the Bambu network (when the app starts on a Bambu printer) and one without a print host. Then -the printer points at the stub, a cube is sliced, and each send runs the tile, sets the file name with +the printer points at the stub, a cube is sliced, and each send runs the action, sets the file name with widget_set_value and presses Upload with dialog_answer: - the stub answers 200 a few seconds after it has the whole file: meanwhile the row reads uploading at 99, then completed, and the stub got the file without print=true; @@ -100,11 +100,11 @@ def uploads(client): def send(client, filename): - """Sends the current plate as `filename` through the tile's dialog and returns the new row's id.""" + """Sends the current plate as `filename` through the action's dialog and returns the new row's id.""" before = len(uploads(client)) blocked = client.call("action_run", id=SEND) if blocked.get("status") != "blocked_by_dialog": - raise orca_mcp.McpError(f"the send_gcode tile did not open its dialog: {blocked}", blocked) + raise orca_mcp.McpError(f"the send_gcode action did not open its dialog: {blocked}", blocked) client.call("widget_set_value", target={"class": "wxTextCtrl", "within": "Send G-code to printer host"}, value=filename, submit=False) client.call("dialog_answer", button="Upload") client.await_job(blocked) @@ -161,7 +161,7 @@ def main(): client.call("app_wait", **{"for": "idle"}) found = client.call("action_search", query="Send G-code") - check("action_search finds the send_gcode tile", any(a["id"] == SEND for a in found["items"]), found) + check("action_search finds the send_gcode action", any(a["id"] == SEND for a in found["items"]), found) # ---- Refusals ---- if client.call("app_state")["presets"]["printer"].startswith("Bambu Lab"): @@ -190,9 +190,9 @@ def main(): # ---- The exported send replays ---- path = os.path.join(work, "send.json") exported = client.call("replay_export", path=path, overwrite=True) - # Each step that acts on the dialog follows an app_wait for it, since the replayed tile may open it late. + # Each step that acts on the dialog follows an app_wait for it, since the replayed action may open it late. check("the send exports as action_run, widget_set_value and dialog_answer, each after an app_wait for the dialog, " - "and the app_wait for the tile", + "and the app_wait for the action", [s["tool"] + ("(dialog)" if s["tool"] == "app_wait" and s["args"]["for"] == "dialog" else "") for s in exported["replay"]["steps"]] == ["action_run", "app_wait(dialog)", "widget_set_value", "app_wait(dialog)", "dialog_answer", "app_wait"], diff --git a/tools/mcp/test_web_ui.py b/tools/mcp/test_web_ui.py index 709bf4bcdf..240880d39f 100755 --- a/tools/mcp/test_web_ui.py +++ b/tools/mcp/test_web_ui.py @@ -17,7 +17,7 @@ stale refs; closed:true from a page that closes its dialog through a reference t before, with another client's snapshots running meanwhile, and from orca.submit; dialog_answer by a page button and its refusal of apply; an auto-answer rule registered before the dialog opens; the web budget with the Home page and a modeless page window open; the plugin's page among the main window's tabs, -which the Go to tab tile shows by its id; webview_run_javascript's el. Exits 0 when every check passes. +which the Go to tab action shows by its id; webview_run_javascript's el. Exits 0 when every check passes. """ import glob @@ -588,7 +588,7 @@ def main(): check("a page that closes its dialog before the click's reply replies closed", r.get("closed") is True and "error" not in r, r) check("that dialog is gone", wait_for(lambda: dialogs() == []), lambda: dialogs()) - # ---- A plugin's page among the main window's tabs: the Go to tab tile shows it by its id ---- + # ---- A plugin's page among the main window's tabs: the Go to tab action shows it by its id ---- # The plugin registers its page once it has loaded, which may be after the app reports ready. shown = {} @@ -597,7 +597,7 @@ def main(): shown.update(call("action_run", id="orca_command:go_to_tab:orca", args={"tab": PAGE_TAB})) return shown.get("tab") == PAGE_TAB - check("the Go to tab tile shows the plugin's page", wait_for(go_to_page_tab, 15), lambda: shown) + check("the Go to tab action shows the plugin's page", wait_for(go_to_page_tab, 15), lambda: shown) check("and the window shows it", client.call("app_state").get("tab") == PAGE_TAB, lambda: client.call("app_state").get("tab")) # ---- A dock panel, beside the 3D view ---- diff --git a/tools/mcp/tests/tiles_ask.json b/tools/mcp/tests/actions_ask.json similarity index 85% rename from tools/mcp/tests/tiles_ask.json rename to tools/mcp/tests/actions_ask.json index 516783d718..2da0aac071 100644 --- a/tools/mcp/tests/tiles_ask.json +++ b/tools/mcp/tests/actions_ask.json @@ -1,12 +1,13 @@ -// A call with exactly a tile's arguments does what a person's pick of the tile does, and a tile whose menu item and tool do -// the same thing runs the tool's function: calibration_generate_test with test alone asks in the test's dialog, and -// with silent runs with its defaults; View: Top turns the Design tab's camera; Go to tab and Go to layer take their -// value through action_run; plate_slice {preview: true} and Slice and Preview slice and show the Preview tab; Deselect -// All clears the selection of the view shown. Run on a live app with the Design tab (orca_mcp.py launch --cad): -// python3 tools/mcp/orca_mcp.py run-replay tools/mcp/tests/tiles_ask.json --out +// A call with exactly an action's arguments does what a person's pick of the action does, and an action whose menu item +// and tool do the same thing runs the tool's function: calibration_generate_test with test alone asks in the test's +// dialog, and with silent runs with its defaults; View: Top turns the Design tab's camera; Go to tab and Go to layer +// take their value through action_run; plate_slice {preview: true} and Slice and Preview slice and show the Preview +// tab; Deselect All clears the selection of the view shown. Run on a live app with the Design tab +// (orca_mcp.py launch --cad): +// python3 tools/mcp/orca_mcp.py run-replay tools/mcp/tests/actions_ask.json --out { "orca_replay_version": "0.2.0", - "name": "tiles that ask", + "name": "actions that ask", "vars": {"cube": "${replay_dir}/../../../resources/handy_models/OrcaCube_v2.drc"}, "steps": [ {"tool": "app_wait", "args": {"for": "ready"}}, diff --git a/tools/mcp/tests/menu_items_objects.json b/tools/mcp/tests/menu_items_objects.json index 91d7c50ad3..21a64d8bc1 100644 --- a/tools/mcp/tests/menu_items_objects.json +++ b/tools/mcp/tests/menu_items_objects.json @@ -1,6 +1,6 @@ // The object commands made from menu items, called by index, and with no target on the selection: object_rename, // object_set_instances, object_separate_instances and object_delete name what they act on in their replies, which -// object_list reads back; the Delete Selected tile deletes the selection; object_set_height_ranges and +// object_list reads back; the Delete Selected action deletes the selection; object_set_height_ranges and // object_set_variable_layer_height without object act on the selected object and name it. Run it with // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/menu_items_objects.json --out { @@ -30,7 +30,7 @@ "/plates/0/objects/0/instances/2": {"exists": false}, "/plates/0/objects/3/instances/0": {"exists": true}}}, - // ---- Delete by index, then the selection, by the command and by its Delete Selected tile ---- + // ---- Delete by index, then the selection, by the command and by its Delete Selected action ---- {"tool": "object_delete", "args": {"objects": [0]}, "expect": {"/objects/0/index": {"eq": 0}, "/object_count": {"eq": 3}}}, {"tool": "object_list", "expect": {"/total": {"eq": 3}, "/plates/0/objects/0/name": {"eq": "middle"}}}, {"tool": "object_select", "args": {"objects": [0]}}, diff --git a/tools/mcp/tests/menu_items_placement.json b/tools/mcp/tests/menu_items_placement.json index 93456a67f3..01276500a2 100644 --- a/tools/mcp/tests/menu_items_placement.json +++ b/tools/mcp/tests/menu_items_placement.json @@ -2,9 +2,9 @@ // name while another object is selected, in one undo step (the snapshots read from the log, fixtures/ops_undo.py); // object_mirror, object_drop, object_center (each plate's objects on their own plate, then all on one), // object_scale_to_fit and object_auto_orient (a cube on its edge laid on a face), each read back through object_list; -// and the Center, Drop, Scale to Fit and Auto-Orient tiles on the selection. Plate positions are those of the sweep's printer, a -// Bambu Lab X1 Carbon (a 256 mm bed): with three plates, plate 1's centre is at x 435.2, y 128 and plate 2's at x 128, -// y -179.2. Run it with +// and the Center, Drop, Scale to Fit and Auto-Orient actions on the selection. Plate positions are those of the sweep's +// printer, a Bambu Lab X1 Carbon (a 256 mm bed): with three plates, plate 1's centre is at x 435.2, y 128 and plate 2's +// at x 128, y -179.2. Run it with // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/menu_items_placement.json --out { "orca_replay_version": "0.2.0", @@ -43,7 +43,7 @@ {"tool": "object_drop", "args": {"objects": [1]}, "expect": {"/moved": {"eq": true}, "/objects/0/index": {"eq": 1}}}, {"tool": "object_list", "expect": {"/plates/1/objects/1/bbox/min/2": {"ge": -0.001, "le": 0.001}}}, {"tool": "object_drop", "args": {"objects": [1]}, "expect": {"/moved": {"eq": false}}}, - // the Drop to Bed tile on the selection + // the Drop to Bed action on the selection {"tool": "object_transform", "args": {"object": 1, "translate": [0, 0, 15], "drop_to_bed": false}}, {"tool": "object_select", "args": {"objects": [1]}}, {"tool": "action_run", "args": {"id": "orca_command:obj_drop:orca"}, "expect": {"/moved": {"eq": true}}}, @@ -76,14 +76,14 @@ {"tool": "object_center", "args": {"objects": [0, 1, 2], "plate": 1}, "expect": {"/plates/0/plate": {"eq": 1}, "/plates/0/objects": {"eq": [0, 1, 2]}}}, {"tool": "object_list", "expect": {"/plates/1/objects/2/name": {"eq": "third"}, "/plates/2/objects/0": {"exists": false}, "/outside": {"empty": true}}}, - // ---- The Center tile on the one selected: the current plate's centre ---- + // ---- The Center action on the one selected: the current plate's centre ---- {"tool": "object_transform", "args": {"object": 2, "translate": [30, 0, 0]}}, {"tool": "object_select", "args": {"objects": [2]}}, {"tool": "action_run", "args": {"id": "orca_command:obj_center:orca"}, "expect": {"/plates/0/plate": {"eq": 1}, "/objects/0/index": {"eq": 2}}}, {"tool": "object_list", "expect": {"/plates/1/objects/2/instances/0/offset/0": {"ge": 435.1, "le": 435.3}, "/plates/1/objects/2/instances/0/offset/1": {"ge": 127.9, "le": 128.1}}}, - // ---- Scale to fit by index, and the tile on the selection ---- + // ---- Scale to fit by index, and the action on the selection ---- {"tool": "object_scale_to_fit", "args": {"objects": [0]}, "expect": {"/scales/0/object": {"eq": 0}, "/scales/0/scale/0": {"gt": 5}}}, {"tool": "object_list", "expect": {"/plates/1/objects/0/instances/0/scale/0": {"gt": 5}}}, {"tool": "object_select", "args": {"objects": [2]}}, @@ -97,7 +97,7 @@ "/rotations/1/rotation_deg/0": {"ge": 89.9, "le": 90.1}}}, {"tool": "object_list", "expect": {"/plates/1/objects/2/instances/0/rotation_deg/0": {"ge": 89.9, "le": 90.1}}}, {"tool": "app_state", "expect": {"/selection/objects": {"eq": [1, 2]}}}, - // the Auto-Orient tile with nothing selected orients every object + // the Auto-Orient action with nothing selected orients every object {"tool": "object_select", "args": {"none": true}}, {"tool": "app_state", "expect": {"/selection/empty": {"eq": true}}}, {"tool": "action_run", "args": {"id": "orca_command:obj_orient:orca"}, "expect": {"/rotations/2/object": {"eq": 2}, "/rotations/3": {"exists": false}}}, diff --git a/tools/mcp/tests/menu_items_structure.json b/tools/mcp/tests/menu_items_structure.json index bacba7fbe7..a5fa1dc629 100644 --- a/tools/mcp/tests/menu_items_structure.json +++ b/tools/mcp/tests/menu_items_structure.json @@ -1,6 +1,6 @@ // The object structure commands made from menu items, called by index: object_split into objects and into parts, // object_assemble, part_change_type and object_order name what they made or renumbered in their replies, which -// object_list reads back; the Split to Objects tile splits the selected object. Run it with +// object_list reads back; the Split to Objects action splits the selected object. Run it with // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/menu_items_structure.json --out { "orca_replay_version": "0.2.0", @@ -46,13 +46,13 @@ "expect": {"/descending": {"eq": false}, "/order/3/plate": {"eq": 0}, "/order/4": {"exists": false}}}, {"tool": "object_list", "expect": {"/plates/0/objects/2/bbox/size/2": {"ge": 9.99, "le": 10.01}, "/plates/0/objects/3/bbox/size/2": {"ge": 29.99, "le": 30.01}}}, - // the same call again keeps the order: only the tile's call reverses it + // the same call again keeps the order: only the action's call reverses it {"tool": "object_order", "args": {"by": "height", "plate": 0}, "expect": {"/descending": {"eq": false}}}, {"tool": "object_order", "args": {"by": "height", "descending": true}, "expect": {"/descending": {"eq": true}}}, {"tool": "object_list", "expect": {"/plates/0/objects/0/bbox/size/2": {"ge": 29.99, "le": 30.01}, "/plates/0/objects/1/bbox/size/2": {"ge": 9.99, "le": 10.01}}}, - // ---- The Split to Objects tile on the selected object of two shells ---- + // ---- The Split to Objects action on the selected object of two shells ---- {"tool": "project_import", "args": {"paths": ["${vars.two_shells}"]}, "expect": {"/added": {"eq": 1}}}, {"tool": "object_select", "args": {"objects": [4]}}, {"tool": "action_run", "args": {"id": "orca_command:obj_split_objects:orca"}, diff --git a/tools/mcp/tests/ops_export_gcode.json b/tools/mcp/tests/ops_export_gcode.json index bfe3abda29..e8d136b142 100644 --- a/tools/mcp/tests/ops_export_gcode.json +++ b/tools/mcp/tests/ops_export_gcode.json @@ -1,6 +1,6 @@ // Records what the G-code export, project_export with format gcode and a path, does: with no objects, on a plate // not sliced, with a plate index the project lacks, after a slice that ended with an error, a success, two exports -// started back to back, and while a slice runs (started by the slice_and_preview and slice_all tiles, which return +// started back to back, and while a slice runs (started by the slice_and_preview and slice_all actions, which return // at once). Each case exports once, to a file named for it. A replay step returns once a short export has // finished, so the two started back to back run one after the other; overlapping calls need two clients. Every // call it records is optional, so a refusal is kept in result.json with its text, and each is followed by the @@ -78,7 +78,7 @@ {"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/twice_2.gcode", "plates": 999}, "optional": true}, {"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}}, - // ---- While a slice runs: the slice_and_preview tile, then slice_all, both return at once ---- + // ---- While a slice runs: the slice_and_preview action, then slice_all, both return at once ---- {"tool": "project_new", "args": {"discard_changes": true}}, {"tool": "project_import", "args": {"paths": ["${vars.benchy}"]}, "expect": {"/added": {"eq": 1}}}, {"tool": "app_wait", "args": {"for": "idle"}}, diff --git a/tools/mcp/tests/ops_import_models.json b/tools/mcp/tests/ops_import_models.json index 82db607eca..819c04d62f 100644 --- a/tools/mcp/tests/ops_import_models.json +++ b/tools/mcp/tests/ops_import_models.json @@ -5,7 +5,7 @@ // the last two opening a warning and an error, which it answers). After each it reads the objects, the project's // name and file, the selected presets and their unsaved keys, the recent projects (action_search) and the // dialogs, then the undo snapshots taken since the last read (fixtures/ops_undo.py), and runs undo once to show -// what that step takes back. Last, File > Import (the import_file tile) with a rule that answers its picker with +// what that step takes back. Last, File > Import (the import_file action) with a rule that answers its picker with // a path: the picker is multi-select, which takes no path, so it is cancelled. Every call it records is optional. // Run it with // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_import_models.json --out diff --git a/tools/mcp/tests/ops_new_project.json b/tools/mcp/tests/ops_new_project.json index 322edb8281..af38dd09cc 100644 --- a/tools/mcp/tests/ops_new_project.json +++ b/tools/mcp/tests/ops_new_project.json @@ -1,8 +1,8 @@ -// Records what a new project does through its two forms, the person's (the new_project tile run with action_run) +// Records what a new project does through its two forms, the person's (the new_project action run with action_run) // and the silent one (project_new called with arguments): on a clean project, with unsaved project changes (a -// cube; silent: true, then discard_changes) and with unsaved preset changes (top_shell_layers 7; the tile's +// cube; silent: true, then discard_changes) and with unsaved preset changes (top_shell_layers 7; the action's // question answered Discard, then Transfer when it offers that, and preset_changes keep and discard). Each call starts from the -// Home tab, so the reads show the tab it leaves. The tile runs with "await": false; app_state lists its +// Home tab, so the reads show the tab it leaves. The action runs with "await": false; app_state lists its // question, which the replay answers by its title. After each it reads the objects, the project, the presets' // unsaved keys and the undo snapshots taken since the last read (fixtures/ops_undo.py). Plugins get the // NewProject event on both routes, which no replay can observe without a plugin. Every call it records is @@ -16,7 +16,7 @@ {"tool": "app_wait", "args": {"for": "ready"}}, {"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}}, - // ---- A clean project: the tile, then the command ---- + // ---- A clean project: the action, then the command ---- {"tool": "view_set", "args": {"tab": "home"}}, {"tool": "app_wait", "args": {"for": "idle"}}, {"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}}, @@ -32,7 +32,7 @@ {"tool": "app_state"}, {"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}}, - // ---- Unsaved project changes: the tile asks ---- + // ---- Unsaved project changes: the action asks ---- {"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}}, {"tool": "view_set", "args": {"tab": "home"}}, {"tool": "app_wait", "args": {"for": "idle"}}, @@ -59,7 +59,7 @@ {"tool": "object_list"}, {"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}}, - // ---- Unsaved preset changes, no objects: the tile, answered Discard ---- + // ---- Unsaved preset changes, no objects: the action, answered Discard ---- {"tool": "settings_set", "args": {"values": {"top_shell_layers": 7}}}, {"tool": "view_set", "args": {"tab": "home"}}, {"tool": "app_wait", "args": {"for": "idle"}}, diff --git a/tools/mcp/tests/ops_select_plate.json b/tools/mcp/tests/ops_select_plate.json index 4754309479..b3e9499e61 100644 --- a/tools/mcp/tests/ops_select_plate.json +++ b/tools/mcp/tests/ops_select_plate.json @@ -1,5 +1,5 @@ // Records how a plate is selected: plate_select with a plate in range, past the last plate and negative -// (refused), not a number and not a whole number (refused), and its plate_goto tile (plate 0), and each command +// (refused), not a number and not a whole number (refused), and its plate_goto action (plate 0), and each command // that takes a plate index given one the project lacks (plate_slice, project_export, object_arrange, // plate_rename and plate_get_settings, object_list, object_transform) and given one it has. After each it // reads the current plate (app_state, plate_list) and the undo snapshots taken since the last read @@ -22,7 +22,7 @@ {"tool": "app_state"}, {"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}}, - // ---- plate_select: in range, past the last, negative, not a number, not a whole number; the tile ---- + // ---- plate_select: in range, past the last, negative, not a number, not a whole number; the action ---- {"tool": "plate_select", "args": {"plate": 1}, "optional": true}, {"tool": "app_state"}, {"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}}, diff --git a/tools/mcp/tests/ops_send_gcode_to_host.json b/tools/mcp/tests/ops_send_gcode_to_host.json index 1efd828817..4a094e18ec 100644 --- a/tools/mcp/tests/ops_send_gcode_to_host.json +++ b/tools/mcp/tests/ops_send_gcode_to_host.json @@ -1,4 +1,4 @@ -// Records the refusals of the send_gcode tile (action_run), and nothing else: it never sets a print host, so +// Records the refusals of the send_gcode action (action_run), and nothing else: it never sets a print host, so // nothing is ever sent. A Bambu network printer (the harness's X1 Carbon as it starts, then with // bbl_use_printhost off) with no objects, on a plate not sliced and on a sliced one; then the same printer set // to print through a host (bbl_use_printhost on, OctoPrint) with no host address, sliced, not sliced and with no diff --git a/tools/mcp/tests/ops_set_instance_count.json b/tools/mcp/tests/ops_set_instance_count.json index 5d3fd67540..ae0e42e162 100644 --- a/tools/mcp/tests/ops_set_instance_count.json +++ b/tools/mcp/tests/ops_set_instance_count.json @@ -1,7 +1,7 @@ // Records what object_set_instances with a count does: nothing selected, one object, // two objects, one instance of an object, a part, counts of 1, 2 written as text, 0, negative, past 1000, a // fraction and a word, an object with an instance that is not printable, a cut object, and its obj_set_instances -// tile (it opens its dialog, which the replay cancels). After each it reads the objects' instances and the undo +// action (it opens its dialog, which the replay cancels). After each it reads the objects' instances and the undo // snapshots taken since the last read (fixtures/ops_undo.py), and once runs undo to show the change is one // step. Every call it records is optional. Run it with // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_set_instance_count.json --out @@ -85,7 +85,7 @@ {"tool": "widget_click", "args": {"target": {"row": "Plate 1>Cylinder", "column": "Printable"}}}, {"tool": "object_list", "expect": {"/plates/0/objects/1/instances/0/printable": {"eq": true}}}, - // ---- The tile: its dialog opens, and is cancelled ---- + // ---- The action: its dialog opens, and is cancelled ---- {"tool": "object_select", "args": {"objects": [1]}}, {"tool": "action_run", "args": {"id": "orca_command:obj_set_instances:orca"}, "await": false, "save_as": "dialog", "optional": true}, {"tool": "app_state"}, diff --git a/tools/mcp/tests/ops_set_plate_locked.json b/tools/mcp/tests/ops_set_plate_locked.json index 12dbfb1674..227b210870 100644 --- a/tools/mcp/tests/ops_set_plate_locked.json +++ b/tools/mcp/tests/ops_set_plate_locked.json @@ -1,4 +1,4 @@ -// Records how a plate is locked through its three routes: the plate_toggle_lock tile run with action_run (the +// Records how a plate is locked through its three routes: the plate_toggle_lock action run with action_run (the // current plate), plate_lock with locked, and a click on the plate's lock icon ({plate_icon: "lock", plate}). // Each is run twice on plate 0, then on plate 1 while plate 0 is current; plate_lock also with a plate the // project lacks. After each it reads the lock state and the current plate (plate_list) and the undo @@ -21,7 +21,7 @@ {"tool": "plate_list", "expect": {"/total": {"eq": 2}, "/items/0/current": {"eq": true}}}, {"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}}, - // ---- The tile, twice on plate 0 ---- + // ---- The action, twice on plate 0 ---- {"tool": "action_run", "args": {"id": "orca_command:plate_toggle_lock:orca"}, "optional": true}, {"tool": "plate_list"}, {"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}}, @@ -50,7 +50,7 @@ {"tool": "plate_list"}, {"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}}, - // ---- Plate 1 while plate 0 is current: plate_lock and the icon (the tile has no plate) ---- + // ---- Plate 1 while plate 0 is current: plate_lock and the icon (the action has no plate) ---- {"tool": "plate_lock", "args": {"plate": 1, "locked": true}, "optional": true}, {"tool": "plate_list"}, {"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}}, diff --git a/tools/mcp/tests/ops_show_layer_range.json b/tools/mcp/tests/ops_show_layer_range.json index b8373ed85c..34ae9c9d27 100644 --- a/tools/mcp/tests/ops_show_layer_range.json +++ b/tools/mcp/tests/ops_show_layer_range.json @@ -1,4 +1,4 @@ -// Records how the Preview's layers are set through its two routes, the go_to_layer tile run with +// Records how the Preview's layers are set through its two routes, the go_to_layer action run with // action_run and its percent (0, 50, 100, a fraction, and refused: past 100, negative, not a number, none) // and view_set's layer, layer_range and layer_z (in range, past the top, a layer_z above it): on plates the // Preview has no layers for (one with no objects, one whose slice fails validation: spiral vase with two @@ -57,7 +57,7 @@ {"tool": "app_state"}, {"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}}, - // ---- A sliced plate: the tile ---- + // ---- A sliced plate: the action ---- {"tool": "project_new", "args": {"discard_changes": true}}, {"tool": "view_set", "args": {"tab": "prepare"}}, {"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}}, @@ -83,7 +83,7 @@ {"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": 10}}, "optional": true}, {"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca"}, "optional": true}, {"tool": "app_state"}, - // the tile after view_set showed a range: does it keep the range's bottom? + // the action after view_set showed a range: does it keep the range's bottom? {"tool": "view_set", "args": {"layer_range": [20, 60]}, "optional": true}, {"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": 80}}, "optional": true}, {"tool": "app_state"}, diff --git a/tools/mcp/tests/ops_start_arrange.json b/tools/mcp/tests/ops_start_arrange.json index 3dbeee6e9a..c5952c5558 100644 --- a/tools/mcp/tests/ops_start_arrange.json +++ b/tools/mcp/tests/ops_start_arrange.json @@ -1,4 +1,4 @@ -// Records what an arrange does, object_arrange {} (Auto-Arrange's arguments; action_run of the obj_arrange tile runs +// Records what an arrange does, object_arrange {} (Auto-Arrange's arguments; action_run of the obj_arrange action runs // the same function) and object_arrange with one plate by index: with no objects, with two cubes on one spot, in the // assemble view, with the Move gizmo open, and with the plate locked. After each it reads the objects' offsets, // the tab, canvas and gizmo, and the undo snapshots taken since the last read (fixtures/ops_undo.py), and once diff --git a/tools/mcp/tests/ops_start_slice.json b/tools/mcp/tests/ops_start_slice.json index 152d5b47fb..123c1b7fd9 100644 --- a/tools/mcp/tests/ops_start_slice.json +++ b/tools/mcp/tests/ops_start_slice.json @@ -1,4 +1,4 @@ -// Records what starting a slice does through its routes, the slice_and_preview and slice_all tiles run with +// Records what starting a slice does through its routes, the slice_and_preview and slice_all actions run with // action_run (they return at once) and plate_slice (the current plate, all, an index): with no objects, on // one plate, on two plates, and with objects that fail validation (spiral vase on a plate with two objects). // Each call starts from the Prepare tab; after it, the replay waits for idle and reads the plates' slice state, diff --git a/tools/mcp/tests/plugins/mcp_web_fixture/mcp_web_fixture.py b/tools/mcp/tests/plugins/mcp_web_fixture/mcp_web_fixture.py index b7f16790db..90655378ef 100644 --- a/tools/mcp/tests/plugins/mcp_web_fixture/mcp_web_fixture.py +++ b/tools/mcp/tests/plugins/mcp_web_fixture/mcp_web_fixture.py @@ -16,7 +16,7 @@ panel" docks a small page beside the 3D view (the Prepare tab). The dialog scrip the Plugins dialog in its sandboxed frame. Each page logs what its controls saw into
,
 which the test reads back. "MCP web fixture thread" starts a thread, for which the host asks the
 threading permission in its permission prompt. "MCP web fixture page" is a page among the main window's
-tabs (TAB_PAGE), which the Go to tab tile shows by its id.
+tabs (TAB_PAGE), which the Go to tab action shows by its id.
 """
 import json
 import sys
@@ -161,7 +161,7 @@ PANEL = r"""
 

 """
 
-# A page among the main window's tabs, which the Go to tab tile reaches by its id.
+# A page among the main window's tabs, which the Go to tab action reaches by its id.
 TAB_PAGE = r"""
 

Fixture page

A plugin's page among the main window's tabs.

diff --git a/tools/mcp/tests/scene.json b/tools/mcp/tests/scene.json index 4a1e4a3aef..344db6503c 100644 --- a/tools/mcp/tests/scene.json +++ b/tools/mcp/tests/scene.json @@ -129,7 +129,7 @@ "/settings/rotate": {"eq": false}}}, {"tool": "object_list", "args": {"plate": 1}, "expect": {"/total": {"eq": 1}, "/plates/0/objects/0/name": {"eq": "Cylinder"}}}, {"tool": "object_list", "args": {"plate": 0}, "expect": {"/total": {"eq": 2}}}, - // every plate with the saved options, which is Auto-Arrange; the obj_arrange tile runs the same call and replies as it + // every plate with the saved options, which is Auto-Arrange; the obj_arrange action runs the same call and replies as it {"tool": "object_arrange", "args": {}, "expect": {"/settings/spacing": {"eq": 10}, "/off_plate": {"empty": true}}}, {"tool": "action_run", "args": {"id": "orca_command:obj_arrange:orca"}, "expect": {"/settings/spacing": {"eq": 10}, "/off_plate": {"empty": true}}}, // a Speed Dial command that does nothing (no selection) is an error step