bec-widgets 0.96.2__py3-none-any.whl → 0.96.3__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
@@ -1,5 +1,15 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v0.96.3 (2024-08-23)
4
+
5
+ ### Documentation
6
+
7
+ * docs(dispatcher): docs added ([`dd7c71b`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/dd7c71bb1e0b7ef5398b1e1a05fc1147c772420a))
8
+
9
+ ### Fix
10
+
11
+ * fix: minor fixes for type annotations ([`8c2e7c8`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/8c2e7c82592ace50e4e1f47e392a0ddc988f57ae))
12
+
3
13
  ## v0.96.2 (2024-08-22)
4
14
 
5
15
  ### Fix
@@ -144,16 +154,6 @@ Terminating client connections has to be done at the application level ([`198c1d
144
154
 
145
155
  ## v0.94.0 (2024-08-08)
146
156
 
147
- ### Feature
148
-
149
- * feat: add PositionerControlLine ([`c80a7cd`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/c80a7cd1083baa9543a2cee2e3c3a51dfd209b19))
150
-
151
157
  ### Refactor
152
158
 
153
159
  * refactor: adjust dimensions ([`0273bf4`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/0273bf485694609325b5b556a3c69fb53c18446e))
154
-
155
- ## v0.93.5 (2024-08-08)
156
-
157
- ### Fix
158
-
159
- * fix(positioner_box): icons fixed ([`281633d`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/281633deff15b6879dac3a4f0770fa6949aaecdc))
PKG-INFO CHANGED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.96.2
3
+ Version: 0.96.3
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
@@ -125,7 +125,7 @@ class BECDispatcher:
125
125
  topics: Union[EndpointInfo, str, list[Union[EndpointInfo, str]]],
126
126
  **kwargs,
127
127
  ) -> None:
128
- """Connect widget's pyqt slot, so that it is called on new pub/sub topic message.
128
+ """Connect widget's qt slot, so that it is called on new pub/sub topic message.
129
129
 
130
130
  Args:
131
131
  slot (Callable): A slot method/function that accepts two inputs: content and metadata of
@@ -138,6 +138,13 @@ class BECDispatcher:
138
138
  self._slots[slot].update(set(topics_str))
139
139
 
140
140
  def disconnect_slot(self, slot: Callable, topics: Union[str, list]):
141
+ """
142
+ Disconnect a slot from a topic.
143
+
144
+ Args:
145
+ slot(Callable): The slot to disconnect
146
+ topics(Union[str, list]): The topic(s) to disconnect from
147
+ """
141
148
  # find the right slot to disconnect from ;
142
149
  # slot callbacks are wrapped in QtThreadSafeCallback objects,
143
150
  # but the slot we receive here is the original callable
@@ -153,6 +160,12 @@ class BECDispatcher:
153
160
  del self._slots[connected_slot]
154
161
 
155
162
  def disconnect_topics(self, topics: Union[str, list]):
163
+ """
164
+ Disconnect all slots from a topic.
165
+
166
+ Args:
167
+ topics(Union[str, list]): The topic(s) to disconnect from
168
+ """
156
169
  self.client.connector.unregister(topics)
157
170
  topics_str, _ = self.client.connector._convert_endpointinfo(topics)
158
171
  for slot in list(self._slots.keys()):
@@ -162,4 +175,11 @@ class BECDispatcher:
162
175
  del self._slots[slot]
163
176
 
164
177
  def disconnect_all(self, *args, **kwargs):
178
+ """
179
+ Disconnect all slots from all topics.
180
+
181
+ Args:
182
+ *args: Arbitrary positional arguments
183
+ **kwargs: Arbitrary keyword arguments
184
+ """
165
185
  self.disconnect_topics(self.client.connector._topics_cb)
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  import itertools
2
4
  from typing import Type
3
5
 
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from bec_lib.endpoints import MessageEndpoints
2
4
  from qtpy.QtCore import Qt, Slot
3
5
  from qtpy.QtWidgets import QHBoxLayout, QHeaderView, QTableWidget, QTableWidgetItem, QWidget
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.96.2
3
+ Version: 0.96.3
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=9dZ_EvimZrDzG8MtII0qtBYMM_Nc6xqh2iFRds0rlvE,8370
3
3
  .pylintrc,sha256=eeY8YwSI74oFfq6IYIbCqnx3Vk8ZncKaatv96n_Y8Rs,18544
4
4
  .readthedocs.yaml,sha256=aSOc277LqXcsTI6lgvm_JY80lMlr69GbPKgivua2cS0,603
5
- CHANGELOG.md,sha256=JevFb8k7ihFuKfooyCqcyptPCHkn6vBmWWLI6YOyNHg,6717
5
+ CHANGELOG.md,sha256=Q1FKs-7gicXfxvHjyuIdaKecEvloNNsu0V1KEDEb9uU,6725
6
6
  LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
7
- PKG-INFO,sha256=xRvEZ02kp6ROhkDYvw-jCEJA0QqyjeTRUHYJnbgxgXY,1325
7
+ PKG-INFO,sha256=M7lPbVphGdY6VJ0p5fF2s1cua091gARo7gHwo8owizg,1325
8
8
  README.md,sha256=Od69x-RS85Hph0-WwWACwal4yUd67XkEn4APEfHhHFw,2649
9
- pyproject.toml,sha256=S3RcibQIzFA7_Ydzi3rai8TL0k5643CILs3-IMEJ_8s,2416
9
+ pyproject.toml,sha256=usB4rp_KpSc9TJc8Cyb9OqV_iPUCmz8kWBmGBE86bC4,2416
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
@@ -89,11 +89,11 @@ bec_widgets/qt_utils/toolbar.py,sha256=A5vXNlF7kxvdcPCmRvsy9P3f6M5NomlT2PgtUmnt9
89
89
  bec_widgets/utils/__init__.py,sha256=1930ji1Jj6dVuY81Wd2kYBhHYNV-2R0bN_L4o9zBj1U,533
90
90
  bec_widgets/utils/bec_connector.py,sha256=SivHKXVyNVqeu3kCXYEPpbleTVw8g1cW0FKq1QrQgco,9987
91
91
  bec_widgets/utils/bec_designer.py,sha256=ak3G8FdojUPjVBBwdPXw7tN5P2Uxr-SSoQt394jXeAA,4308
92
- bec_widgets/utils/bec_dispatcher.py,sha256=F66edY3Ib_ZjTT24qoAbjwUOdOKt6CiWUUqN1I1xxZs,5865
92
+ bec_widgets/utils/bec_dispatcher.py,sha256=NkObWO_gRO9Uobz-fy0gVTZqQsbFRaKj6fbjYZoErFI,6400
93
93
  bec_widgets/utils/bec_table.py,sha256=nA2b8ukSeUfquFMAxGrUVOqdrzMoDYD6O_4EYbOG2zk,717
94
94
  bec_widgets/utils/bec_widget.py,sha256=Bo2v1aP7rgSAQajW8GBJbI3iovTn_hGCsmeFMo7bT10,707
95
95
  bec_widgets/utils/colors.py,sha256=hNIi99EpMv3t3hTJIL2jBe5nzh5f2fuCyEKXEPWSQSc,10501
96
- bec_widgets/utils/container_utils.py,sha256=m3VUyAYmSWkEwApP9tBvKxPYVtc2kHw4toxIpMryJy4,1495
96
+ bec_widgets/utils/container_utils.py,sha256=0wr3ZfuMiAFKCrQHVjxjw-Vuk8wsHdridqcjy2eY840,1531
97
97
  bec_widgets/utils/crosshair.py,sha256=ywj4Pr2Xx8tFsD5qrHIocanKlNqDd51ElbEfxenuYM0,11363
98
98
  bec_widgets/utils/entry_validator.py,sha256=3skJIsUwTYicT76AMHm_M78RiWtUgyD2zb-Rxo2HdHQ,1313
99
99
  bec_widgets/utils/generate_designer_plugin.py,sha256=eidqauS8YLgoxkPntPL0oSG_lYqI2D7fSyOZvOtCU_U,5891
@@ -112,7 +112,7 @@ bec_widgets/widgets/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKV
112
112
  bec_widgets/widgets/base_classes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
113
113
  bec_widgets/widgets/base_classes/device_input_base.py,sha256=thCOHOa9Z0b3-vlNFWK6PT_DdPTANnfj0_DLES_K-eE,3902
114
114
  bec_widgets/widgets/bec_queue/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
115
- bec_widgets/widgets/bec_queue/bec_queue.py,sha256=bU3HvghPuh7smTuKMp5WlJ0g3rW0UHIV05WekNHU8Q8,3846
115
+ bec_widgets/widgets/bec_queue/bec_queue.py,sha256=IDZ2Jy0SeuJJ23lyVg8TnkUPJ8vfuGJUg5a9lt5jwPQ,3882
116
116
  bec_widgets/widgets/bec_queue/bec_queue.pyproject,sha256=VhoNmAv1DQUl9dg7dELyf5i4pZ5k65N3GnqOYiSwbQo,27
117
117
  bec_widgets/widgets/bec_queue/bec_queue_plugin.py,sha256=wuUeTXorzsrVi9ifCSjVkEMX9qQ_q6PydHBkTkgeoEA,1461
118
118
  bec_widgets/widgets/bec_queue/register_bec_queue.py,sha256=XnwtUSa1asK1b80knKWodcyX9qJy4DnKsQL_FoDfZy4,463
@@ -258,7 +258,7 @@ bec_widgets/widgets/website/website.py,sha256=vyRJr4jsti1h6cPHzTTtS_0IELJ3kYdS2_
258
258
  bec_widgets/widgets/website/website_widget.pyproject,sha256=scOiV3cV1_BjbzpPzy2N8rIJL5P2qIZz8ObTJ-Uvdtg,25
259
259
  bec_widgets/widgets/website/website_widget_plugin.py,sha256=E5qf7ZK26tkXjRwJMzYqHypX0ChxAleMs6Mxw7XaPl4,1461
260
260
  docs/Makefile,sha256=i2WHuFlgfyAPEW4ssEP8NY4cOibDJrVjvzSEU8_Ggwc,634
261
- docs/conf.py,sha256=eSfoMdl2eObhbKr7eki59DrkNUh15KfcZpuBc7goMRc,2500
261
+ docs/conf.py,sha256=xrP_NOgayguXdfhEK6Oag5KlBxzzbHCv0zbitTpUWqM,2519
262
262
  docs/index.md,sha256=h4edya5UA0bx21ReHu40lJudqVBH41tOASjnCjmoYj8,1197
263
263
  docs/make.bat,sha256=vKazJE8RW49Cy8K7hm8QYbletvAd8YkeKsaPA_dWnXs,800
264
264
  docs/requirements.txt,sha256=gMQDaDpz_LSH5TP6dKxKXqI5kupNnT4g-4KJ4fg2o5s,161
@@ -296,7 +296,8 @@ docs/developer/introduction/concepts.md,sha256=N23ewZjPx97eJtrU6-0Lou2IvPfkfZ6Nw
296
296
  docs/developer/introduction/contributing.md,sha256=ocW5kjBNwD5k_nDkusXUpsW8jJALajrpNSRVJftuF-k,1668
297
297
  docs/developer/introduction/introduction.md,sha256=vR732ai0u-NiP8ij2_HJucgT4CDhjyrARbThDMqUc74,788
298
298
  docs/developer/introduction/useful_links.md,sha256=ytWRyLTAveU8ELrA0GL9hzTVCBRNBOTV8pRxvPp1huk,1487
299
- docs/developer/widget_development/widget_development.md,sha256=wGfDjbt9EonVxUg59keADy7wCLyS-KzCz7m4hY0OV_A,526
299
+ docs/developer/widget_development/bec_dispatcher.md,sha256=AX3XVNE_9E1_rawD9q-yY9yvCEaZQiglfWpJpRn5TV0,8018
300
+ docs/developer/widget_development/widget_development.md,sha256=LE9_o1IeqLBgb1jaoLlXrOlqIUAEJPJpsHs8C3cSQ1k,542
300
301
  docs/introduction/introduction.md,sha256=YBEFDhxqHTcbfbNTo76xDflaFUHIqDs-sToA1HRmCnI,1436
301
302
  docs/user/customisation.md,sha256=wCW8fAbqtlgGE3mURvXOrK67Xo0_B-lxfg0sYuQWB40,3186
302
303
  docs/user/user.md,sha256=FuBog2_wymy-A-p6QhXYf7CYn6tR6ojwK1ZLgV-tF1E,1499
@@ -399,8 +400,8 @@ tests/unit_tests/test_configs/config_device_no_entry.yaml,sha256=hdvue9KLc_kfNzG
399
400
  tests/unit_tests/test_configs/config_scan.yaml,sha256=vo484BbWOjA_e-h6bTjSV9k7QaQHrlAvx-z8wtY-P4E,1915
400
401
  tests/unit_tests/test_msgs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
401
402
  tests/unit_tests/test_msgs/available_scans_message.py,sha256=m_z97hIrjHXXMa2Ex-UvsPmTxOYXfjxyJaGkIY6StTY,46532
402
- bec_widgets-0.96.2.dist-info/METADATA,sha256=xRvEZ02kp6ROhkDYvw-jCEJA0QqyjeTRUHYJnbgxgXY,1325
403
- bec_widgets-0.96.2.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
404
- bec_widgets-0.96.2.dist-info/entry_points.txt,sha256=3otEkCdDB9LZJuBLzG4pFLK5Di0CVybN_12IsZrQ-58,166
405
- bec_widgets-0.96.2.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
406
- bec_widgets-0.96.2.dist-info/RECORD,,
403
+ bec_widgets-0.96.3.dist-info/METADATA,sha256=M7lPbVphGdY6VJ0p5fF2s1cua091gARo7gHwo8owizg,1325
404
+ bec_widgets-0.96.3.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
405
+ bec_widgets-0.96.3.dist-info/entry_points.txt,sha256=3otEkCdDB9LZJuBLzG4pFLK5Di0CVybN_12IsZrQ-58,166
406
+ bec_widgets-0.96.3.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
407
+ bec_widgets-0.96.3.dist-info/RECORD,,
docs/conf.py CHANGED
@@ -65,7 +65,7 @@ add_module_names = False # Remove namespaces from class/method signatures
65
65
  autodoc_inherit_docstrings = True # If no docstring, inherit from base class
66
66
  set_type_checking_flag = True # Enable 'expensive' imports for sphinx_autodoc_typehints
67
67
  autoclass_content = "both" # Include both class docstring and __init__
68
- autodoc_mock_imports = ["pyqtgraph"]
68
+ autodoc_mock_imports = ["pyqtgraph", "qtpy", "PySide6"]
69
69
 
70
70
  # Add any paths that contain templates here, relative to this directory.
71
71
  templates_path = ["_templates"]
@@ -0,0 +1,143 @@
1
+ (developer.bec_dispatcher)=
2
+
3
+ # BECDispatcher
4
+
5
+ ## Overview
6
+
7
+ The [`BECDispatcher`](https://bec.readthedocs.io/projects/bec-widgets/en/latest/api_reference/_autosummary/bec_widgets.utils.bec_dispatcher.BECDispatcher.html#bec_widgets.utils.bec_dispatcher.BECDispatcher)
8
+ is a powerful tool that
9
+ simplifies the process of connecting Qt slots to message updates from the BEC server. It enables real-time communication
10
+ between your widget and the BEC server by listening to specific message channels and triggering callbacks when new data
11
+ is received.
12
+
13
+ This tool is especially useful for creating widgets that need to respond to dynamic data, such as device readbacks or
14
+ scan updates. By
15
+ using [`BECDispatcher`](https://bec.readthedocs.io/projects/bec-widgets/en/latest/api_reference/_autosummary/bec_widgets.utils.bec_dispatcher.BECDispatcher.html#bec_widgets.utils.bec_dispatcher.BECDispatcher),
16
+ you
17
+ can create callback functions that react to incoming messages and update your widget's state or perform other tasks
18
+ based on the data received.
19
+
20
+ ## How It Works
21
+
22
+ When you create a widget that needs to respond to updates from the BEC server, you can use
23
+ the [`BECDispatcher`](https://bec.readthedocs.io/projects/bec-widgets/en/latest/api_reference/_autosummary/bec_widgets.utils.bec_dispatcher.BECDispatcher.html#bec_widgets.utils.bec_dispatcher.BECDispatcher)
24
+ to
25
+ connect specific Qt slots (callback functions) to message endpoints. These endpoints are defined within the BEC system
26
+ and represent specific channels of information (
27
+ e.g., [`device readback`](https://beamline-experiment-control.readthedocs.io/en/latest/api_reference/_autosummary/bec_lib.endpoints.MessageEndpoints.html#bec_lib.endpoints.MessageEndpoints.device_readback),
28
+ [`scan_segment`](https://beamline-experiment-control.readthedocs.io/en/latest/api_reference/_autosummary/bec_lib.endpoints.MessageEndpoints.html#bec_lib.endpoints.MessageEndpoints.scan_segment),
29
+ etc.).
30
+
31
+ ### Step-by-Step Guide
32
+
33
+ 1. **Create a Callback Function**: Define a function within your widget that will handle the data received from the BEC
34
+ server. This function should usually accept two parameters: `msg_content` (the message content) and `metadata` (
35
+ additional
36
+ information about the message).
37
+
38
+ ```python
39
+ # Example for a callback function that updates a widget display based on motor readback data
40
+ from qtpy.QtCore import Slot
41
+
42
+ @Slot(dict, dict)
43
+ def on_device_readback(self, msg_content, metadata):
44
+ # Process the incoming data
45
+ new_value = msg_content["signals"]['motor_x']["value"]
46
+ # Update the widget's display or perform another action
47
+ self.update_display(new_value)
48
+ ```
49
+
50
+ 2. **Connect the Slot to an Endpoint**: Use
51
+ the [`BECDispatcher`](https://bec.readthedocs.io/projects/bec-widgets/en/latest/api_reference/_autosummary/bec_widgets.utils.bec_dispatcher.BECDispatcher.html#bec_widgets.utils.bec_dispatcher.BECDispatcher)
52
+ to connect your callback function to a specific
53
+ endpoint. The endpoint represents the type of data or message you're interested in.
54
+
55
+ ```python
56
+ from bec_lib.endpoints import MessageEndpoints
57
+
58
+ self.bec_dispatcher.connect_slot(self.on_device_readback, MessageEndpoints.device_readback("motor_x"))
59
+ ```
60
+
61
+ 3. **Handle Incoming Data**: Your callback function will be triggered automatically whenever a new message is received
62
+ on the connected endpoint. Use the data in `msg_content` to update your widget or perform other actions.
63
+
64
+ 4. **Clean Up Connections**: If your widget is being destroyed or you no longer need to listen for updates, make sure to
65
+ disconnect your slots from
66
+ the [`BECDispatcher`](https://bec.readthedocs.io/projects/bec-widgets/en/latest/api_reference/_autosummary/bec_widgets.utils.bec_dispatcher.BECDispatcher.html#bec_widgets.utils.bec_dispatcher.BECDispatcher)
67
+ to avoid memory or thread leaks.
68
+
69
+ ```python
70
+ self.bec_dispatcher.disconnect_slot(self.on_device_readback, MessageEndpoints.device_readback("motor_x"))
71
+ ```
72
+
73
+ ### Example: Motor Map Widget
74
+
75
+ The [`BECMotorMap`](https://bec.readthedocs.io/projects/bec-widgets/en/latest/api_reference/_autosummary/bec_widgets.widgets.figure.plots.motor_map.motor_map.BECMotorMap.html#bec-widgets-widgets-figure-plots-motor-map-motor-map-becmotormap)
76
+ widget is a great example of
77
+ how [`BECDispatcher`](https://bec.readthedocs.io/projects/bec-widgets/en/latest/api_reference/_autosummary/bec_widgets.utils.bec_dispatcher.BECDispatcher.html#bec_widgets.utils.bec_dispatcher.BECDispatcher)
78
+ can be used to handle real-time data updates. This
79
+ widget listens for updates on specific motor positions and dynamically updates the motor map display.
80
+
81
+ Here's a breakdown of
82
+ how [`BECDispatcher`](https://bec.readthedocs.io/projects/bec-widgets/en/latest/api_reference/_autosummary/bec_widgets.utils.bec_dispatcher.BECDispatcher.html#bec_widgets.utils.bec_dispatcher.BECDispatcher)
83
+ is used in
84
+ the [`BECMotorMap`](https://bec.readthedocs.io/projects/bec-widgets/en/latest/api_reference/_autosummary/bec_widgets.widgets.figure.plots.motor_map.motor_map.BECMotorMap.html#bec-widgets-widgets-figure-plots-motor-map-motor-map-becmotormap)
85
+ widget:
86
+
87
+ 1. **Connecting to Motor Readbacks**:
88
+ The widget connects to
89
+ the [`device readback`](https://beamline-experiment-control.readthedocs.io/en/latest/api_reference/_autosummary/bec_lib.endpoints.MessageEndpoints.html#bec_lib.endpoints.MessageEndpoints.device_readback)
90
+ endpoints using
91
+ the [`connect_slot`](https://bec.readthedocs.io/projects/bec-widgets/en/latest/api_reference/_autosummary/bec_widgets.utils.bec_dispatcher.BECDispatcher.html#bec_widgets.utils.bec_dispatcher.BECDispatcher.connect_slot)
92
+ method
93
+ of [`BECDispatcher`](https://bec.readthedocs.io/projects/bec-widgets/en/latest/api_reference/_autosummary/bec_widgets.utils.bec_dispatcher.BECDispatcher.html#bec_widgets.utils.bec_dispatcher.BECDispatcher).
94
+ This allows
95
+ the widget to receive real-time updates about the motor positions.
96
+
97
+ ```{literalinclude} ../../../bec_widgets/widgets/figure/plots/motor_map/motor_map.py
98
+ :language: python
99
+ :pyobject: BECMotorMap._connect_motor_to_slots
100
+ :dedent: 4
101
+ ```
102
+
103
+ 2. **Handling Readback Data**:
104
+ The `on_device_readback` slot is called whenever new data is received from the motor readback. This slot processes
105
+ the data and updates the motor map plot accordingly.
106
+
107
+ ```{literalinclude} ../../../bec_widgets/widgets/figure/plots/motor_map/motor_map.py
108
+ :language: python
109
+ :pyobject: BECMotorMap.on_device_readback
110
+ :dedent: 4
111
+ ```
112
+
113
+ 3. **Updating the Plot**:
114
+ The motor map plot is updated in response to the new data, providing a real-time visualization of the motor's
115
+ position.
116
+
117
+ ```{literalinclude} ../../../bec_widgets/widgets/figure/plots/motor_map/motor_map.py
118
+ :language: python
119
+ :pyobject: BECMotorMap._update_plot
120
+ :dedent: 4
121
+ ```
122
+
123
+ 4. **Disconnecting When No Longer Needed**:
124
+ The widget ensures that connections are properly cleaned up when no longer needed.
125
+
126
+ ```{literalinclude} ../../../bec_widgets/widgets/figure/plots/motor_map/motor_map.py
127
+ :language: python
128
+ :pyobject: BECMotorMap._update_plot
129
+ :dedent: 4
130
+ ```
131
+
132
+ ## Conclusion
133
+
134
+ The [`BECDispatcher`](https://bec.readthedocs.io/projects/bec-widgets/en/latest/api_reference/_autosummary/bec_widgets.utils.bec_dispatcher.BECDispatcher.html#bec_widgets.utils.bec_dispatcher.BECDispatcher)
135
+ is a key tool for developing interactive and responsive widgets within the BEC framework. By
136
+ leveraging this tool, you can create widgets that automatically respond to real-time data updates from the BEC server,
137
+ enhancing the interactivity and functionality of your user interface.
138
+
139
+ In next tutorials we will cover how to create a custom widget using the BECDispatcher and BECWidget base class.
140
+
141
+ ```{note}
142
+ For more details on specific messages and endpoints, please refer to the [Message Endpoints Documentation](https://beamline-experiment-control.readthedocs.io/en/latest/api_reference/_autosummary/bec_lib.endpoints.MessageEndpoints.html#bec-lib-endpoints-messageendpoints).
143
+ ```
@@ -8,4 +8,6 @@ maxdepth: 2
8
8
  hidden: false
9
9
  ---
10
10
 
11
+ bec_dispatcher
12
+
11
13
  ```
pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "bec_widgets"
7
- version = "0.96.2"
7
+ version = "0.96.3"
8
8
  description = "BEC Widgets"
9
9
  requires-python = ">=3.10"
10
10
  classifiers = [