Skip to content

Commit 39205d3

Browse files
committed
index.bob: separate title logic from per-controller screens
- Per-controller screens always use their own PV prefix as title - index.bob title uses EpicsGUIOptions.title if set, otherwise falls back to the first root controller's PV prefix or 'FastCS Devices' - Setting title='' suppresses the title widget entirely (via pvi's new without_title() path when Device.label is empty) - Document the ~30-character truncation limit in EpicsGUIOptions.title
1 parent a1f2bf2 commit 39205d3

4 files changed

Lines changed: 23 additions & 20 deletions

File tree

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ requires-python = ">=3.11"
3434

3535
[project.optional-dependencies]
3636
demo = ["tickit~=0.4.3"]
37-
epicsca = ["pvi==0.14.0b1", "softioc>=4.5.0"]
38-
epicspva = ["p4p", "pvi==0.14.0b1"]
37+
epicsca = ["pvi==0.14.0b3", "softioc>=4.5.0"]
38+
epicspva = ["p4p", "pvi==0.14.0b3"]
3939
epics = ["fastcs[epicsca]", "fastcs[epicspva]"]
4040
tango = ["pytango"]
4141
graphql = ["strawberry-graphql", "uvicorn[standard]>=0.12.0"]

src/fastcs/transports/epics/emission.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ def emit_gui_files(
121121
controller_path = (output_dir / ui_filename).resolve()
122122

123123
device = gui_builder(api).build_device(
124-
options.title
125-
if options.title is not None
126-
else (api.path[0] if api.path else "FastCS Devices")
124+
api.path[0] if api.path else "FastCS Devices"
127125
)
128126
formatter.format(device, controller_path)
129127

@@ -138,15 +136,13 @@ def emit_gui_files(
138136
)
139137

140138
index_path = (output_dir / f"{INDEX_STEM}{ext}").resolve()
141-
index_title = (
142-
options.title
143-
if options.title is not None
144-
else (
145-
controller_apis[0].path[0]
146-
if controller_apis and controller_apis[0].path
147-
else "FastCS Devices"
148-
)
149-
)
139+
if options.title is not None:
140+
# Explicit title: use as-is (empty string suppresses the title widget)
141+
index_title = options.title
142+
elif controller_apis and controller_apis[0].path:
143+
index_title = controller_apis[0].path[0]
144+
else:
145+
index_title = "FastCS Devices"
150146
formatter.format(Device(label=index_title, children=refs), index_path)
151147

152148

src/fastcs/transports/epics/options.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@ class EpicsGUIOptions:
2929
output_dir: Path = Path(".")
3030
file_format: EpicsGUIFormat = EpicsGUIFormat.bob
3131
title: str | None = None
32-
"""Screen title. Defaults to the controller id when not provided."""
32+
"""Index screen title.
33+
34+
``None`` (default): use the root controller PV prefix, or ``"FastCS Devices"``
35+
if no root controller is present. Set to ``""`` to suppress the title widget
36+
entirely.
37+
38+
Note: titles longer than about 30 characters may be truncated in the
39+
generated ``.bob`` screen."""
3340

3441

3542
@dataclass

uv.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)