Tutorials: update to texts, regesitering tutorial and actions

This commit is contained in:
appleb_m committed 2026-03-10 17:41:29 +01:00
1 parent 015dccc90d
commit ab80110d05
3 files changed
+90 -94

No files matched your search

@@ -39,11 +39,4 @@ class TutorialActionExecutor:
_set_nested_value(context.state, path, value)
return
if action_id == "set_demo_sample":
sample_name = str(params.get("sample_name", "demo_sample"))
_set_nested_value(context.state, "demo.sample_name", sample_name)
_set_nested_value(context.state, "demo.selected_sample", None)
_set_nested_value(context.state, "demo.sample_mounted", False)
return
raise ValueError(f"Unknown tutorial action: {action_id}")
+14 -12
View File
@@ -1,8 +1,6 @@
from __future__ import annotations
from aare.gui.tutorials.tutorial_models import (
CompletionKind,
CompletionRule,
StepFlow,
StepKind,
TargetKind,
@@ -29,11 +27,15 @@ def register_tutorials(window, tutorial_manager) -> None:
id="welcome",
kind=StepKind.INFO,
title=TutorialTextRef("tutorial.manual.welcome.title"),
body=TutorialTextRef("tutorial.manual.welcome.body"),
body=TutorialTextRef(
"tutorial.manual.welcome.body",
{"sample_name": "test_sample", "sample_position": "X1-2"},
),
flow=StepFlow.NEXT_ONLY,
setup_actions=[
TutorialAction("enter_demo_mode"),
TutorialAction("set_demo_sample", {"sample_name": "demo_sample"}),
TutorialAction("set_context_state", {"path": "demo.sample_name", "value": "test_sample"}),
TutorialAction("set_context_state", {"path": "demo.sample_position", "value": "X1-2"}),
],
),
TutorialStepDefinition(
@@ -42,37 +44,37 @@ def register_tutorials(window, tutorial_manager) -> None:
title=TutorialTextRef("tutorial.manual.sample_list.title"),
body=TutorialTextRef(
"tutorial.manual.sample_list.body",
{"sample_name": "demo_sample"},
{"sample_name": "test_sample", "sample_position": "X1-2"},
),
target=TutorialTarget(TargetKind.WIDGET, "tell_samples"),
flow=StepFlow.NEXT_ONLY,
),
TutorialStepDefinition(
id="select_demo_sample",
id="select_sample",
kind=StepKind.INFO,
title=TutorialTextRef("tutorial.manual.select_sample.title"),
body=TutorialTextRef(
"tutorial.manual.select_sample.body",
{"sample_name": "demo_sample"},
{"sample_name": "test_sample"},
),
target=TutorialTarget(TargetKind.WIDGET, "tell_samples"),
hint=TutorialTextRef("tutorial.manual.select_sample.hint"),
target=TutorialTarget(TargetKind.WIDGET, "tell_samples"),
flow=StepFlow.NEXT_ONLY,
),
TutorialStepDefinition(
id="mount_demo_sample",
id="mount_sample",
kind=StepKind.INFO,
title=TutorialTextRef("tutorial.manual.mount.title"),
body=TutorialTextRef(
"tutorial.manual.mount.body",
{"sample_name": "demo_sample"},
{"sample_name": "test_sample"},
),
hint=TutorialTextRef("tutorial.manual.mount.hint"),
target=TutorialTarget(TargetKind.WIDGET, "tell_samples"),
flow=StepFlow.NEXT_ONLY,
),
TutorialStepDefinition(
id="sample_camera_intro",
id="sample_camera",
kind=StepKind.INFO,
title=TutorialTextRef("tutorial.manual.sample_camera.title"),
body=TutorialTextRef("tutorial.manual.sample_camera.body"),
@@ -81,7 +83,7 @@ def register_tutorials(window, tutorial_manager) -> None:
flow=StepFlow.NEXT_ONLY,
),
TutorialStepDefinition(
id="beamline_controls_intro",
id="beamline_controls",
kind=StepKind.INFO,
title=TutorialTextRef("tutorial.manual.beamline_controls.title"),
body=TutorialTextRef("tutorial.manual.beamline_controls.body"),
+76 -75
View File
@@ -1,90 +1,91 @@
MANUAL_MOUNT_TUTORIAL = {
"en": {
"tutorial.manual.title": "Manual workflow demo",
"tutorial.manual.description": "A guided walkthrough of the manual data-collection workflow.",
"en": {
"tutorial.manual.title": "Manual workflow tutorial",
"tutorial.manual.description": "A guided walkthrough of the manual sample-centering and collection workflow.",
"tutorial.manual.welcome.title": "Welcome",
"tutorial.manual.welcome.body": (
"This tutorial is a safe guided demo of the manual workflow. "
"It teaches the interface and intended workflow."
),
"tutorial.manual.welcome.title": "Welcome",
"tutorial.manual.welcome.body": (
"This tutorial walks through the manual workflow using the test sample "
"'{sample_name}' in position {sample_position}. "
"It is intended to teach the interface and the normal order of operations."
),
"tutorial.manual.sample_list.title": "Sample list",
"tutorial.manual.sample_list.body": (
"This is the sample list. For this tutorial, imagine working with "
"'{sample_name}'."
),
"tutorial.manual.sample_list.title": "Sample list",
"tutorial.manual.sample_list.body": (
"This is the sample list. For this tutorial, look for '{sample_name}' "
"in position {sample_position}."
),
"tutorial.manual.select_sample.title": "Selecting a sample",
"tutorial.manual.select_sample.body": (
"Normally, you begin by selecting your sample in the sample list."
),
"tutorial.manual.select_sample.hint": (
"In the full interactive tutorial, this step can later be validated from a real selection event."
),
"tutorial.manual.select_sample.title": "Selecting a sample",
"tutorial.manual.select_sample.body": (
"Start by selecting '{sample_name}' in the sample list."
),
"tutorial.manual.select_sample.hint": (
"Later we can validate this step from a real selection event."
),
"tutorial.manual.mount.title": "Mounting a sample",
"tutorial.manual.mount.body": (
"To mount a sample, select it, right-click it, and choose the mount action."
),
"tutorial.manual.mount.hint": (
"For now this tutorial explains the workflow without requiring a real mount action."
),
"tutorial.manual.mount.title": "Mounting the sample",
"tutorial.manual.mount.body": (
"To mount the sample, right-click '{sample_name}' and choose the mount action."
),
"tutorial.manual.mount.hint": (
"This is the real workflow: select the sample, right-click it, and mount it from the context menu."
),
"tutorial.manual.sample_camera.title": "Sample camera",
"tutorial.manual.sample_camera.body": (
"This is the main sample camera view. The orange square marks the beam position. "
"Left-clicking on the sample moves the smargon so that point is brought to the beam."
),
"tutorial.manual.sample_camera.hint": (
"You can also use the mouse wheel here to rotate omega in 90° steps."
),
"tutorial.manual.sample_camera.title": "Sample camera",
"tutorial.manual.sample_camera.body": (
"This is the main sample camera view. The orange square is the beam marker. "
"Left-clicking on the sample moves the smargon so that the selected point moves to the beam position."
),
"tutorial.manual.sample_camera.hint": (
"You can also use the mouse wheel here to rotate omega by 90° steps."
),
"tutorial.manual.beamline_controls.title": "Beamline controls",
"tutorial.manual.beamline_controls.body": (
"Additional controls for sample motion, lighting, zoom, and alignment are available here."
),
"tutorial.manual.beamline_controls.title": "Beamline controls",
"tutorial.manual.beamline_controls.body": (
"Additional controls for sample motion, lighting, zoom, and alignment are available in this panel."
),
"tutorial.manual.auto_loop_center.title": "Auto loop centering",
"tutorial.manual.auto_loop_center.body": (
"This button runs automatic loop centering and can help position the sample automatically."
),
"tutorial.manual.auto_loop_center.title": "Auto loop centering",
"tutorial.manual.auto_loop_center.body": (
"This button runs automatic loop centering. It can help bring the sample into position automatically."
),
"tutorial.manual.ml_box.title": "ML box for raster generation",
"tutorial.manual.ml_box.body": (
"This button uses ML box detection to generate a raster region automatically."
),
"tutorial.manual.ml_box.title": "ML box raster generation",
"tutorial.manual.ml_box.body": (
"This button uses the ML box tool to generate a raster region automatically from the camera image."
),
"tutorial.manual.raster_parameters.title": "Raster parameters",
"tutorial.manual.raster_parameters.body": (
"Here you can change raster collection parameters such as exposure, transmission, "
"grid size, and related scan settings."
),
"tutorial.manual.raster_parameters.title": "Raster parameters",
"tutorial.manual.raster_parameters.body": (
"Here you can change raster collection parameters such as exposure, transmission, "
"grid size, and other raster settings before evaluating the scan."
),
"tutorial.manual.raster_canvas.title": "Drawing a raster",
"tutorial.manual.raster_canvas.body": (
"You can draw a raster grid in the sample camera view using the mouse."
),
"tutorial.manual.raster_canvas.hint": (
"You mentioned using right-click for raster drawing, so this is a good place to teach that gesture explicitly."
),
"tutorial.manual.raster_canvas.title": "Drawing a raster",
"tutorial.manual.raster_canvas.body": (
"You can draw a raster grid in the sample camera view using the mouse."
),
"tutorial.manual.raster_canvas.hint": (
"Use the mouse right-click workflow you described to create the raster region on the sample."
),
"tutorial.manual.rotation_parameters.title": "Rotation parameters",
"tutorial.manual.rotation_parameters.body": (
"This panel contains rotation scan parameters. You can change values, reload parameters "
"from the database, or override them with user-defined values."
),
"tutorial.manual.rotation_parameters.title": "Rotation parameters",
"tutorial.manual.rotation_parameters.body": (
"This panel contains rotation scan parameters. You can change the values, "
"reload parameters from the database, or override them with user-defined values."
),
"tutorial.manual.simple_collection.title": "Simple data collection",
"tutorial.manual.simple_collection.body": (
"This panel contains simplified collection parameters for quick data collection setup."
),
"tutorial.manual.simple_collection.title": "Simple data collection",
"tutorial.manual.simple_collection.body": (
"This panel contains simplified data-collection parameters for quick collection setup."
),
"tutorial.manual.file_names.title": "File names and paths",
"tutorial.manual.file_names.body": (
"Here you can review output paths and file naming before collection. "
"This is also a good place to explain how filenames are built."
),
}
}
"tutorial.manual.file_names.title": "File names and paths",
"tutorial.manual.file_names.body": (
"Here you can review filenames and output paths before collection. "
"This is where you should explain how filenames are constructed and where data will be written."
),
}
}