Skip to content

feat(laser): move the Test Settings into the layer settings dialog - #707

Open
knipknap wants to merge 2 commits into
mainfrom
feat/test-layers
Open

knipknap wants to merge 2 commits into
mainfrom
feat/test-layers

Conversation

@knipknap

@knipknap knipknap commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Resolves the follow-ups named in the last comment on PR #539:

I found two potential future improvements: Tests settings are sometimes not discoverable; clicking a test object shows them in the properties panel, but often out of the view. Also, since tests are essentially layers, this could be solved by improving the underlying architecture, officially introducing the concept of test layers with layer-type specific settings in the layer settings dialog. We could then move the test settings into the layer settings, and lock test layers so other workpieces cannot be placed in them.

What changes

Layer types (core). Layer gains a layer_type string that is saved with the project. Addons register what their kinds of layers mean in a new core registry (rayforge/core/layer_types.py): a title, an icon and whether the layer accepts other workpieces. Unknown or empty types behave like ordinary layers, so projects open with or without the generating addon, and files saved by older versions load unchanged.

Settings in the layer dialog (UI). Addons can contribute sections to the LayerSettingsDialog through a new registry (layer_settings_sections.py), mirroring the property-provider pattern including cleanup on addon unload. Each section decides per layer whether it applies.

Calibration tests (laser addon).

  • Creating a test sets the layer type calibration_test on its layer and registers it as a locked kind. The layer's settings dialog shows the test's parameters under Test Settings (help/warning/error/note rows plus the generator VarSet), above General and Rotary.
  • Tools → Create … now opens the dialog right away, and every change there still rebuilds the test as one undo entry, reselecting the rebuilt workpieces.
  • The editing loop moved into CalibrationSettingsController, shared by the dialog section; the item-properties Test Settings card is now a slim pointer with an Open Layer Settings button (and the scroll-into-view behavior is kept), which resolves the discoverability complaint.
  • record_for_layer finds a test's record by layer uid, including the legacy derivation for pre-feat: add Interval Test and Focus Test generators to the Tools menu #539 Material Test Grids, so their settings also show in the dialog.

Locked layers. Paste, import, duplicate, array and drag-and-drop refuse to place other workpieces into a locked layer, with a notification (layer_cmd, edit_cmd, array_cmd, and the layer column's drop targets show the no-drop cursor). Moving a cell out of a test, deleting one, or adding operations to the layer still works, as the rebuild logic supports today.

Tests

  • New: tests/core/test_layer_types.py, layer-type serialization tests, locked-layer guards in test_layer_cmd.py/test_edit_cmd.py, record_for_layer (incl. legacy) in test_calibration_tests.py.
  • Rewritten: test_calibration_provider.py (controller + section + slim card) and the main-window tests tests/ui_gtk/doceditor/test_calibration_test_settings.py (dialog opens on create, edits in the dialog rebuild and keep the selection).
  • Full suite green: lint clean, pixi run test 7902 passed, pixi run uitest 1292 passed (run under Xvfb).

Docs

interval-and-focus-tests.md and material-test-grid.md updated in all 7 languages, the three test screenshots regenerated (they now show the layer settings dialog), and a changelog entry added.

The last comment on PR #539 asked for the concept of test layers: the
calibration tests are layers, so their settings belong with the other
layer settings, and their layers should not take other workpieces.

Layers now carry a layer type, saved with the project. Addons register
what their types mean in a new core registry: a title, an icon and
whether the layer accepts other workpieces. Addons also contribute
sections to the layer settings dialog through a new UI registry, so a
kind of layer brings its own settings into the dialog.

The laser addon uses this for the calibration tests. Creating a test
now opens the settings dialog of its layer, where its parameters appear
under Test Settings and every change still rebuilds the test in one
undo entry. The card in the item properties panel points to the dialog,
with an Open Layer Settings button, and creation selects the test as
before. The settings edit loop moved into a controller shared by the
dialog section.

The test's layer is registered as a Calibration Test layer and locked:
paste, import, duplicate, array and drag-and-drop refuse to place other
workpieces in it, with a notification explaining why. Moving a cell out
of the test or deleting one stays possible, and steps added to the
layer keep surviving rebuilds. Legacy Material Test Grids have no layer
type yet and keep behaving as before until their first parameter
change; projects saved by older versions open unchanged.

The calibration docs, in every language, and the test screenshots
describe the new settings location and the locked layers.
Creating a test no longer opens the settings dialog: it appeared
exactly over the new test and hid it, and GTK4 offers no say in where
a dialog lands. The card in the item properties panel is the way in.

The card is now a proper action row, and the first row of the item
properties: an activatable Open Layer Settings row whose subtitle
explains what the workpiece is, with a chevron like the other
navigating rows. It no longer floats as its own box.

The layer settings dialog stops growing with its content and scrolls
instead, and its Test Settings group drops the subtitle that repeated
the dialog title. The screenshots show the compact dialog.

This branch was successfully deployed

1 active deployment
pypi — 48d819c2 Deployed Nov 15, 2026 by knipknap via Build and Publish Wheel #2660
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant