bec-widgets 0.74.1__py3-none-any.whl → 0.75.0__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.75.0 (2024-06-26)
4
+
5
+ ### Feature
6
+
7
+ * feat(widgets): added simple bec queue widget ([`3faee98`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/3faee98ec80041a27e4c1f1156178de6f9dcdc63))
8
+
9
+ ### Refactor
10
+
11
+ * refactor(dispatcher): cleanup ([`ca02132`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/ca02132c8d18535b37e9192e00459d2aca6ba5cf))
12
+
3
13
  ## v0.74.1 (2024-06-26)
4
14
 
5
15
  ### Build
@@ -141,13 +151,3 @@
141
151
  * tests WIP ([`c09644b`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/c09644b29ddb291c91dc58bcd6ebf02ff45cab36))
142
152
 
143
153
  ## v0.70.0 (2024-06-21)
144
-
145
- ### Feature
146
-
147
- * feat(bec-designer): automatic plugin discovery ([`4639eee`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/4639eee0b975ebd7a946e0e290449f5b88c372eb))
148
-
149
- * feat(device_line_edit): plugin added to bec-designer ([`b4b27ae`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/b4b27aea3d8c08fa3d5d5514c69dbde32721d1dc))
150
-
151
- ### Fix
152
-
153
- * fix(bec-desiger+plugins): imports fixed, PYSIDE6 check to not enable run plugins with pyqt6 ([`50b3422`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/50b3422528d46d74317e8c903b6286e868ab7fe0))
PKG-INFO CHANGED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.74.1
3
+ Version: 0.75.0
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
bec_widgets/cli/client.py CHANGED
@@ -13,6 +13,7 @@ class Widgets(str, enum.Enum):
13
13
  Enum for the available widgets.
14
14
  """
15
15
 
16
+ BECQueue = "BECQueue"
16
17
  BECStatusBox = "BECStatusBox"
17
18
  BECDock = "BECDock"
18
19
  BECDockArea = "BECDockArea"
@@ -1446,6 +1447,24 @@ class BECPlotBase(RPCBase):
1446
1447
  """
1447
1448
 
1448
1449
 
1450
+ class BECQueue(RPCBase):
1451
+ @property
1452
+ @rpc_call
1453
+ def config_dict(self) -> "dict":
1454
+ """
1455
+ Get the configuration of the widget.
1456
+
1457
+ Returns:
1458
+ dict: The configuration of the widget.
1459
+ """
1460
+
1461
+ @rpc_call
1462
+ def get_all_rpc(self) -> "dict":
1463
+ """
1464
+ Get all registered RPC objects.
1465
+ """
1466
+
1467
+
1449
1468
  class BECStatusBox(RPCBase):
1450
1469
  @property
1451
1470
  @rpc_call
@@ -1,6 +1,5 @@
1
1
  from __future__ import annotations
2
2
 
3
- import argparse
4
3
  import collections
5
4
  from collections.abc import Callable
6
5
  from typing import TYPE_CHECKING, Union
File without changes
@@ -0,0 +1,111 @@
1
+ from bec_lib.endpoints import MessageEndpoints
2
+ from qtpy.QtCore import Qt, Slot
3
+ from qtpy.QtWidgets import QHeaderView, QTableWidget, QTableWidgetItem, QWidget
4
+
5
+ from bec_widgets.utils.bec_connector import BECConnector, ConnectionConfig
6
+
7
+
8
+ class BECQueue(BECConnector, QTableWidget):
9
+ """
10
+ Widget to display the BEC queue.
11
+ """
12
+
13
+ def __init__(
14
+ self,
15
+ parent: QWidget | None = None,
16
+ client=None,
17
+ config: ConnectionConfig = None,
18
+ gui_id: str = None,
19
+ ):
20
+ super().__init__(client, config, gui_id)
21
+ QTableWidget.__init__(self, parent=parent)
22
+ self.setColumnCount(3)
23
+ self.setHorizontalHeaderLabels(["Scan Number", "Type", "Status"])
24
+ header = self.horizontalHeader()
25
+ header.setSectionResizeMode(QHeaderView.Stretch)
26
+ self.bec_dispatcher.connect_slot(self.update_queue, MessageEndpoints.scan_queue_status())
27
+ self.reset_content()
28
+
29
+ @Slot(dict, dict)
30
+ def update_queue(self, content, _metadata):
31
+ """
32
+ Update the queue table with the latest queue information.
33
+
34
+ Args:
35
+ content (dict): The queue content.
36
+ _metadata (dict): The metadata.
37
+ """
38
+ # only show the primary queue for now
39
+ queue_info = content.get("queue", {}).get("primary", {}).get("info", [])
40
+ self.setRowCount(len(queue_info))
41
+ self.clearContents()
42
+
43
+ if not queue_info:
44
+ self.reset_content()
45
+ return
46
+
47
+ for index, item in enumerate(queue_info):
48
+ blocks = item.get("request_blocks", [])
49
+ scan_types = []
50
+ scan_numbers = []
51
+ status = item.get("status", "")
52
+ for request_block in blocks:
53
+ scan_type = request_block.get("content", {}).get("scan_type", "")
54
+ if scan_type:
55
+ scan_types.append(scan_type)
56
+ scan_number = request_block.get("scan_number", "")
57
+ if scan_number:
58
+ scan_numbers.append(str(scan_number))
59
+ if scan_types:
60
+ scan_types = ", ".join(scan_types)
61
+ if scan_numbers:
62
+ scan_numbers = ", ".join(scan_numbers)
63
+ self.set_row(index, scan_numbers, scan_types, status)
64
+
65
+ def format_item(self, content: str) -> QTableWidgetItem:
66
+ """
67
+ Format the content of the table item.
68
+
69
+ Args:
70
+ content (str): The content to be formatted.
71
+
72
+ Returns:
73
+ QTableWidgetItem: The formatted item.
74
+ """
75
+ item = QTableWidgetItem(content)
76
+ item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
77
+ return item
78
+
79
+ def set_row(self, index: int, scan_number: str, scan_type: str, status: str):
80
+ """
81
+ Set the row of the table.
82
+
83
+ Args:
84
+ index (int): The index of the row.
85
+ scan_number (str): The scan number.
86
+ scan_type (str): The scan type.
87
+ status (str): The status.
88
+ """
89
+
90
+ self.setItem(index, 0, self.format_item(scan_number))
91
+ self.setItem(index, 1, self.format_item(scan_type))
92
+ self.setItem(index, 2, self.format_item(status))
93
+
94
+ def reset_content(self):
95
+ """
96
+ Reset the content of the table.
97
+ """
98
+
99
+ self.setRowCount(1)
100
+ self.set_row(0, "", "", "")
101
+
102
+
103
+ if __name__ == "__main__": # pragma: no cover
104
+ import sys
105
+
106
+ from qtpy.QtWidgets import QApplication
107
+
108
+ app = QApplication(sys.argv)
109
+ widget = BECQueue()
110
+ widget.show()
111
+ sys.exit(app.exec_())
@@ -0,0 +1 @@
1
+ {'files': ['bec_queue.py']}
@@ -0,0 +1,54 @@
1
+ # Copyright (C) 2022 The Qt Company Ltd.
2
+ # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
+
4
+ from qtpy.QtDesigner import QDesignerCustomWidgetInterface
5
+ from qtpy.QtGui import QIcon
6
+
7
+ from bec_widgets.widgets.bec_queue.bec_queue import BECQueue
8
+
9
+ DOM_XML = """
10
+ <ui language='c++'>
11
+ <widget class='BECQueue' name='bec_queue'>
12
+ </widget>
13
+ </ui>
14
+ """
15
+
16
+
17
+ class BECQueuePlugin(QDesignerCustomWidgetInterface): # pragma: no cover
18
+ def __init__(self):
19
+ super().__init__()
20
+ self._form_editor = None
21
+
22
+ def createWidget(self, parent):
23
+ t = BECQueue(parent)
24
+ return t
25
+
26
+ def domXml(self):
27
+ return DOM_XML
28
+
29
+ def group(self):
30
+ return ""
31
+
32
+ def icon(self):
33
+ return QIcon()
34
+
35
+ def includeFile(self):
36
+ return "bec_queue"
37
+
38
+ def initialize(self, form_editor):
39
+ self._form_editor = form_editor
40
+
41
+ def isContainer(self):
42
+ return False
43
+
44
+ def isInitialized(self):
45
+ return self._form_editor is not None
46
+
47
+ def name(self):
48
+ return "BECQueue"
49
+
50
+ def toolTip(self):
51
+ return "Widget to display the BEC queue."
52
+
53
+ def whatsThis(self):
54
+ return self.toolTip()
@@ -0,0 +1,15 @@
1
+ def main(): # pragma: no cover
2
+ from qtpy import PYSIDE6
3
+
4
+ if not PYSIDE6:
5
+ print("PYSIDE6 is not available in the environment. Cannot patch designer.")
6
+ return
7
+ from PySide6.QtDesigner import QPyDesignerCustomWidgetCollection
8
+
9
+ from bec_widgets.widgets.bec_queue.bec_queue_plugin import BECQueuePlugin
10
+
11
+ QPyDesignerCustomWidgetCollection.addCustomWidget(BECQueuePlugin())
12
+
13
+
14
+ if __name__ == "__main__": # pragma: no cover
15
+ main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.74.1
3
+ Version: 0.75.0
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=RnYDz4zKXjlqltTryprlB1s5vLXxI2-seW-Vb70NNF0,8162
3
3
  .pylintrc,sha256=OstrgmEyP0smNFBKoIN5_26-UmNZgMHnbjvAWX0UrLs,18535
4
4
  .readthedocs.yaml,sha256=aSOc277LqXcsTI6lgvm_JY80lMlr69GbPKgivua2cS0,603
5
- CHANGELOG.md,sha256=aGvafXlmnzAG4Eu08nM3q6ule47giC-cjueEsIHpiWk,7057
5
+ CHANGELOG.md,sha256=sx0VgXjuW4b9kl-0R2dYbUIrICL3FUW9YLiHZndxdwQ,6864
6
6
  LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
7
- PKG-INFO,sha256=sxQGITcAB0UpR2bYuY2dUGxFuqeSHV8yiZw3FQHOg2U,1407
7
+ PKG-INFO,sha256=LLUv5zSlJNd63QCDdWN-5IkzTXbvmzwvRWtafsg6Pcg,1407
8
8
  README.md,sha256=y4jB6wvArS7N8_iTbKWnSM_oRAqLA2GqgzUR-FMh5sU,2645
9
- pyproject.toml,sha256=ljABqddhgOWctRagAmk6CRg_pBS4bCGGfWXmRRkIktM,2344
9
+ pyproject.toml,sha256=cipdKD-cFlub0rDkpT02AeG99qLXGJXtbRJ84v0r3Fg,2344
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
@@ -17,7 +17,7 @@ bec_widgets/assets/bec_widgets_icon.png,sha256=K8dgGwIjalDh9PRHUsSQBqgdX7a00nM3i
17
17
  bec_widgets/assets/terminal_icon.png,sha256=bJl7Tft4Fi2uxvuXI8o14uMHnI9eAWKSU2uftXCH9ws,3889
18
18
  bec_widgets/cli/__init__.py,sha256=d0Q6Fn44e7wFfLabDOBxpcJ1DPKWlFunGYDUBmO-4hA,22
19
19
  bec_widgets/cli/auto_updates.py,sha256=DyBV3HnjMSH-cvVkYNcDiYKVf0Xut4Qy2qGQqkW47Bw,4833
20
- bec_widgets/cli/client.py,sha256=ewhDGqzbP6iT-MPLMWs3fhZsj-RuO2Mm5bC2RvHEMMg,61210
20
+ bec_widgets/cli/client.py,sha256=754vTVMVLkdpGa5wsH2wGP0fJW59wRubt6HOB8AG7_w,61582
21
21
  bec_widgets/cli/client_utils.py,sha256=zq1gPW7t4n9Nsn4MLkdUeKwwl-9nUcf5UjuN8lZr9iY,12281
22
22
  bec_widgets/cli/generate_cli.py,sha256=InKBVYM7DRfAVLNJhRJbWWSSPBQBHI8Ek6v7NCsK0ME,4997
23
23
  bec_widgets/cli/rpc_register.py,sha256=QxXUZu5XNg00Yf5O3UHWOXg3-f_pzKjjoZYMOa-MOJc,2216
@@ -40,7 +40,7 @@ bec_widgets/examples/plugin_example_pyside/tictactoetaskmenu.py,sha256=LNwplI6de
40
40
  bec_widgets/utils/__init__.py,sha256=1930ji1Jj6dVuY81Wd2kYBhHYNV-2R0bN_L4o9zBj1U,533
41
41
  bec_widgets/utils/bec_connector.py,sha256=t59482Tu30eiQ2YNHJZFEE-wQFt4qf85OmBfPkl-3N4,7335
42
42
  bec_widgets/utils/bec_designer.py,sha256=Q5qhdB7Jiw768dzlJ9bNxLrCbDKw4qNmhbO-9zLTVpw,4318
43
- bec_widgets/utils/bec_dispatcher.py,sha256=yM9PG04O7ABhiA9Nzk38Rv9Qbjc5O93wi2xfSbOlOxc,6202
43
+ bec_widgets/utils/bec_dispatcher.py,sha256=QZjRKNrZ181yt_6nLJCfdNk5EyeaGImApNA1FWR4rqo,6186
44
44
  bec_widgets/utils/bec_table.py,sha256=nA2b8ukSeUfquFMAxGrUVOqdrzMoDYD6O_4EYbOG2zk,717
45
45
  bec_widgets/utils/colors.py,sha256=GYSDe0ZxsJSwxvuy-yG2BH17qlf_Sjq8dhDcyp9IhBI,8532
46
46
  bec_widgets/utils/container_utils.py,sha256=m3VUyAYmSWkEwApP9tBvKxPYVtc2kHw4toxIpMryJy4,1495
@@ -55,6 +55,11 @@ bec_widgets/utils/validator_delegate.py,sha256=Emj1WF6W8Ke1ruBWUfmHdVJpmOSPezuOt
55
55
  bec_widgets/utils/widget_io.py,sha256=U_02ESf9Ukz63B01AzYioNepSc6SX11nJhPPSDmL4IA,11318
56
56
  bec_widgets/utils/yaml_dialog.py,sha256=cMVif-39SB9WjwGH5FWBJcFs4tnfFJFs5cacydRyhy0,1853
57
57
  bec_widgets/widgets/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
58
+ bec_widgets/widgets/bec_queue/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
+ bec_widgets/widgets/bec_queue/bec_queue.py,sha256=voIsj599a5t-u-H15tpSqjGBmy5ra6LsHpZnqEZFrI8,3551
60
+ bec_widgets/widgets/bec_queue/bec_queue.pyproject,sha256=VhoNmAv1DQUl9dg7dELyf5i4pZ5k65N3GnqOYiSwbQo,27
61
+ bec_widgets/widgets/bec_queue/bec_queue_plugin.py,sha256=hDJm8Zd_GIDw2R8VYn4ytwrHVCmJUjC9dGDMae2omU0,1175
62
+ bec_widgets/widgets/bec_queue/register_bec_queue.py,sha256=XnwtUSa1asK1b80knKWodcyX9qJy4DnKsQL_FoDfZy4,463
58
63
  bec_widgets/widgets/bec_status_box/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
64
  bec_widgets/widgets/bec_status_box/bec_status_box.py,sha256=twWugYlGVSl9ziSbjeB75BZwuruXFszRoOlN0d79Gnk,14523
60
65
  bec_widgets/widgets/bec_status_box/status_item.py,sha256=wPkDm0GCGNXXpy3rR_Ljaxy0ZHeiiYcrWFqEntZnz4E,5869
@@ -185,6 +190,7 @@ tests/unit_tests/test_bec_dock.py,sha256=BXKXpuyIYj-l6KSyhQtM_p3kRFCRECIoXLzvkcJ
185
190
  tests/unit_tests/test_bec_figure.py,sha256=aEd2R8K6fU2ON8QvPemGWpql_LaaYLipRlvnjBY2qFA,8009
186
191
  tests/unit_tests/test_bec_image.py,sha256=mjvcrHgOF_FCj6WbUyxvZH9HL63QGA5C0PNZ5dXYn50,2541
187
192
  tests/unit_tests/test_bec_motor_map.py,sha256=AfD_9-x6VV3TPnkQgNfFYRndPHDsGx-a_YknFeDr6hc,4588
193
+ tests/unit_tests/test_bec_queue.py,sha256=u-uc-iZeGAS8P90o6Cxy5oz_60zHpirGAu04OgQPDXw,4598
188
194
  tests/unit_tests/test_bec_status_box.py,sha256=xR8c-hXFI9gKpNGhnnC5l_nzazfvPkWkhcAfJ77hxqY,4731
189
195
  tests/unit_tests/test_client_utils.py,sha256=eViJ1Tz-HX9TkMvQH6W8cO-c3_1I8bUc4_Yen6LOc0E,830
190
196
  tests/unit_tests/test_color_validation.py,sha256=csdvVKAohENZIRY-JQ97Hv-TShb1erj4oKMX7QRwo78,1883
@@ -212,8 +218,8 @@ tests/unit_tests/test_configs/config_device_no_entry.yaml,sha256=hdvue9KLc_kfNzG
212
218
  tests/unit_tests/test_configs/config_scan.yaml,sha256=vo484BbWOjA_e-h6bTjSV9k7QaQHrlAvx-z8wtY-P4E,1915
213
219
  tests/unit_tests/test_msgs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
214
220
  tests/unit_tests/test_msgs/available_scans_message.py,sha256=m_z97hIrjHXXMa2Ex-UvsPmTxOYXfjxyJaGkIY6StTY,46532
215
- bec_widgets-0.74.1.dist-info/METADATA,sha256=sxQGITcAB0UpR2bYuY2dUGxFuqeSHV8yiZw3FQHOg2U,1407
216
- bec_widgets-0.74.1.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
217
- bec_widgets-0.74.1.dist-info/entry_points.txt,sha256=3otEkCdDB9LZJuBLzG4pFLK5Di0CVybN_12IsZrQ-58,166
218
- bec_widgets-0.74.1.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
219
- bec_widgets-0.74.1.dist-info/RECORD,,
221
+ bec_widgets-0.75.0.dist-info/METADATA,sha256=LLUv5zSlJNd63QCDdWN-5IkzTXbvmzwvRWtafsg6Pcg,1407
222
+ bec_widgets-0.75.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
223
+ bec_widgets-0.75.0.dist-info/entry_points.txt,sha256=3otEkCdDB9LZJuBLzG4pFLK5Di0CVybN_12IsZrQ-58,166
224
+ bec_widgets-0.75.0.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
225
+ bec_widgets-0.75.0.dist-info/RECORD,,
pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "bec_widgets"
7
- version = "0.74.1"
7
+ version = "0.75.0"
8
8
  description = "BEC Widgets"
9
9
  requires-python = ">=3.10"
10
10
  classifiers = [
@@ -0,0 +1,111 @@
1
+ import pytest
2
+ from bec_lib import messages
3
+
4
+ from bec_widgets.widgets.bec_queue.bec_queue import BECQueue
5
+
6
+ from .client_mocks import mocked_client
7
+
8
+
9
+ @pytest.fixture
10
+ def bec_queue_msg_full():
11
+ content = {
12
+ "primary": {
13
+ "info": [
14
+ {
15
+ "active_request_block": None,
16
+ "is_scan": [True],
17
+ "queue_id": "600163fc-5e56-4901-af25-14e9ee76817c",
18
+ "request_blocks": [
19
+ {
20
+ "RID": "89a76021-28c0-4297-828e-74ae40b941e5",
21
+ "content": {
22
+ "parameter": {
23
+ "args": {"samx": [-0.1, 0.1]},
24
+ "kwargs": {
25
+ "exp_time": 0.5,
26
+ "relative": True,
27
+ "steps": 20,
28
+ "system_config": {
29
+ "file_directory": None,
30
+ "file_suffix": None,
31
+ },
32
+ },
33
+ },
34
+ "queue": "primary",
35
+ "scan_type": "line_scan",
36
+ },
37
+ "is_scan": True,
38
+ "metadata": {
39
+ "RID": "89a76021-28c0-4297-828e-74ae40b941e5",
40
+ "file_directory": None,
41
+ "file_suffix": None,
42
+ "user_metadata": {"sample_name": "testA"},
43
+ },
44
+ "msg": messages.ScanQueueMessage(
45
+ metadata={
46
+ "file_suffix": None,
47
+ "file_directory": None,
48
+ "user_metadata": {"sample_name": "testA"},
49
+ "RID": "89a76021-28c0-4297-828e-74ae40b941e5",
50
+ },
51
+ scan_type="line_scan",
52
+ parameter={
53
+ "args": {"samx": [-0.1, 0.1]},
54
+ "kwargs": {
55
+ "steps": 20,
56
+ "exp_time": 0.5,
57
+ "relative": True,
58
+ "system_config": {
59
+ "file_suffix": None,
60
+ "file_directory": None,
61
+ },
62
+ },
63
+ },
64
+ queue="primary",
65
+ ),
66
+ "readout_priority": {
67
+ "async": [],
68
+ "baseline": [],
69
+ "monitored": ["samx"],
70
+ "on_request": [],
71
+ },
72
+ "report_instructions": [{"scan_progress": 20}],
73
+ "scan_id": "2d704cc3-c172-404c-866d-608ce09fce40",
74
+ "scan_motors": ["samx"],
75
+ "scan_number": 1289,
76
+ }
77
+ ],
78
+ "scan_id": ["2d704cc3-c172-404c-866d-608ce09fce40"],
79
+ "scan_number": [1289],
80
+ "status": "COMPLETED",
81
+ }
82
+ ],
83
+ "status": "RUNNING",
84
+ }
85
+ }
86
+ msg = messages.ScanQueueStatusMessage(metadata={}, queue=content)
87
+ return msg
88
+
89
+
90
+ @pytest.fixture
91
+ def bec_queue(qtbot, mocked_client):
92
+ widget = BECQueue(client=mocked_client)
93
+ qtbot.addWidget(widget)
94
+ qtbot.waitExposed(widget)
95
+ yield widget
96
+
97
+
98
+ def test_bec_queue(bec_queue, bec_queue_msg_full):
99
+ bec_queue.update_queue(bec_queue_msg_full.content, {})
100
+ assert bec_queue.rowCount() == 1
101
+ assert bec_queue.item(0, 0).text() == "1289"
102
+ assert bec_queue.item(0, 1).text() == "line_scan"
103
+ assert bec_queue.item(0, 2).text() == "COMPLETED"
104
+
105
+
106
+ def test_bec_queue_empty(bec_queue):
107
+ bec_queue.update_queue({}, {})
108
+ assert bec_queue.rowCount() == 1
109
+ assert bec_queue.item(0, 0).text() == ""
110
+ assert bec_queue.item(0, 1).text() == ""
111
+ assert bec_queue.item(0, 2).text() == ""