bec-widgets 0.56.3__py3-none-any.whl → 0.57.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
CHANGELOG.md CHANGED
@@ -2,6 +2,30 @@
2
2
 
3
3
 
4
4
 
5
+ ## v0.57.1 (2024-06-06)
6
+
7
+ ### Documentation
8
+
9
+ * docs: docs refactored from add_widget_bec to add_widget ([`c3f4845`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/c3f4845b4f95005ff737fed5542600b0b9a9cc2b))
10
+
11
+ ### Fix
12
+
13
+ * fix: tests references to add_widget_bec refactored ([`f51b25f`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/f51b25f0af4ab8b0a75ee48a40bfbb079c16e9d1))
14
+
15
+ * fix(dock): add_widget and add_widget_bec consolidated ([`8ae323f`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/8ae323f5c3c0d9d0f202d31d5e8374a272a26be2))
16
+
17
+
18
+ ## v0.57.0 (2024-06-05)
19
+
20
+ ### Documentation
21
+
22
+ * docs: extend user documentation for BEC Widgets ([`4160f3d`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/4160f3d6d7ec1122785b5e3fdfc4afe67a95e9a1))
23
+
24
+ ### Feature
25
+
26
+ * feat(widgets/console): BECJupyterConsole added ([`8c03034`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/8c03034acf6b3ed1e346ebf1b785d41068513cc5))
27
+
28
+
5
29
  ## v0.56.3 (2024-06-05)
6
30
 
7
31
  ### Ci
@@ -149,27 +173,3 @@
149
173
  ### Fix
150
174
 
151
175
  * fix(docstrings): docstrings formating fixed for sphinx to properly format readdocs ([`7f2f7cd`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/7f2f7cd07a14876617cd83cedde8c281fdc52c3a))
152
-
153
-
154
- ## v0.52.0 (2024-05-07)
155
-
156
- ### Ci
157
-
158
- * ci: fixed support for child pipelines ([`e65c7f3`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/e65c7f3be895ada407bd358edf67d569d2cab08e))
159
-
160
- ### Feature
161
-
162
- * feat(utils/layout_manager): added GridLayoutManager to extend functionalities of native QGridLayout ([`fcd6ef0`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/fcd6ef0975dc872f69c9d6fb2b8a1ad04a423aae))
163
-
164
- * feat(widget/dock): BECDock and BECDock area for dockable windows ([`d8ff8af`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/d8ff8afcd474660a6069bbdab05f10a65f221727))
165
-
166
- ### Fix
167
-
168
- * fix(widgets/dock): BECDockArea close overwrites the default pyqtgraph Container close + minor improvements ([`ceae979`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/ceae979f375ecc33c5c97148f197655c1ca57b6c))
169
-
170
- ### Refactor
171
-
172
- * refactor(widget/plots): WidgetConfig changed to SubplotConfig ([`03fa1f2`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/03fa1f26d0fa6b58ed05556fb2438d1e62f6c107))
173
-
174
-
175
- ## v0.51.0 (2024-05-07)
PKG-INFO CHANGED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.56.3
3
+ Version: 0.57.1
4
4
  Summary: BEC Widgets
5
5
  Project-URL: Bug Tracker, https://gitlab.psi.ch/bec/bec_widgets/issues
6
6
  Project-URL: Homepage, https://gitlab.psi.ch/bec/bec_widgets
@@ -30,7 +30,7 @@ class AutoUpdates:
30
30
  Create a default dock for the auto updates.
31
31
  """
32
32
  dock = self.gui.add_dock("default_figure")
33
- dock.add_widget_bec("BECFigure")
33
+ dock.add_widget("BECFigure")
34
34
  self.dock_name = "default_figure"
35
35
 
36
36
  @staticmethod
bec_widgets/cli/client.py CHANGED
@@ -1468,20 +1468,20 @@ class BECDock(RPCBase):
1468
1468
  """
1469
1469
 
1470
1470
  @rpc_call
1471
- def add_widget_bec(
1471
+ def add_widget(
1472
1472
  self,
1473
- widget_type: "str",
1473
+ widget: "BECConnector | str",
1474
1474
  row=None,
1475
1475
  col=0,
1476
1476
  rowspan=1,
1477
1477
  colspan=1,
1478
1478
  shift: "Literal['down', 'up', 'left', 'right']" = "down",
1479
- ):
1479
+ ) -> "BECConnector":
1480
1480
  """
1481
1481
  Add a widget to the dock.
1482
1482
 
1483
1483
  Args:
1484
- widget_type(str): The widget to add. Only BEC RPC widgets from RPCWidgetHandler are allowed.
1484
+ widget(QWidget): The widget to add.
1485
1485
  row(int): The row to add the widget to. If None, the widget will be added to the next available row.
1486
1486
  col(int): The column to add the widget to.
1487
1487
  rowspan(int): The number of rows the widget should span.
@@ -12,22 +12,22 @@ from qtpy.QtWidgets import QApplication, QVBoxLayout, QWidget
12
12
  from bec_widgets.utils import BECDispatcher, UILoader
13
13
  from bec_widgets.widgets import BECFigure
14
14
  from bec_widgets.widgets.dock.dock_area import BECDockArea
15
-
16
-
17
- class JupyterConsoleWidget(RichJupyterWidget): # pragma: no cover:
18
- def __init__(self):
19
- super().__init__()
20
-
21
- self.kernel_manager = QtInProcessKernelManager()
22
- self.kernel_manager.start_kernel(show_banner=False)
23
- self.kernel_client = self.kernel_manager.client()
24
- self.kernel_client.start_channels()
25
-
26
- self.kernel_manager.kernel.shell.push({"np": np, "pg": pg})
27
-
28
- def shutdown_kernel(self):
29
- self.kernel_client.stop_channels()
30
- self.kernel_manager.shutdown_kernel()
15
+ from bec_widgets.widgets.jupyter_console.jupyter_console import BECJupyterConsole
16
+
17
+ # class JupyterConsoleWidget(RichJupyterWidget): # pragma: no cover:
18
+ # def __init__(self):
19
+ # super().__init__()
20
+ #
21
+ # self.kernel_manager = QtInProcessKernelManager()
22
+ # self.kernel_manager.start_kernel(show_banner=False)
23
+ # self.kernel_client = self.kernel_manager.client()
24
+ # self.kernel_client.start_channels()
25
+ #
26
+ # self.kernel_manager.kernel.shell.push({"np": np, "pg": pg})
27
+ #
28
+ # def shutdown_kernel(self):
29
+ # self.kernel_client.stop_channels()
30
+ # self.kernel_manager.shutdown_kernel()
31
31
 
32
32
 
33
33
  class JupyterConsoleWindow(QWidget): # pragma: no cover:
@@ -45,25 +45,25 @@ class JupyterConsoleWindow(QWidget): # pragma: no cover:
45
45
  self.safe_close = False
46
46
 
47
47
  # console push
48
- self.console.kernel_manager.kernel.shell.push(
49
- {
50
- "fig": self.figure,
51
- "dock": self.dock,
52
- "w1": self.w1,
53
- "w2": self.w2,
54
- "w3": self.w3,
55
- "d0": self.d0,
56
- "d1": self.d1,
57
- "d2": self.d2,
58
- "fig0": self.fig0,
59
- "fig1": self.fig1,
60
- "fig2": self.fig2,
61
- "bar": self.bar,
62
- "bec": self.figure.client,
63
- "scans": self.figure.client.scans,
64
- "dev": self.figure.client.device_manager.devices,
65
- }
66
- )
48
+ if self.console.inprocess is True:
49
+ self.console.kernel_manager.kernel.shell.push(
50
+ {
51
+ "np": np,
52
+ "pg": pg,
53
+ "fig": self.figure,
54
+ "dock": self.dock,
55
+ "w1": self.w1,
56
+ "w2": self.w2,
57
+ "w3": self.w3,
58
+ "d0": self.d0,
59
+ "d1": self.d1,
60
+ "d2": self.d2,
61
+ "fig0": self.fig0,
62
+ "fig1": self.fig1,
63
+ "fig2": self.fig2,
64
+ "bar": self.bar,
65
+ }
66
+ )
67
67
 
68
68
  def _init_ui(self):
69
69
  # Plotting window
@@ -82,9 +82,8 @@ class JupyterConsoleWindow(QWidget): # pragma: no cover:
82
82
  self._init_dock()
83
83
 
84
84
  self.console_layout = QVBoxLayout(self.ui.widget_console)
85
- self.console = JupyterConsoleWidget()
85
+ self.console = BECJupyterConsole(inprocess=True)
86
86
  self.console_layout.addWidget(self.console)
87
- self.console.set_default_style("linux")
88
87
 
89
88
  def _init_figure(self):
90
89
  self.figure.plot(x_name="samx", y_name="bpm4d")
@@ -105,19 +104,19 @@ class JupyterConsoleWindow(QWidget): # pragma: no cover:
105
104
  def _init_dock(self):
106
105
 
107
106
  self.d0 = self.dock.add_dock(name="dock_0")
108
- self.fig0 = self.d0.add_widget_bec("BECFigure")
107
+ self.fig0 = self.d0.add_widget("BECFigure")
109
108
  self.fig0.image("eiger", vrange=(0, 100))
110
109
 
111
110
  self.d1 = self.dock.add_dock(name="dock_1", position="right")
112
- self.fig1 = self.d1.add_widget_bec("BECFigure")
111
+ self.fig1 = self.d1.add_widget("BECFigure")
113
112
  self.fig1.plot(x_name="samx", y_name="bpm4i")
114
113
  self.fig1.plot(x_name="samx", y_name="bpm3a")
115
114
 
116
115
  self.d2 = self.dock.add_dock(name="dock_2", position="bottom")
117
- self.fig2 = self.d2.add_widget_bec("BECFigure", row=0, col=0)
116
+ self.fig2 = self.d2.add_widget("BECFigure", row=0, col=0)
118
117
  self.fig2.motor_map(x_name="samx", y_name="samy")
119
118
  self.fig2.plot(x_name="samx", y_name="bpm4i")
120
- self.bar = self.d2.add_widget_bec("SpiralProgressBar", row=0, col=1)
119
+ self.bar = self.d2.add_widget("SpiralProgressBar", row=0, col=1)
121
120
  self.bar.set_diameter(200)
122
121
 
123
122
  self.dock.save_state()
@@ -144,7 +143,7 @@ if __name__ == "__main__": # pragma: no cover
144
143
  app = QApplication(sys.argv)
145
144
  app.setApplicationName("Jupyter Console")
146
145
  app.setApplicationDisplayName("Jupyter Console")
147
- qdarktheme.setup_theme("auto")
146
+ # qdarktheme.setup_theme("auto")
148
147
  icon = QIcon()
149
148
  icon.addFile(os.path.join(module_path, "assets", "terminal_icon.png"), size=QSize(48, 48))
150
149
  app.setWindowIcon(icon)
@@ -33,7 +33,7 @@ class BECDock(BECConnector, Dock):
33
33
  "hide_title_bar",
34
34
  "get_widgets_positions",
35
35
  "set_title",
36
- "add_widget_bec",
36
+ "add_widget",
37
37
  "list_eligible_widgets",
38
38
  "move_widget",
39
39
  "remove_widget",
@@ -152,47 +152,47 @@ class BECDock(BECConnector, Dock):
152
152
  """
153
153
  return list(RPCWidgetHandler.widget_classes.keys())
154
154
 
155
- def add_widget_bec(
156
- self,
157
- widget_type: str,
158
- row=None,
159
- col=0,
160
- rowspan=1,
161
- colspan=1,
162
- shift: Literal["down", "up", "left", "right"] = "down",
163
- ):
164
- """
165
- Add a widget to the dock.
166
-
167
- Args:
168
- widget_type(str): The widget to add. Only BEC RPC widgets from RPCWidgetHandler are allowed.
169
- row(int): The row to add the widget to. If None, the widget will be added to the next available row.
170
- col(int): The column to add the widget to.
171
- rowspan(int): The number of rows the widget should span.
172
- colspan(int): The number of columns the widget should span.
173
- shift(Literal["down", "up", "left", "right"]): The direction to shift the widgets if the position is occupied.
174
- """
175
- if row is None:
176
- row = self.layout.rowCount()
177
-
178
- if self.layout_manager.is_position_occupied(row, col):
179
- self.layout_manager.shift_widgets(shift, start_row=row)
180
-
181
- widget = RPCWidgetHandler.create_widget(widget_type)
182
- self.addWidget(widget, row=row, col=col, rowspan=rowspan, colspan=colspan)
183
- self.config.widgets[widget.gui_id] = widget.config
184
-
185
- return widget
155
+ # def add_widget_bec(
156
+ # self,
157
+ # widget_type: str,
158
+ # row=None,
159
+ # col=0,
160
+ # rowspan=1,
161
+ # colspan=1,
162
+ # shift: Literal["down", "up", "left", "right"] = "down",
163
+ # ):
164
+ # """
165
+ # Add a widget to the dock.
166
+ #
167
+ # Args:
168
+ # widget_type(str): The widget to add. Only BEC RPC widgets from RPCWidgetHandler are allowed.
169
+ # row(int): The row to add the widget to. If None, the widget will be added to the next available row.
170
+ # col(int): The column to add the widget to.
171
+ # rowspan(int): The number of rows the widget should span.
172
+ # colspan(int): The number of columns the widget should span.
173
+ # shift(Literal["down", "up", "left", "right"]): The direction to shift the widgets if the position is occupied.
174
+ # """
175
+ # if row is None:
176
+ # row = self.layout.rowCount()
177
+ #
178
+ # if self.layout_manager.is_position_occupied(row, col):
179
+ # self.layout_manager.shift_widgets(shift, start_row=row)
180
+ #
181
+ # widget = RPCWidgetHandler.create_widget(widget_type)
182
+ # self.addWidget(widget, row=row, col=col, rowspan=rowspan, colspan=colspan)
183
+ # self.config.widgets[widget.gui_id] = widget.config
184
+ #
185
+ # return widget
186
186
 
187
187
  def add_widget(
188
188
  self,
189
- widget: QWidget,
189
+ widget: BECConnector | str,
190
190
  row=None,
191
191
  col=0,
192
192
  rowspan=1,
193
193
  colspan=1,
194
194
  shift: Literal["down", "up", "left", "right"] = "down",
195
- ):
195
+ ) -> BECConnector:
196
196
  """
197
197
  Add a widget to the dock.
198
198
 
@@ -210,8 +210,17 @@ class BECDock(BECConnector, Dock):
210
210
  if self.layout_manager.is_position_occupied(row, col):
211
211
  self.layout_manager.shift_widgets(shift, start_row=row)
212
212
 
213
+ if isinstance(widget, str):
214
+ widget = RPCWidgetHandler.create_widget(widget)
215
+ else:
216
+ widget = widget
217
+
213
218
  self.addWidget(widget, row=row, col=col, rowspan=rowspan, colspan=colspan)
214
- self.config.widgets[widget.gui_id] = widget.config
219
+
220
+ if hasattr(widget, "config"):
221
+ self.config.widgets[widget.gui_id] = widget.config
222
+
223
+ return widget
215
224
 
216
225
  def move_widget(self, widget: QWidget, new_row: int, new_col: int):
217
226
  """
@@ -171,9 +171,7 @@ class BECDockArea(BECConnector, DockArea):
171
171
  dock.show_title_bar()
172
172
 
173
173
  if widget is not None and isinstance(widget, str):
174
- dock.add_widget_bec(
175
- widget_type=widget, row=row, col=col, rowspan=rowspan, colspan=colspan
176
- )
174
+ dock.add_widget(widget=widget, row=row, col=col, rowspan=rowspan, colspan=colspan)
177
175
  elif widget is not None and isinstance(widget, QWidget):
178
176
  dock.addWidget(widget, row=row, col=col, rowspan=rowspan, colspan=colspan)
179
177
  if self._instructions_visible:
File without changes
@@ -0,0 +1,72 @@
1
+ from bec_ipython_client.main import BECIPythonClient
2
+ from qtconsole.inprocess import QtInProcessKernelManager
3
+ from qtconsole.manager import QtKernelManager
4
+ from qtconsole.rich_jupyter_widget import RichJupyterWidget
5
+ from qtpy.QtWidgets import QApplication, QMainWindow
6
+
7
+
8
+ class BECJupyterConsole(RichJupyterWidget): # pragma: no cover:
9
+ def __init__(self, inprocess: bool = False):
10
+ super().__init__()
11
+
12
+ self.inprocess = None
13
+
14
+ self.kernel_manager, self.kernel_client = self._init_kernel(inprocess=inprocess)
15
+ self.set_default_style("linux")
16
+ self._init_bec()
17
+
18
+ def _init_kernel(self, inprocess: bool = False, kernel_name: str = "python3"):
19
+ self.inprocess = inprocess
20
+ if inprocess is True:
21
+ print("starting inprocess kernel")
22
+ kernel_manager = QtInProcessKernelManager()
23
+ else:
24
+ kernel_manager = QtKernelManager(kernel_name=kernel_name)
25
+ kernel_manager.start_kernel()
26
+ kernel_client = kernel_manager.client()
27
+ kernel_client.start_channels()
28
+ return kernel_manager, kernel_client
29
+
30
+ def _init_bec(self):
31
+ if self.inprocess is True:
32
+ self._init_bec_inprocess()
33
+ else:
34
+ self._init_bec_kernel()
35
+
36
+ def _init_bec_inprocess(self):
37
+ self.client = BECIPythonClient()
38
+ self.client.start()
39
+
40
+ self.kernel_manager.kernel.shell.push(
41
+ {
42
+ "bec": self.client,
43
+ "dev": self.client.device_manager.devices,
44
+ "scans": self.client.scans,
45
+ }
46
+ )
47
+
48
+ def _init_bec_kernel(self):
49
+ self.execute(
50
+ """
51
+ from bec_ipython_client.main import BECIPythonClient
52
+ bec = BECIPythonClient()
53
+ bec.start()
54
+ dev = bec.device_manager.devices if bec else None
55
+ scans = bec.scans if bec else None
56
+ """
57
+ )
58
+
59
+ def shutdown_kernel(self):
60
+ self.kernel_client.stop_channels()
61
+ self.kernel_manager.shutdown_kernel()
62
+
63
+
64
+ if __name__ == "__main__": # pragma: no cover
65
+ import sys
66
+
67
+ app = QApplication(sys.argv)
68
+ win = QMainWindow()
69
+ win.setCentralWidget(BECJupyterConsole(True))
70
+ win.show()
71
+
72
+ sys.exit(app.exec_())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.56.3
3
+ Version: 0.57.1
4
4
  Summary: BEC Widgets
5
5
  Project-URL: Bug Tracker, https://gitlab.psi.ch/bec/bec_widgets/issues
6
6
  Project-URL: Homepage, https://gitlab.psi.ch/bec/bec_widgets
@@ -2,11 +2,11 @@
2
2
  .gitlab-ci.yml,sha256=RF2JeGh8tG09DyAOwEu991IZy3C8Vm6lI8O_4Dr9B9Q,12239
3
3
  .pylintrc,sha256=OstrgmEyP0smNFBKoIN5_26-UmNZgMHnbjvAWX0UrLs,18535
4
4
  .readthedocs.yaml,sha256=aSOc277LqXcsTI6lgvm_JY80lMlr69GbPKgivua2cS0,603
5
- CHANGELOG.md,sha256=kanSLoK5uphXdlmpcQqyPg1Z31HfUlC-tbK4nmYvz8o,6924
5
+ CHANGELOG.md,sha256=zxHMzEXHUbEgqxmsrAtt2A-iiShgClvqzI5lZKRqoX4,6824
6
6
  LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
7
- PKG-INFO,sha256=V34V-R1GQv2uDyzy9qDYTnNNe2dbkeeDVpFI-Q8GSkU,1135
7
+ PKG-INFO,sha256=3KI7EdkH96oYBSsLvSfLCot3XuI2m8AgiRHo3zXUrRo,1135
8
8
  README.md,sha256=y4jB6wvArS7N8_iTbKWnSM_oRAqLA2GqgzUR-FMh5sU,2645
9
- pyproject.toml,sha256=zn3vc-ka-y-TAwav3-etEpelzU-jsqo1KOzt55_6Ucw,1803
9
+ pyproject.toml,sha256=-9xY8HWFrm3iGS29r-3dRMXdM-LJecifdKwnmvYoWPU,1803
10
10
  .git_hooks/pre-commit,sha256=n3RofIZHJl8zfJJIUomcMyYGFi_rwq4CC19z0snz3FI,286
11
11
  .gitlab/issue_templates/bug_report_template.md,sha256=gAuyEwl7XlnebBrkiJ9AqffSNOywmr8vygUFWKTuQeI,386
12
12
  .gitlab/issue_templates/documentation_update_template.md,sha256=FHLdb3TS_D9aL4CYZCjyXSulbaW5mrN2CmwTaeLPbNw,860
@@ -16,8 +16,8 @@ bec_widgets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  bec_widgets/assets/bec_widgets_icon.png,sha256=K8dgGwIjalDh9PRHUsSQBqgdX7a00nM3igZdc20pkYM,1747017
17
17
  bec_widgets/assets/terminal_icon.png,sha256=bJl7Tft4Fi2uxvuXI8o14uMHnI9eAWKSU2uftXCH9ws,3889
18
18
  bec_widgets/cli/__init__.py,sha256=tLD8HWgyURhMjYlKZ43pBu-qvGD1LI5o3n3rEieg-70,43
19
- bec_widgets/cli/auto_updates.py,sha256=RFc9sbNE9Ec8K3U1DSrLzwUweM3W51Lmcp9D2gSt2e4,4696
20
- bec_widgets/cli/client.py,sha256=tQIaQcNnOkF3M-Ym4_U7vMwpYWgVPEGAJY4ibnlPLgM,52909
19
+ bec_widgets/cli/auto_updates.py,sha256=8x4_SrD8Hh1RbrUWXLfisw6X5v8Mij2DiTfjvn9dkUw,4692
20
+ bec_widgets/cli/client.py,sha256=_39klWIob_MdCJ8mxjXhJ_1z56qVCoyeMH0Ji2uEiik,52876
21
21
  bec_widgets/cli/client_utils.py,sha256=gxa9TpYCWa0a7jsrMaWv_FQOnfeqP-xht8PYbhcEgys,10802
22
22
  bec_widgets/cli/generate_cli.py,sha256=tBt-F4Xccg9Pj2zuDEGHd0Ho1fKLfCf3PuSa8KmelQk,4431
23
23
  bec_widgets/cli/rpc_register.py,sha256=QxXUZu5XNg00Yf5O3UHWOXg3-f_pzKjjoZYMOa-MOJc,2216
@@ -25,7 +25,7 @@ bec_widgets/cli/rpc_wigdet_handler.py,sha256=OXHoiDFJPzbQ5RO0bzIX5aUXeMMlJTwAiTm
25
25
  bec_widgets/cli/server.py,sha256=rsj31Vsx6ayThNe4PQelQFahGjYXFZjfrNyB2fnm6Ro,5737
26
26
  bec_widgets/examples/__init__.py,sha256=WWQ0cu7m8sA4Ehy-DWdTIqSISjaHsbxhsNmNrMnhDZU,202
27
27
  bec_widgets/examples/jupyter_console/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
- bec_widgets/examples/jupyter_console/jupyter_console_window.py,sha256=O_jcU7DY39PCrjVSJ7YJtTNSj8-se_AvzsgEiVqmKk8,5266
28
+ bec_widgets/examples/jupyter_console/jupyter_console_window.py,sha256=pfwbMfvXu0FdX-a6SdprfOEGxG-IgsuySnYy3l9fwIM,5328
29
29
  bec_widgets/examples/jupyter_console/jupyter_console_window.ui,sha256=2A2mNTUMZBYygz8K4qWzrcjnNqZBMVyeHm26iLZVRWI,1473
30
30
  bec_widgets/examples/motor_movement/__init__.py,sha256=LzPJkxLAxOsZCbXR-fRCPmeYobp7Yqds6tDxW4W1gSw,214
31
31
  bec_widgets/examples/motor_movement/motor_control_compilations.py,sha256=8rpA7a2xVZTDMrx7YQIj3IJew78J1gcVMkHvloS0U_Q,9055
@@ -48,8 +48,8 @@ bec_widgets/utils/widget_io.py,sha256=f36198CvT_EzWQ_cg2G-4tRRsaMdJ3yVqsZWKJCQEf
48
48
  bec_widgets/utils/yaml_dialog.py,sha256=cMVif-39SB9WjwGH5FWBJcFs4tnfFJFs5cacydRyhy0,1853
49
49
  bec_widgets/widgets/__init__.py,sha256=LKgIuY3CI-NHCa_bY9pThYhxLH0MHDo8iNEJDDVIVmw,172
50
50
  bec_widgets/widgets/dock/__init__.py,sha256=B7foHt02gnhM7mFksa7GJVwT7n0j_JvYDCt6wc6XR5g,61
51
- bec_widgets/widgets/dock/dock.py,sha256=fUb8VTYU2yS5N5KOUf1X1m_F1kpDullX3m71llRbBP8,8653
52
- bec_widgets/widgets/dock/dock_area.py,sha256=8E-rBZxM7pE423jPaXMRKb1YGlAR9oAQvJubNDpemSI,7361
51
+ bec_widgets/widgets/dock/dock.py,sha256=kdX0ZbuUdx6XETZ1NUgzBWlee_Q7JcN3fXpARDAlre8,8955
52
+ bec_widgets/widgets/dock/dock_area.py,sha256=MtuT6_LYCPQ0TnKBtO4_4ReA9L8tZZrroUjkzEQspdk,7322
53
53
  bec_widgets/widgets/figure/__init__.py,sha256=3hGx_KOV7QHCYAV06aNuUgKq4QIYCjUTad-DrwkUaBM,44
54
54
  bec_widgets/widgets/figure/figure.py,sha256=OzeKZme89JnzMcKT1sACnyw951EtRoSUALl58upY6b4,29762
55
55
  bec_widgets/widgets/figure/plots/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -63,6 +63,8 @@ bec_widgets/widgets/figure/plots/motor_map/motor_map.py,sha256=HKRbt8sD8fmzpYcEW
63
63
  bec_widgets/widgets/figure/plots/waveform/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
64
64
  bec_widgets/widgets/figure/plots/waveform/waveform.py,sha256=k6Lh08V00N9gATppaLgaSaij4Husf8sYU_HXTvF3oB4,21664
65
65
  bec_widgets/widgets/figure/plots/waveform/waveform_curve.py,sha256=9q7nJfyH8y9rWw_AIOd6tk7cbckoAGNLHv2oHEKCCyo,7229
66
+ bec_widgets/widgets/jupyter_console/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
67
+ bec_widgets/widgets/jupyter_console/jupyter_console.py,sha256=ioLYJL31RdBoAOGFSS8PVSnUhkWPWmLC3tiKp7CouO8,2251
66
68
  bec_widgets/widgets/motor_control/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
67
69
  bec_widgets/widgets/motor_control/motor_control.py,sha256=UrLCvp3J6uiVxWV2jqQbsA2nsMf9s_rrDH2KjnUm-bk,7890
68
70
  bec_widgets/widgets/motor_control/motor_table/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -105,17 +107,23 @@ docs/introduction/introduction.md,sha256=wp7jmhkUtJnSnEnmIAZGUcau_3-5e5-FohvZb63
105
107
  docs/user/customisation.md,sha256=Og0NuUsTs8HdwKtpHnycGmH8wCqOeYgj2ozlYRJ-Drk,249
106
108
  docs/user/user.md,sha256=uCTcjclIi6rdjYRQebko6bWFEVsjyfshsVU3BDYrC-Y,1403
107
109
  docs/user/api_reference/api_reference.md,sha256=q2Imc48Rq6GcAP0R4bS3KuW5ptZZdsV4wxGJb3JJQHg,174
108
- docs/user/applications/applications.md,sha256=hs8WKVuxBENV2Q7m4wN8wmSI_B3JBYrSYS1IYdbyoWg,147
109
- docs/user/getting_started/getting_started.md,sha256=BagVhtCSoLgYlVaaYOep3KT5r_8DjtQKYj2g-PoU7uw,346
110
- docs/user/getting_started/installation.md,sha256=Rt7O2VI5LRrrRpru1YSb8KAd92znFhHJFs7vhpmHIXQ,1239
110
+ docs/user/applications/applications.md,sha256=yOECfaYRUEDIxF-O0duOwSJlG4f93RylrpMjbw1-8Dg,100
111
+ docs/user/getting_started/command_line_introduction.md,sha256=qTGXnxyRajxv7AXbZaPVVOA5D6zBnK0M0ZF0bniymEM,8683
112
+ docs/user/getting_started/getting_started.md,sha256=zYzoHC8xvHF5wDK66thkdamf8mKKNEudiA-fCOzbedM,358
113
+ docs/user/getting_started/gui_complex_gui.gif,sha256=ovv9u371BGG5GqhzyBMl4mvqMHLfJS0ylr-dR0Ydwtw,6550393
114
+ docs/user/getting_started/installation.md,sha256=nBl2Hfvo6ua3-tVZn1B-UG0hCTlrFY6_ibXHWnXeegs,1135
115
+ docs/user/widgets/bec_figure.md,sha256=Ph8ajmESk71Y9nBJsLKLiN-YvGJwN4FdN_Rs3jcObwE,5068
116
+ docs/user/widgets/image_plot.gif,sha256=_mVFhMTXGqwDOcEtrBHMZj5Thn2sLhDAHEeL2XyHN-s,14098977
111
117
  docs/user/widgets/motor.gif,sha256=FtaWdRHx4UZaGJPpq8LNhMMgX4PFcAB6IZ93JCMEh_w,2280719
118
+ docs/user/widgets/progress_bar.gif,sha256=5jh0Zw2BBGPuNxszV1DBLJCb4_6glIRX-U2ABjnsK2k,5263592
112
119
  docs/user/widgets/scatter_2D.gif,sha256=yHpsuAUseMafJjI_J5BcOhmE3nu9VFn_Xm9XHzJaH5I,13188862
120
+ docs/user/widgets/spiral_progress_bar.md,sha256=fnkg1cRM9y49MwYVXDukHGu80SXHxsI9mU9ZfDkENPs,1114
113
121
  docs/user/widgets/w1D.gif,sha256=tuHbleJpl6bJFNNC2OdndF5LF7IyfvlkFCMGZajrQPs,622773
114
- docs/user/widgets/widgets.md,sha256=vIfilXMyE1iPQMQXGH8wEjXWsFI6GPI0Cn9VQg5lLwI,1879
122
+ docs/user/widgets/widgets.md,sha256=NFdqTlLTHXueErLzvw4wHwTUrzRSEuRelb1fiT4PySg,352
115
123
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
116
124
  tests/end-2-end/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
117
125
  tests/end-2-end/conftest.py,sha256=b5Yebbj8C1-IcXq23XGbOnXF0kOZD_Po46Z-p4cBwfs,1346
118
- tests/end-2-end/test_bec_dock_rpc_e2e.py,sha256=E2XR6cgmyrHknbe-97LhuSAGlsPguc5VOQ2-Q5Apvm0,9843
126
+ tests/end-2-end/test_bec_dock_rpc_e2e.py,sha256=5W1uczZV6AqzjY6rHMR8GJDQuGpImtz-BGqq_cdqjbE,9823
119
127
  tests/end-2-end/test_bec_figure_rpc_e2e.py,sha256=X8lQLx2NsB6-nU61IhVtAw1-pJ4A2qFgx5PxOWC0V7Q,5527
120
128
  tests/end-2-end/test_rpc_register_e2e.py,sha256=M7sSq3us2yQIW5tAIFOFfBULatZTQNLdt0frh1bINts,1595
121
129
  tests/unit_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -123,7 +131,7 @@ tests/unit_tests/client_mocks.py,sha256=ErrklY7446jXE2_XGKebs_a-2Pqif5ECOPvxVAKR
123
131
  tests/unit_tests/conftest.py,sha256=KrnktXPWmZhnKNue-xGWOLD1XGEvdz9Vf7V2eO3XQ3A,596
124
132
  tests/unit_tests/test_bec_connector.py,sha256=f2XXGGw3NoZLIUrDuZuEWwF_ttOYmmquCgUrV5XkIOY,1951
125
133
  tests/unit_tests/test_bec_dispatcher.py,sha256=rYPiRizHaswhGZw55IBMneDFxmPiCCLAZQBqjEkpdyY,3992
126
- tests/unit_tests/test_bec_dock.py,sha256=gvtNkkCPrDFY_1qZ53ZXChdgmQFSwwQrr1VeZC5ybKc,3610
134
+ tests/unit_tests/test_bec_dock.py,sha256=x1mgeNvgu9yVuZvgUkfD60F7FLANGQsXSBhF3n8kyIM,3606
127
135
  tests/unit_tests/test_bec_figure.py,sha256=xYAftY8bI_EH-SlNPD0Tjd7FS_47ouZ1E4hrpjPt7O4,8002
128
136
  tests/unit_tests/test_bec_motor_map.py,sha256=AfD_9-x6VV3TPnkQgNfFYRndPHDsGx-a_YknFeDr6hc,4588
129
137
  tests/unit_tests/test_client_utils.py,sha256=eViJ1Tz-HX9TkMvQH6W8cO-c3_1I8bUc4_Yen6LOc0E,830
@@ -142,7 +150,7 @@ tests/unit_tests/test_configs/config_device_no_entry.yaml,sha256=hdvue9KLc_kfNzG
142
150
  tests/unit_tests/test_configs/config_scan.yaml,sha256=vo484BbWOjA_e-h6bTjSV9k7QaQHrlAvx-z8wtY-P4E,1915
143
151
  tests/unit_tests/test_msgs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
144
152
  tests/unit_tests/test_msgs/available_scans_message.py,sha256=m_z97hIrjHXXMa2Ex-UvsPmTxOYXfjxyJaGkIY6StTY,46532
145
- bec_widgets-0.56.3.dist-info/METADATA,sha256=V34V-R1GQv2uDyzy9qDYTnNNe2dbkeeDVpFI-Q8GSkU,1135
146
- bec_widgets-0.56.3.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
147
- bec_widgets-0.56.3.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
148
- bec_widgets-0.56.3.dist-info/RECORD,,
153
+ bec_widgets-0.57.1.dist-info/METADATA,sha256=3KI7EdkH96oYBSsLvSfLCot3XuI2m8AgiRHo3zXUrRo,1135
154
+ bec_widgets-0.57.1.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
155
+ bec_widgets-0.57.1.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
156
+ bec_widgets-0.57.1.dist-info/RECORD,,
@@ -8,7 +8,3 @@
8
8
  maxdepth: 1
9
9
  hidden: true
10
10
  ---
11
-
12
- apps/motor_app
13
- apps/plot_app
14
- apps/modular_app
@@ -0,0 +1,87 @@
1
+ (user.command_line_introduction)=
2
+ # Command Line Introduction
3
+ In order to use BEC Widgets as a plotting tool for BEC, it needs to be [installed](#user.installation) in the same python environment as the BECIpythonClient. If that is the case, it will automatically launch a GUI and assign the control of the GUI to the `gui` object in the client. The GUI backend will also be automatically connect to the BEC server, giving access to all information on the server and allowing the user to visualize the data in real-time.
4
+
5
+ ## BECDockArea
6
+ The `gui` object represents the top level of hierarchy in BEC Widgets. It is a [`BECDockArea`](/api_reference/_autosummary/bec_widgets.cli.client.BECDockArea) based on the [pyqtgraph.dockarea](https://pyqtgraph.readthedocs.io/en/latest/api_reference/dockarea.html). The GUI can be further composed of multiple [`BECDock`](/api_reference/_autosummary/bec_widgets.cli.client.BECDock)s that can be detached and attached to the main area. These docks allow users to freely arrange and customize the widgets they add to the gui, giving them the necessary freedom to design the user interface they desire.
7
+
8
+ ## Widgets
9
+ Widgets are the building blocks of the BEC Widgets framework. They are the visual components that allow users to interact with the data and control the behavior of the application. Each dock can contain multiple widgets, although we recommend using a direct mapping of a single widget to a dock. We currently support two type of widgets:
10
+ - [`BECFigure`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure): A widget that can be used to visualize data from BEC. It is automatically connected to the BEC server and can be used to plot data from BEC.
11
+ - [`SpiralProgressBar`](/api_reference/_autosummary/bec_widgets.cli.client.SpiralProgressBar): A custom widget that can be used to show progress in a spiral shape.
12
+
13
+ **BECFigure**
14
+ The [`BECFigure`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure) widget is one of the core widgets developed for BEC and designed to be flexible and can be used to visualize different types of data. It can be used to visualize [1D Waveform](user.widgets.waveform_1d), [2D Scatter Plot](user.widgets.scatter_2d), [Motor Position Map](user.widgets.motor_map) and 2D image data. As mentioned before, starting the BECIPythonClient will automatically launch a `gui` with a single dock area and a BECFigure widget attached to it. This widget is accessible via the `fig` object from the client directly. We also provide two methods [`plot()`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.plot), [`image()`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.image) and [`motor_map()`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.motor_map) as shortcuts to add a plot, image or motor map to the BECFigure.
15
+
16
+ **Waveform Plot**
17
+ The [`BECWaveForm`](/api_reference/_autosummary/bec_widgets.cli.client.BECWaveform) is a widget that can be used to visualize 1D waveform data, i.e. to plot data of a monitor against a motor position. The method [`plot()`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.plot) of BECFigure adds a BECWaveForm widget to the figure, and returns the plot object.
18
+
19
+ ```python
20
+ plt = fig.add_plot('samx', 'bpm4i')
21
+ ```
22
+ Here, we assign the plot to the object `plt`. We can now use this object to further customize the plot, e.g. changing the title ([`set_title()`](/api_reference/_autosummary/bec_widgets.cli.client.BECWaveform.rst#bec_widgets.cli.client.BECWaveform.set_title)), axis labels ([`set_x_label()`](/api_reference/_autosummary/bec_widgets.cli.client.BECWaveform.rst#bec_widgets.cli.client.BECWaveform.set_x_label)) or limits ([`set_x_lim()`](/api_reference/_autosummary/bec_widgets.cli.client.BECWaveform.rst#bec_widgets.cli.client.BECWaveform.set_x_lim)). We invite you to explore the API of the BECWaveForm in the [documentation](user.widgets.waveform_1d) or directly in the command line.
23
+
24
+ **Scatter Plot**
25
+ The [`BECWaveForm`](/api_reference/_autosummary/bec_widgets.cli.client.BECWaveForm) widget can also be used to visualize 2D scatter plots. More details on setting up the scatter plot are available in the widget documentation of the [scatter plot](user.widgets.scatter_2d).
26
+
27
+ **Motor Map**
28
+ The [`BECMotorMap`](/api_reference/_autosummary/bec_widgets.cli.client.BECMotorMap) widget can be used to visualize the position of motors. It's focused on tracking and visualizing the position of motors, crucial for precise alignment and movement tracking during scans. More details on setting up the motor map are available in the widget documentation of the [motor map](user.widgets.motor_map).
29
+
30
+ **Image Plot**
31
+ The [`BECImageItem`](/api_reference/_autosummary/bec_widgets.cli.client.BECImageItem) widget can be used to visualize 2D image data for example a camera. More details on setting up the image plot are available in the widget documentation of the [image plot](user.widgets.image)
32
+
33
+ ### Useful Commands
34
+ We recommend users to explore the API of the widgets by themselves since we assume that the user interface is supposed to be intuitive and self-explanatory. We appreciate feedback from user in order to constantly improve the experience and allow easy access to the gui, widgets and their functionality. We recommend checking the [API documentation](user.api_reference), but also by using BEC Widgets, exploring the available functions and check their dockstrings.
35
+ ```python
36
+ gui.add_dock? # shows the dockstring of the add_dock method
37
+ ```
38
+
39
+ In addition, we list below a few useful commands that can be used to interface with the widgets:
40
+
41
+ ```python
42
+ gui.panels # returns a dictionary of all docks in the gui
43
+ gui.add_dock() # adds a new dock to the gui
44
+
45
+ dock = gui.panels['dock_2']
46
+ dock.add_widget_bec('BECFigure') # adds a new widget of BECFigure to the dock
47
+ dock.widget_list # returns a list of all widgets in the dock
48
+
49
+ figure = dock.widget_list[0] # assigns the created BECFigure to figure
50
+ plt = figure.add_plot('samx', 'bpm4i') # adds a BECWaveForm plot to the figure
51
+ plt.curves # returns a list of all curves in the plot
52
+ ```
53
+
54
+ We note that commands can also be chained. For example, `gui.add_dock().add_widget_bec('BECFigure')` will add a new dock to the gui and add a new widget of `BECFigure` to the dock.
55
+
56
+ ## Composing a larger GUI
57
+ The example given above introduces BEC Widgets with its different components, and provides an overview of how to interact with the widgets. Nevertheless, another power aspect of BEC Widgets lies in the ability to compose a larger GUI with multiple docks and widgets. This section aims to provide a tutorial like guide on how to compose a more complex GUI that (A) live-plots a 1D waveform, (B) plots data from a camera, and (C) tracks the positions of two motors.
58
+ Let's assume BEC was just started and the `gui` object is available in the client. A single dock is already attached together with a BEC Figure. Let's add the 1D waveform to this dock, change the color of the line to white and add the title *1D Waveform* to the plot.
59
+
60
+ ```python
61
+ plt = fig.add_plot('samx', 'bpm4i')
62
+ plt.curves[0].set_color(color="white")
63
+ plt.set_title('1D Waveform')
64
+ ```
65
+
66
+ Next, we add 2 new docks to the gui, one to plot the data of a camera and one to track the positions of two motors.
67
+ ```ipython
68
+ cam_widget= gui.add_dock(name="cam_dock").add_widget_bec('BECFigure').image("eiger")
69
+ motor_widget = gui.add_dock(name="mot_dock").add_widget_bec('BECFigure').motor_map("samx", "samy")
70
+ ```
71
+ Note, we chain commands here which is possible since the `add_dock` and `add_widget_bec` methods return the dock and the widget respectively. We can now further customize the widgets by changing the title, axis labels, etc.
72
+
73
+ ```python
74
+ cam_widget.set_title("Camera Image Eiger")
75
+ cam_widget.set_vrange(vmin=0, vmax=100)
76
+ ```
77
+ As a final step, we can now add also a SpiralProgressBar to a new dock, and perform a grid_scan with the motors *samx* and *samy*.
78
+ As you see in the example below, all docks are arranged below each other. This is the default behavior of the `add_dock` method. However, the docks can be freely arranged by drag and drop as desired by the user. We invite you to explore this by yourself following the example in the video, and build your custom GUI with BEC Widgets.
79
+
80
+ ```python
81
+ prog_bar = gui.add_dock(name="prog_dock").add_widget_bec('SpiralProgressBar')
82
+ prog_bar.set_line_widths(15)
83
+ scans.grid_scan(dev.samy, -2, 2, 10, dev.samx, -5, 5, 10, exp_time=0.1, relative=False)
84
+ ```
85
+
86
+ ![gui_complex_gui](./gui_complex_gui.gif)
87
+
@@ -8,5 +8,6 @@ maxdepth: 2
8
8
  hidden: true
9
9
  ---
10
10
 
11
- getting_started/installation
11
+ installation/
12
+ command_line_introduction/
12
13
  ```
@@ -1,7 +1,5 @@
1
1
  (user.installation)=
2
2
  # Installation
3
-
4
-
5
3
  **Prerequisites**
6
4
 
7
5
  Before installing BEC Widgets, please ensure the following requirements are met:
@@ -11,25 +9,14 @@ Before installing BEC Widgets, please ensure the following requirements are met:
11
9
 
12
10
  **Standard Installation**
13
11
 
14
- Install BEC Widgets using the pip package manager. Open your terminal and execute:
15
-
16
- ```bash
17
- pip install bec_widgets PyQt6
18
- ```
19
-
20
- This command installs BEC Widgets along with its dependencies, including the default PyQt6.
21
-
22
- **Selecting a PyQt Version**
23
-
24
- BEC Widgets supports both PyQt5 and PyQt6. To install a specific version, use:
12
+ To install BEC Widgets using the pip package manager, execute the following command in your terminal for getting the default PyQT6 version in your python environment:
25
13
 
26
- For PyQt6:
27
14
 
28
15
  ```bash
29
16
  pip install bec_widgets[pyqt6]
30
17
  ```
31
18
 
32
- For PyQt5:
19
+ In case you want to use PyQt5, you can install it by using the following command:
33
20
 
34
21
  ```bash
35
22
  pip install bec_widgets[pyqt5]
@@ -0,0 +1,100 @@
1
+ (user.widgets.bec_figure)=
2
+ # BECFigure
3
+ [`BECFigure`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure) is a widget that provides a graphical user interface for creating and managing plots. It is a versatile tool that allows users to create a wide range of plots, from simple 1D waveforms to complex 2D scatter plots. BECFigure is designed to be user-friendly and interactive, enabling users to customize plots and visualize data in real-time.
4
+ In the following, we describe 4 different type of widgets thaat are available in BECFigure.
5
+
6
+ (user.widgets.waveform_1d)=
7
+ ## [1D Waveform Widget](/api_reference/_autosummary/bec_widgets.cli.client.BECWaveform)
8
+
9
+ **Purpose:** This widget provides a straightforward visualization of 1D data. It is particularly useful for plotting positioner movements against detector readings, enabling users to observe correlations and patterns in a simple, linear format.
10
+
11
+ **Key Features:**
12
+ - Real-time plotting of positioner versus detector values.
13
+ - Interactive controls for zooming and panning through the data.
14
+ - Customizable visual elements such as line color and style.
15
+
16
+ **Example of Use:**
17
+ ![Waveform 1D](./w1D.gif)
18
+
19
+ **Code example**
20
+ The following code snipped demonstrates how to create a 1D waveform plot using BEC Widgets within BEC. More details about BEC Widgets in BEC can be found in the getting started section within the [introduction to the command line.](user.command_line_introduction)
21
+ ```python
22
+ # adds a new dock, a new BECFigure and a BECWaveForm to the dock
23
+ plt = gui.add_dock().add_widget('BECFigure').plot('samx', 'bpm4i')
24
+ # add a second curve to the same plot
25
+ plt.add_curve_scan('samx', 'bpm3i')
26
+ plt.set_title("Gauss plots vs. samx")
27
+ plt.set_x_label("Motor X")
28
+ plt.set_y_label("Gauss Signal (A.U.")
29
+ ```
30
+ Note, the return value of the simulated devices *bpm4i* and *bpm3i* may not be gaussian signals, but they can be easily configured with the code snippet below. For more details please check the documentation of the [simulation](https://bec.readthedocs.io/en/latest/developer/devices/bec_sim.html).
31
+ ```python
32
+ # bpm4i uses GaussianModel and samx as a reference; default settings
33
+ dev.bpm4i.sim.select_sim_model("GaussianModel")
34
+ # bpm3i uses StepModel and samx as a reference; default settings
35
+ dev.bpm3i.sim.select_sim_model("StepModel")
36
+ ```
37
+
38
+ (user.widgets.scatter_2d)=
39
+ ## [2D Scatter Plot](/api_reference/_autosummary/bec_widgets.cli.client.BECWaveform)
40
+
41
+ **Purpose:** The 2D scatter plot widget is designed for more complex data visualization. It employs a false color map to represent a third dimension (z-axis), making it an ideal tool for visualizing multidimensional data sets.
42
+
43
+ **Key Features:**
44
+
45
+ - 2D scatter plot with color-coded data points based on a third variable (two positioners for x/y vs. one detector for colormap).
46
+ - Interactive false color map for enhanced data interpretation.
47
+ - Tools for selecting and inspecting specific data points.
48
+
49
+ **Example of Use:**
50
+ ![Waveform 1D](./scatter_2D.gif)
51
+
52
+ **Code example**
53
+ The following code snipped demonstrates how to create a 2D scatter plot using BEC Widgets within BEC.
54
+ ```python
55
+ # adds a new dock, a new BECFigure and a BECWaveForm to the dock
56
+ plt = gui.add_dock().add_widget('BECFigure').add_plot('samx', 'samy', 'bpm4i')
57
+ ```
58
+
59
+ (user.widgets.motor_map)=
60
+ ## [Motor Position Map](/api_reference/_autosummary/bec_widgets.cli.client.BECMotorMap)
61
+
62
+ **Purpose:** A specialized component derived from the Motor Alignment Tool. It's focused on tracking and visualizing the position of motors, crucial for precise alignment and movement tracking during scans.
63
+
64
+ **Key Features:**
65
+ - Real-time tracking of motor positions.
66
+ - Visual representation of motor trajectories, aiding in alignment tasks.
67
+
68
+ **Example of Use:**
69
+ ![Waveform 1D](./motor.gif)
70
+
71
+ **Code example**
72
+ The following code snipped demonstrates how to create a motor map using BEC Widgets within BEC.
73
+ ```python
74
+ # add a motor map to the gui
75
+ mot_map = gui.add_dock().add_widget('BECFigure').motor_map('samx', 'samy')
76
+ # change the number of points displayed
77
+ ```
78
+
79
+ (user.widgets.image_2d)=
80
+ ## [Image Plot](/api_reference/_autosummary/bec_widgets.cli.client.BECImageItem)
81
+
82
+ **Purpose:** A versatile widget for visualizing 2D image data, such as camera images. It provides a detailed representation of image data, with an attached color and scale bar to dynamically adjust the image display.
83
+
84
+ **Key Features:**
85
+ - Live-plotting of 2D image data from cameras (*if data stream is available in BEC*).
86
+ - Color maps and scale bars for customizing image display.
87
+ **Example of Use:**
88
+ ![Image 2D](./image_plot.gif)
89
+
90
+ **Code example**
91
+ The following code snipped demonstrates how to create a motor map using BEC Widgets within BEC.
92
+ ```python
93
+ # add a camera view for the eiger camera to the gui
94
+ cam_widget = gui.add_dock().add_widget('BECFigure').image('eiger')
95
+ # set the title of the camera view
96
+ cam_widget.set_title("Camera Image Eiger")
97
+ # change the color map range, e.g. from 0 to 100, per default it is autoscaling
98
+ # Note, the simulation has hot pixels on the detector
99
+ cam_widget.set_vrange(vmin=0, vmax=100)
100
+ ```
Binary file
Binary file
@@ -0,0 +1,21 @@
1
+ (user.widgets.spiral_progress_bar)=
2
+ # [Spiral Progress Bar](/api_reference/_autosummary/bec_widgets.cli.client.SpiralProgressBar)
3
+ **Purpose** The Spiral Progress Bar widget is a circular progress bar that can be used to visualize the progress of a task. The widget is designed to be used in applications where the progress of a task is represented as a percentage. The Spiral Progress Bar widget is a part of the BEC Widgets library and can be controlled directly using its API, or hooked up to the progress of a device readback or scan.
4
+
5
+ **Key Features:**
6
+
7
+ - circular progress bar to show updates on the progress of a task.
8
+ - hooks to update the progress bar from a device readback or scan.
9
+ - multiple progress rings to show different tasks in parallel.
10
+
11
+ **Example of Use:**
12
+ ![SpiralProgressBar](./progress_bar.gif)
13
+
14
+ **Code example**
15
+ The following code snipped demonstrates how to create a 2D scatter plot using BEC Widgets within BEC.
16
+ ```python
17
+ # adds a new dock with a spiral progress bar
18
+ progress = gui.add_dock().add_widget("SpiralProgressBar")
19
+ # customize the size of the ring
20
+ progress.set_line_width(20)
21
+ ```
@@ -1,41 +1,15 @@
1
1
  (user.widgets)=
2
2
  # Widgets
3
-
4
- ## Visualization Widgets
5
-
6
3
  BEC Widgets includes a variety of visualization widgets designed to cater to diverse data representation needs in beamline experiments. These widgets enhance the user experience by providing intuitive and interactive data visualizations.
7
4
 
8
- ### 1D Waveform Widget
9
-
10
- **Purpose:** This widget provides a straightforward visualization of 1D data. It is particularly useful for plotting positioner movements against detector readings, enabling users to observe correlations and patterns in a simple, linear format.
11
-
12
- **Key Features:**
13
- - Real-time plotting of positioner versus detector values.
14
- - Interactive controls for zooming and panning through the data.
15
- - Customizable visual elements such as line color and style.
16
-
17
- **Example of Use:**
18
- ![Waveform 1D](./w1D.gif)
19
- ### 2D Scatter Plot
20
-
21
- **Purpose:** The 2D scatter plot widget is designed for more complex data visualization. It employs a false color map to represent a third dimension (z-axis), making it an ideal tool for visualizing multidimensional data sets.
22
-
23
- **Key Features:**
24
-
25
- - 2D scatter plot with color-coded data points based on a third variable (two positioners for x/y vs. one detector for colormap).
26
- - Interactive false color map for enhanced data interpretation.
27
- - Tools for selecting and inspecting specific data points.
28
-
29
- **Example of Use:**
30
- ![Waveform 1D](./scatter_2D.gif)
31
- ### Motor Position Map
5
+ ```{toctree}
6
+ ---
7
+ maxdepth: 2
8
+ hidden: false
9
+ ---
32
10
 
33
- **Purpose:** A specialized component derived from the Motor Alignment Tool. It's focused on tracking and visualizing the position of motors, crucial for precise alignment and movement tracking during scans.
11
+ bec_figure/
12
+ spiral_progress_bar/
13
+ ```
34
14
 
35
- **Key Features:**
36
- - Real-time tracking of motor positions.
37
- - Visual representation of motor trajectories, aiding in alignment tasks.
38
- - Ability to record and recall specific motor positions for repetitive tasks.
39
15
 
40
- **Example of Use:**
41
- ![Waveform 1D](./motor.gif)
pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "bec_widgets"
7
- version = "0.56.3"
7
+ version = "0.57.1"
8
8
  description = "BEC Widgets"
9
9
  requires-python = ">=3.10"
10
10
  classifiers = [
@@ -38,9 +38,9 @@ def test_rpc_add_dock_with_figure_e2e(rpc_server_dock, qtbot):
38
38
  assert len(dock_server.docks) == 3
39
39
 
40
40
  # Add 3 figures with some widgets
41
- fig0 = d0.add_widget_bec("BECFigure")
42
- fig1 = d1.add_widget_bec("BECFigure")
43
- fig2 = d2.add_widget_bec("BECFigure")
41
+ fig0 = d0.add_widget("BECFigure")
42
+ fig1 = d1.add_widget("BECFigure")
43
+ fig2 = d2.add_widget("BECFigure")
44
44
 
45
45
  assert len(dock_server.docks) == 3
46
46
  assert len(dock_server.docks["dock_0"].widgets) == 1
@@ -166,7 +166,7 @@ def test_spiral_bar(rpc_server_dock):
166
166
 
167
167
  d0 = dock.add_dock(name="dock_0")
168
168
 
169
- bar = d0.add_widget_bec("SpiralProgressBar")
169
+ bar = d0.add_widget("SpiralProgressBar")
170
170
  assert bar.__class__.__name__ == "SpiralProgressBar"
171
171
 
172
172
  bar.set_number_of_bars(5)
@@ -188,7 +188,7 @@ def test_spiral_bar_scan_update(rpc_server_dock, qtbot):
188
188
 
189
189
  d0 = dock.add_dock("dock_0")
190
190
 
191
- d0.add_widget_bec("SpiralProgressBar")
191
+ d0.add_widget("SpiralProgressBar")
192
192
 
193
193
  client = rpc_server_dock.client
194
194
  dev = client.device_manager.devices
@@ -58,7 +58,7 @@ def test_bec_dock_area_add_remove_dock(bec_dock_area, qtbot):
58
58
 
59
59
  def test_add_remove_bec_figure_to_dock(bec_dock_area):
60
60
  d0 = bec_dock_area.add_dock()
61
- fig = d0.add_widget_bec("BECFigure")
61
+ fig = d0.add_widget("BECFigure")
62
62
  plt = fig.plot(x_name="samx", y_name="bpm4i")
63
63
  im = fig.image("eiger")
64
64
  mm = fig.motor_map("samx", "samy")