Skip to content

Commit b1a714b

Browse files
wakonigCopilot
andcommitted
feat: add gui intro
Co-authored-by: Copilot <copilot@github.com>
1 parent 345658f commit b1a714b

2 files changed

Lines changed: 94 additions & 0 deletions

File tree

docs/learn/gui/introduction.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
related:
3+
- title: RPC GUI Control
4+
url: learn/gui/rpc-gui-control.md
5+
- title: Dock Area Profiles
6+
url: learn/gui/dock-area-profiles/index.md
7+
- title: Create Your First GUI
8+
url: getting-started/quick-start/06-create-your-first-gui.md
9+
- title: GUI how-to guides
10+
url: how-to/index.md
11+
---
12+
13+
# Introduction to BEC Widgets
14+
15+
BEC Widgets is a modular [Qt6](https://doc.qt.io/qt-6/qt-intro.html) GUI framework for beamline experiment control. Rather than providing
16+
one monolithic application, it is organized as a collection of independent, reusable widgets that
17+
can be assembled into task-specific interfaces, largely without any glue code.
18+
19+
## Independent by design
20+
21+
GUI applications in BEC always run in a separate OS process, even when started from the IPython client. They connect
22+
to the same Redis instance as the scan server and device server, but they never share memory or
23+
threads with the acquisition pipeline. This means heavy plotting, large datasets, or a momentary
24+
UI freeze cannot slow down a running scan or affect data acquisition. The worst case is a dropped
25+
frame in the GUI; the backend continues uninterrupted.
26+
27+
## How widgets receive live data
28+
29+
Widgets generally do not poll for updates. Instead, live data reaches the GUI through the BEC Dispatcher,
30+
which bridges BEC's event-driven Redis messages into Qt's signal/slot model. A widget developer
31+
declares which Redis endpoint should update which Qt slot; the Dispatcher handles subscription,
32+
message decoding, and thread-safe delivery to the GUI thread. This keeps widget implementations
33+
free of transport boilerplate while ensuring that data always arrives on the correct thread.
34+
35+
## Remote control and scripting
36+
37+
BEC Widgets are designed to be fully controllable from scripts and the IPython client through Remote Procedure Calls (RPC). Every widget exposes a public API of methods and properties that can be accessed remotely. This allows users to automate GUI interactions, build custom workflows that combine data analysis with live plot updates, or switch GUI profiles in response to scan state changes. The BEC IPython client provides a convenient interface for connecting to running GUI instances and accessing their widgets. Users do not have to choose between a graphical interface and command-line control; they can have both at the same time, with seamless integration between them.
38+
39+
## Developing with BEC Widgets
40+
41+
BEC Widgets supports four complementary development paths, all built on the same widget set and
42+
event-driven backend.
43+
44+
### Assemble graphically in BEC Designer
45+
46+
BEC Designer is a thin wrapper around Qt Designer that makes every BEC widget available as a
47+
designer plugin. Plugins are auto-generated from widget classes, so new widgets appear
48+
automatically without extra effort. Because BEC widgets expose Qt properties and signals/slots,
49+
properties are editable in Designer's property panel and inter-widget connections can be wired
50+
visually. BEC Widgets can be freely combined with standard Qt widgets to build larger and
51+
bespoke interfaces, tailored to specific experiment needs. The resulting `.ui` files can be
52+
launched directly with the BEC Widgets launcher, giving teams a running Redis-connected
53+
application without writing any Python.
54+
55+
### Assemble graphically in the Dock Area and save profiles
56+
57+
From the BEC Launcher, you can work with a Dock Area either in `Terminal + Dock` mode or in the
58+
BEC App's Dock Area. In `Terminal + Dock`, the Dock Area is immediately available as `gui.bec`
59+
next to the IPython client. Users add widgets from the
60+
toolbar menus, adjust their settings, rearrange and tear out panels, and save the result as a
61+
reusable profile. This mode keeps the terminal as the primary control interface while graphical
62+
widgets provide richer views of plots, queues, and device state. It is the mode used throughout
63+
the quick-start tutorials.
64+
65+
### Script appearance and behavior through RPC
66+
67+
The BEC IPython client exposes [RPC control](./rpc-gui-control.md){data-preview} over any running GUI. Each GUI application is
68+
identified by a `gui_id`, and the IPython client can connect to any running instance by that ID.
69+
The object access pattern follows the Qt parent/child hierarchy, making it easy to reach any
70+
widget from the command line. Scripting RPC calls is the natural mode for automating GUI
71+
interactions, switching profiles in response to scan state, or building experiment workflows that
72+
combine data analysis with live plot updates. This is also the mode to script how a GUI should
73+
look at runtime: create docks and widgets, set titles and labels, configure curves, and load
74+
profiles programmatically.
75+
76+
### Write custom widgets by inheriting from `BECWidget`
77+
78+
When built-in widgets are not enough, you can create your own widget by subclassing `BECWidget`.
79+
This gives you the standard BEC integration points out of the box, including dispatcher-based live
80+
data updates, Qt property support, and RPC exposure for user-facing methods. In practice, this path
81+
is used to build beamline-specific views that can then be reused in BEC Designer, the Dock Area,
82+
and scripted RPC workflows.
83+
84+
## What to read next
85+
86+
- [RPC GUI Control](rpc-gui-control.md) explains how the BEC IPython client communicates with
87+
running widgets and how the CLI namespace is constructed from the Qt widget hierarchy.
88+
- [Dock Area Profiles](dock-area-profiles/index.md) explains how GUI workspace configurations are
89+
saved, restored, and shared across e-accounts.
90+
- [Create Your First GUI](../../getting-started/quick-start/06-create-your-first-gui.md) is a
91+
hands-on tutorial that walks through opening a dock area, adding widgets, and running a scan.
92+
- [Introduction to Qt](https://doc.qt.io/qt-6/qt-intro.html) can help if you want to understand the
93+
underlying GUI framework that BEC Widgets is built on.

zensical.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ nav = [
124124
#{ "Operations and deployment" = [ TODO fill with content
125125
#] },
126126
{ "GUI" = [
127+
{ "Introduction" = "learn/gui/introduction.md" },
127128
{ "Dock Area Profiles" = [
128129
"learn/gui/dock-area-profiles/index.md",
129130
{ "Runtime and Baseline Copies" = "learn/gui/dock-area-profiles/runtime-and-baseline-copies.md" },

0 commit comments

Comments
 (0)