bec-widgets 0.100.0__py3-none-any.whl → 0.102.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.
Files changed (26) hide show
  1. CHANGELOG.md +30 -24
  2. PKG-INFO +1 -1
  3. bec_widgets/cli/client.py +30 -11
  4. bec_widgets/qt_utils/toolbar.py +1 -0
  5. bec_widgets/widgets/bec_queue/bec_queue.py +133 -11
  6. bec_widgets/widgets/button_abort/button_abort.py +12 -4
  7. bec_widgets/widgets/button_reset/button_reset.py +23 -6
  8. bec_widgets/widgets/button_resume/button_resume.py +3 -3
  9. bec_widgets/widgets/figure/plots/waveform/waveform.py +6 -5
  10. bec_widgets/widgets/lmfit_dialog/__init__.py +0 -0
  11. bec_widgets/widgets/lmfit_dialog/lm_fit_dialog.pyproject +1 -0
  12. bec_widgets/widgets/lmfit_dialog/lm_fit_dialog_plugin.py +54 -0
  13. bec_widgets/widgets/lmfit_dialog/lmfit_dialog.py +194 -0
  14. bec_widgets/widgets/lmfit_dialog/lmfit_dialog_compact.ui +120 -0
  15. bec_widgets/widgets/lmfit_dialog/lmfit_dialog_vertical.ui +147 -0
  16. bec_widgets/widgets/lmfit_dialog/register_lm_fit_dialog.py +15 -0
  17. bec_widgets/widgets/stop_button/stop_button.py +3 -3
  18. bec_widgets/widgets/waveform/waveform_popups/dap_summary_dialog/dap_summary_dialog.py +15 -55
  19. bec_widgets/widgets/waveform/waveform_widget.py +8 -7
  20. {bec_widgets-0.100.0.dist-info → bec_widgets-0.102.0.dist-info}/METADATA +1 -1
  21. {bec_widgets-0.100.0.dist-info → bec_widgets-0.102.0.dist-info}/RECORD +25 -19
  22. pyproject.toml +1 -1
  23. bec_widgets/widgets/waveform/waveform_popups/dap_summary_dialog/dap_summary.ui +0 -127
  24. {bec_widgets-0.100.0.dist-info → bec_widgets-0.102.0.dist-info}/WHEEL +0 -0
  25. {bec_widgets-0.100.0.dist-info → bec_widgets-0.102.0.dist-info}/entry_points.txt +0 -0
  26. {bec_widgets-0.100.0.dist-info → bec_widgets-0.102.0.dist-info}/licenses/LICENSE +0 -0
CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v0.102.0 (2024-09-04)
4
+
5
+ ### Documentation
6
+
7
+ * docs(buttons): buttons section of docs split to appearance and queue buttons ([`047aa26`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/047aa26a60220c826cc1375cf81daf11d1f3ab5c))
8
+
9
+ * docs(tests): added tests tutorial for widget ([`18d8561`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/18d8561c965d149a7662085f7dbe2a39a8c4a475))
10
+
11
+ ### Feature
12
+
13
+ * feat(queue): BECQueue controls extended with Resume, Stop, Abort, Reset buttons ([`0d7c10e`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/0d7c10e670e4937787e1afaa19ca8259ac752486))
14
+
15
+ ### Fix
16
+
17
+ * fix(queue_reset_button): queue reset has to be confirmed with msgBox ([`9dd43aa`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/9dd43aa1fd3991368002605df4389a7a7271011b))
18
+
19
+ ### Refactor
20
+
21
+ * refactor(tests): positioner box test changed to use create_widget fixture ([`df5eff3`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/df5eff3147c79ff0278e6a5a09c8f73d5236aed3))
22
+
23
+ ## v0.101.0 (2024-09-02)
24
+
25
+ ### Feature
26
+
27
+ * feat: add Dap dialog widget ([`9781b77`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/9781b77de27b2810fbb1047a61b1832dd186db01))
28
+
29
+ ### Refactor
30
+
31
+ * refactor: add docs, cleanup ([`61ecf49`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/61ecf491e52bfbfa0d5a84764a9095310659043d))
32
+
3
33
  ## v0.100.0 (2024-09-01)
4
34
 
5
35
  ### Documentation
@@ -124,30 +154,6 @@
124
154
 
125
155
  * docs(buttons): added missing buttons docs ([`4e5520a`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/4e5520aee2115d2fc0cebb3865433478a5ec8253))
126
156
 
127
- * docs(developer): tutorial for BECWidget base class ([`ac2cb51`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/ac2cb5197deef4d51e26ee5beb070eba3ffc210d))
128
-
129
157
  ### Fix
130
158
 
131
159
  * fix(theme): apply theme to all pyqtgraph widgets on manual updates ([`c550186`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/c5501860e8e07a53f4bce144d44ed39eda6290ef))
132
-
133
- ### Refactor
134
-
135
- * refactor(buttons): changed grid and thumbnail fig in gallery ([`4591ba8`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/4591ba8f73e22aba7258cad93c073f1387cb74a0))
136
-
137
- * refactor(icons): removed toolbar icons from assets ([`f335763`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/f335763280adb1d83ba31f073ce206e4cb5d15ef))
138
-
139
- * refactor(icons): moved widget icons to class attribute ICON_NAME ([`e890091`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/e890091d862e42317c7a54fc414ba37c85f268b0))
140
-
141
- ## v0.99.3 (2024-08-27)
142
-
143
- ### Build
144
-
145
- * build: updated min version of bec qthemes ([`d482434`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/d48243483ef8228cc5eb85e40a6b8f5da3b45520))
146
-
147
- ### Fix
148
-
149
- * fix(cmaps): unified all defaults to magma cmap ([`1ca9499`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/1ca9499edd334c19fe1e7aac71d3940a80a1ec95))
150
-
151
- * fix(color maps): color maps should take the background color into account; fixed min colors to 10 ([`060935f`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/060935ffc5472a958c337bf60834c5291f104ece))
152
-
153
- ## v0.99.2 (2024-08-27)
PKG-INFO CHANGED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.100.0
3
+ Version: 0.102.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
@@ -26,6 +26,7 @@ class Widgets(str, enum.Enum):
26
26
  DeviceBrowser = "DeviceBrowser"
27
27
  DeviceComboBox = "DeviceComboBox"
28
28
  DeviceLineEdit = "DeviceLineEdit"
29
+ LMFitDialog = "LMFitDialog"
29
30
  PositionerBox = "PositionerBox"
30
31
  PositionerControlLine = "PositionerControlLine"
31
32
  ResetButton = "ResetButton"
@@ -1811,6 +1812,15 @@ class BECWaveform(RPCBase):
1811
1812
  BECCurve: The curve object.
1812
1813
  """
1813
1814
 
1815
+ @rpc_call
1816
+ def get_dap_params(self) -> "dict":
1817
+ """
1818
+ Get the DAP parameters of all DAP curves.
1819
+
1820
+ Returns:
1821
+ dict: DAP parameters of all DAP curves.
1822
+ """
1823
+
1814
1824
  @rpc_call
1815
1825
  def set_x(self, x_name: "str", x_entry: "str | None" = None):
1816
1826
  """
@@ -1825,15 +1835,6 @@ class BECWaveform(RPCBase):
1825
1835
  x_entry(str): Entry of the x signal.
1826
1836
  """
1827
1837
 
1828
- @rpc_call
1829
- def get_dap_params(self) -> "dict":
1830
- """
1831
- Get the DAP parameters of all DAP curves.
1832
-
1833
- Returns:
1834
- dict: DAP parameters of all DAP curves.
1835
- """
1836
-
1837
1838
  @rpc_call
1838
1839
  def remove_curve(self, *identifiers):
1839
1840
  """
@@ -2096,10 +2097,10 @@ class BECWaveformWidget(RPCBase):
2096
2097
  self,
2097
2098
  x_name: "str",
2098
2099
  y_name: "str",
2100
+ dap: "str",
2099
2101
  x_entry: "str | None" = None,
2100
2102
  y_entry: "str | None" = None,
2101
2103
  color: "str | None" = None,
2102
- dap: "str" = "GaussianModel",
2103
2104
  validate_bec: "bool" = True,
2104
2105
  **kwargs,
2105
2106
  ) -> "BECCurve":
@@ -2313,7 +2314,7 @@ class BECWaveformWidget(RPCBase):
2313
2314
 
2314
2315
  class DarkModeButton(RPCBase):
2315
2316
  @rpc_call
2316
- def toggle_dark_mode(self) -> None:
2317
+ def toggle_dark_mode(self) -> "None":
2317
2318
  """
2318
2319
  Toggle the dark mode state. This will change the theme of the entire
2319
2320
  application to dark or light mode.
@@ -2392,6 +2393,24 @@ class DeviceLineEdit(RPCBase):
2392
2393
  """
2393
2394
 
2394
2395
 
2396
+ class LMFitDialog(RPCBase):
2397
+ @property
2398
+ @rpc_call
2399
+ def _config_dict(self) -> "dict":
2400
+ """
2401
+ Get the configuration of the widget.
2402
+
2403
+ Returns:
2404
+ dict: The configuration of the widget.
2405
+ """
2406
+
2407
+ @rpc_call
2408
+ def _get_all_rpc(self) -> "dict":
2409
+ """
2410
+ Get all registered RPC objects.
2411
+ """
2412
+
2413
+
2395
2414
  class PositionerBox(RPCBase):
2396
2415
  @rpc_call
2397
2416
  def set_positioner(self, positioner: "str | Positioner"):
@@ -162,6 +162,7 @@ class WidgetAction(ToolBarAction):
162
162
  def add_to_toolbar(self, toolbar, target):
163
163
  widget = QWidget()
164
164
  layout = QHBoxLayout(widget)
165
+ layout.setContentsMargins(0, 0, 0, 0)
165
166
  if self.label is not None:
166
167
  label = QLabel(f"{self.label}")
167
168
  layout.addWidget(label)
@@ -1,11 +1,18 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from bec_lib.endpoints import MessageEndpoints
4
- from qtpy.QtCore import Qt, Slot
5
- from qtpy.QtWidgets import QHBoxLayout, QHeaderView, QTableWidget, QTableWidgetItem, QWidget
4
+ from bec_qthemes import material_icon
5
+ from qtpy.QtCore import Property, Qt, Slot
6
+ from qtpy.QtGui import QColor
7
+ from qtpy.QtWidgets import QHeaderView, QLabel, QTableWidget, QTableWidgetItem, QVBoxLayout, QWidget
6
8
 
9
+ from bec_widgets.qt_utils.toolbar import ModularToolBar, SeparatorAction, WidgetAction
7
10
  from bec_widgets.utils.bec_connector import ConnectionConfig
8
11
  from bec_widgets.utils.bec_widget import BECWidget
12
+ from bec_widgets.widgets.button_abort.button_abort import AbortButton
13
+ from bec_widgets.widgets.button_reset.button_reset import ResetButton
14
+ from bec_widgets.widgets.button_resume.button_resume import ResumeButton
15
+ from bec_widgets.widgets.stop_button.stop_button import StopButton
9
16
 
10
17
 
11
18
  class BECQueue(BECWidget, QWidget):
@@ -14,6 +21,15 @@ class BECQueue(BECWidget, QWidget):
14
21
  """
15
22
 
16
23
  ICON_NAME = "edit_note"
24
+ status_colors = {
25
+ "STOPPED": "red",
26
+ "PENDING": "orange",
27
+ "IDLE": "gray",
28
+ "PAUSED": "yellow",
29
+ "DEFERRED_PAUSE": "lightyellow",
30
+ "RUNNING": "green",
31
+ "COMPLETED": "blue",
32
+ }
17
33
 
18
34
  def __init__(
19
35
  self,
@@ -21,19 +37,79 @@ class BECQueue(BECWidget, QWidget):
21
37
  client=None,
22
38
  config: ConnectionConfig = None,
23
39
  gui_id: str = None,
40
+ refresh_upon_start: bool = True,
24
41
  ):
25
42
  super().__init__(client, config, gui_id)
26
43
  QWidget.__init__(self, parent=parent)
44
+ self.layout = QVBoxLayout(self)
45
+ self.layout.setSpacing(0)
46
+ self.layout.setContentsMargins(0, 0, 0, 0)
47
+
48
+ # Set up the toolbar
49
+ self.set_toolbar()
50
+
51
+ # Set up the table
27
52
  self.table = QTableWidget(self)
28
- self.layout = QHBoxLayout(self)
29
53
  self.layout.addWidget(self.table)
30
-
31
- self.table.setColumnCount(3)
32
- self.table.setHorizontalHeaderLabels(["Scan Number", "Type", "Status"])
54
+ self.table.setColumnCount(4)
55
+ self.table.setHorizontalHeaderLabels(["Scan Number", "Type", "Status", "Cancel"])
33
56
  header = self.table.horizontalHeader()
34
57
  header.setSectionResizeMode(QHeaderView.Stretch)
58
+
35
59
  self.bec_dispatcher.connect_slot(self.update_queue, MessageEndpoints.scan_queue_status())
36
60
  self.reset_content()
61
+ if refresh_upon_start:
62
+ self.refresh_queue()
63
+
64
+ def set_toolbar(self):
65
+ """
66
+ Set the toolbar.
67
+ """
68
+ widget_label = QLabel("Live Queue")
69
+ widget_label.setStyleSheet("font-weight: bold;")
70
+ self.toolbar = ModularToolBar(
71
+ actions={
72
+ "widget_label": WidgetAction(widget=widget_label),
73
+ "separator_1": SeparatorAction(),
74
+ "resume": WidgetAction(widget=ResumeButton(toolbar=False)),
75
+ "stop": WidgetAction(widget=StopButton(toolbar=False)),
76
+ "reset": WidgetAction(widget=ResetButton(toolbar=False)),
77
+ },
78
+ target_widget=self,
79
+ )
80
+
81
+ self.layout.addWidget(self.toolbar)
82
+
83
+ @Property(bool)
84
+ def hide_toolbar(self):
85
+ """Property to hide the BEC Queue toolbar."""
86
+ return not self.toolbar.isVisible()
87
+
88
+ @hide_toolbar.setter
89
+ def hide_toolbar(self, hide: bool):
90
+ """
91
+ Setters for the hide_toolbar property.
92
+
93
+ Args:
94
+ hide(bool): Whether to hide the toolbar.
95
+ """
96
+ self._hide_toolbar(hide)
97
+
98
+ def _hide_toolbar(self, hide: bool):
99
+ """
100
+ Hide the toolbar.
101
+
102
+ Args:
103
+ hide(bool): Whether to hide the toolbar.
104
+ """
105
+ self.toolbar.setVisible(not hide)
106
+
107
+ def refresh_queue(self):
108
+ """
109
+ Refresh the queue.
110
+ """
111
+ msg = self.client.connector.get(MessageEndpoints.scan_queue_status())
112
+ self.update_queue(msg.content, msg.metadata)
37
113
 
38
114
  @Slot(dict, dict)
39
115
  def update_queue(self, content, _metadata):
@@ -57,6 +133,7 @@ class BECQueue(BECWidget, QWidget):
57
133
  blocks = item.get("request_blocks", [])
58
134
  scan_types = []
59
135
  scan_numbers = []
136
+ scan_ids = []
60
137
  status = item.get("status", "")
61
138
  for request_block in blocks:
62
139
  scan_type = request_block.get("content", {}).get("scan_type", "")
@@ -65,13 +142,18 @@ class BECQueue(BECWidget, QWidget):
65
142
  scan_number = request_block.get("scan_number", "")
66
143
  if scan_number:
67
144
  scan_numbers.append(str(scan_number))
145
+ scan_id = request_block.get("scan_id", "")
146
+ if scan_id:
147
+ scan_ids.append(scan_id)
68
148
  if scan_types:
69
149
  scan_types = ", ".join(scan_types)
70
150
  if scan_numbers:
71
151
  scan_numbers = ", ".join(scan_numbers)
72
- self.set_row(index, scan_numbers, scan_types, status)
152
+ if scan_ids:
153
+ scan_ids = ", ".join(scan_ids)
154
+ self.set_row(index, scan_numbers, scan_types, status, scan_ids)
73
155
 
74
- def format_item(self, content: str) -> QTableWidgetItem:
156
+ def format_item(self, content: str, status=False) -> QTableWidgetItem:
75
157
  """
76
158
  Format the content of the table item.
77
159
 
@@ -85,9 +167,17 @@ class BECQueue(BECWidget, QWidget):
85
167
  content = ""
86
168
  item = QTableWidgetItem(content)
87
169
  item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
170
+ # item.setFlags(item.flags() & ~Qt.ItemFlag.ItemIsEditable)
171
+
172
+ if status:
173
+ try:
174
+ color = self.status_colors.get(content, "black") # Default to black if not found
175
+ item.setForeground(QColor(color))
176
+ except:
177
+ return item
88
178
  return item
89
179
 
90
- def set_row(self, index: int, scan_number: str, scan_type: str, status: str):
180
+ def set_row(self, index: int, scan_number: str, scan_type: str, status: str, scan_id: str):
91
181
  """
92
182
  Set the row of the table.
93
183
 
@@ -97,10 +187,42 @@ class BECQueue(BECWidget, QWidget):
97
187
  scan_type (str): The scan type.
98
188
  status (str): The status.
99
189
  """
190
+ abort_button = self._create_abort_button(scan_id)
191
+ abort_button.button.clicked.connect(self.delete_selected_row)
100
192
 
101
193
  self.table.setItem(index, 0, self.format_item(scan_number))
102
194
  self.table.setItem(index, 1, self.format_item(scan_type))
103
- self.table.setItem(index, 2, self.format_item(status))
195
+ self.table.setItem(index, 2, self.format_item(status, status=True))
196
+ self.table.setCellWidget(index, 3, abort_button)
197
+
198
+ def _create_abort_button(self, scan_id: str) -> AbortButton:
199
+ """
200
+ Create an abort button with styling for BEC Queue widget for certain scan_id.
201
+
202
+ Args:
203
+ scan_id(str): The scan id to abort.
204
+
205
+ Returns:
206
+ AbortButton: The abort button.
207
+ """
208
+ abort_button = AbortButton(scan_id=scan_id)
209
+
210
+ abort_button.button.setText("")
211
+ abort_button.button.setIcon(
212
+ material_icon("cancel", color="#cc181e", filled=True, convert_to_pixmap=False)
213
+ )
214
+ abort_button.button.setStyleSheet("background-color: rgba(0,0,0,0) ")
215
+ abort_button.button.setFlat(True)
216
+
217
+ return abort_button
218
+
219
+ def delete_selected_row(self):
220
+
221
+ button = self.sender()
222
+ row = self.table.indexAt(button.pos()).row()
223
+ self.table.removeRow(row)
224
+
225
+ button.deleteLater()
104
226
 
105
227
  def reset_content(self):
106
228
  """
@@ -108,7 +230,7 @@ class BECQueue(BECWidget, QWidget):
108
230
  """
109
231
 
110
232
  self.table.setRowCount(1)
111
- self.set_row(0, "", "", "")
233
+ self.set_row(0, "", "", "", "")
112
234
 
113
235
 
114
236
  if __name__ == "__main__": # pragma: no cover
@@ -11,7 +11,9 @@ class AbortButton(BECWidget, QWidget):
11
11
 
12
12
  ICON_NAME = "cancel"
13
13
 
14
- def __init__(self, parent=None, client=None, config=None, gui_id=None, toolbar=False):
14
+ def __init__(
15
+ self, parent=None, client=None, config=None, gui_id=None, toolbar=False, scan_id=None
16
+ ):
15
17
  super().__init__(client=client, config=config, gui_id=gui_id)
16
18
  QWidget.__init__(self, parent=parent)
17
19
 
@@ -25,17 +27,19 @@ class AbortButton(BECWidget, QWidget):
25
27
  if toolbar:
26
28
  icon = material_icon("cancel", color="#666666", filled=True)
27
29
  self.button = QToolButton(icon=icon)
28
- self.button.triggered.connect(self.abort_scan)
30
+ self.button.setToolTip("Abort the scan")
29
31
  else:
30
32
  self.button = QPushButton()
31
33
  self.button.setText("Abort")
32
34
  self.button.setStyleSheet(
33
35
  "background-color: #666666; color: white; font-weight: bold; font-size: 12px;"
34
36
  )
35
- self.button.clicked.connect(self.abort_scan)
37
+ self.button.clicked.connect(self.abort_scan)
36
38
 
37
39
  self.layout.addWidget(self.button)
38
40
 
41
+ self.scan_id = scan_id
42
+
39
43
  @SafeSlot()
40
44
  def abort_scan(
41
45
  self,
@@ -46,4 +50,8 @@ class AbortButton(BECWidget, QWidget):
46
50
  Args:
47
51
  scan_id(str|None): The scan id to abort. If None, the current scan will be aborted.
48
52
  """
49
- self.queue.request_scan_abortion()
53
+ if self.scan_id is not None:
54
+ print(f"Aborting scan with scan_id: {self.scan_id}")
55
+ self.queue.request_scan_abortion(scan_id=self.scan_id)
56
+ else:
57
+ self.queue.request_scan_abortion()
@@ -1,13 +1,13 @@
1
1
  from bec_qthemes import material_icon
2
2
  from qtpy.QtCore import Qt
3
- from qtpy.QtWidgets import QHBoxLayout, QPushButton, QToolButton, QWidget
3
+ from qtpy.QtWidgets import QHBoxLayout, QMessageBox, QPushButton, QToolButton, QWidget
4
4
 
5
5
  from bec_widgets.qt_utils.error_popups import SafeSlot
6
6
  from bec_widgets.utils.bec_widget import BECWidget
7
7
 
8
8
 
9
9
  class ResetButton(BECWidget, QWidget):
10
- """A button that reset the scan queue."""
10
+ """A button that resets the scan queue."""
11
11
 
12
12
  ICON_NAME = "restart_alt"
13
13
 
@@ -23,20 +23,37 @@ class ResetButton(BECWidget, QWidget):
23
23
  self.layout.setAlignment(Qt.AlignmentFlag.AlignVCenter)
24
24
 
25
25
  if toolbar:
26
- icon = material_icon("restart_alt", color="#F19E39", filled=True)
26
+ icon = material_icon(
27
+ "restart_alt", color="#F19E39", filled=True, convert_to_pixmap=False
28
+ )
27
29
  self.button = QToolButton(icon=icon)
28
- self.button.triggered.connect(self.reset_queue)
30
+ self.button.setToolTip("Reset the scan queue")
29
31
  else:
30
32
  self.button = QPushButton()
31
33
  self.button.setText("Reset Queue")
32
34
  self.button.setStyleSheet(
33
35
  "background-color: #F19E39; color: white; font-weight: bold; font-size: 12px;"
34
36
  )
35
- self.button.clicked.connect(self.reset_queue)
37
+ self.button.clicked.connect(self.confirm_reset_queue)
36
38
 
37
39
  self.layout.addWidget(self.button)
38
40
 
41
+ @SafeSlot()
42
+ def confirm_reset_queue(self):
43
+ """Prompt the user to confirm the queue reset."""
44
+ msg_box = QMessageBox()
45
+ msg_box.setIcon(QMessageBox.Warning)
46
+ msg_box.setWindowTitle("Confirm Reset")
47
+ msg_box.setText(
48
+ "Are you sure you want to reset the scan queue? This action cannot be undone."
49
+ )
50
+ msg_box.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
51
+ msg_box.setDefaultButton(QMessageBox.No)
52
+
53
+ if msg_box.exec_() == QMessageBox.Yes:
54
+ self.reset_queue()
55
+
39
56
  @SafeSlot()
40
57
  def reset_queue(self):
41
- """Stop the scan."""
58
+ """Reset the scan queue."""
42
59
  self.queue.request_queue_reset()
@@ -23,16 +23,16 @@ class ResumeButton(BECWidget, QWidget):
23
23
  self.layout.setAlignment(Qt.AlignmentFlag.AlignVCenter)
24
24
 
25
25
  if toolbar:
26
- icon = material_icon("resume", color="#2793e8", filled=True)
26
+ icon = material_icon("resume", color="#2793e8", filled=True, convert_to_pixmap=False)
27
27
  self.button = QToolButton(icon=icon)
28
- self.button.triggered.connect(self.continue_scan)
28
+ self.button.setToolTip("Resume the scan queue")
29
29
  else:
30
30
  self.button = QPushButton()
31
31
  self.button.setText("Resume")
32
32
  self.button.setStyleSheet(
33
33
  "background-color: #2793e8; color: white; font-weight: bold; font-size: 12px;"
34
34
  )
35
- self.button.clicked.connect(self.continue_scan)
35
+ self.button.clicked.connect(self.continue_scan)
36
36
 
37
37
  self.layout.addWidget(self.button)
38
38
 
@@ -49,8 +49,8 @@ class BECWaveform(BECPlotBase):
49
49
  "_config_dict",
50
50
  "plot",
51
51
  "add_dap",
52
- "set_x",
53
52
  "get_dap_params",
53
+ "set_x",
54
54
  "remove_curve",
55
55
  "scan_history",
56
56
  "curves",
@@ -74,8 +74,8 @@ class BECWaveform(BECPlotBase):
74
74
  ]
75
75
  scan_signal_update = pyqtSignal()
76
76
  async_signal_update = pyqtSignal()
77
- dap_params_update = pyqtSignal(dict)
78
- dap_summary_update = pyqtSignal(dict)
77
+ dap_params_update = pyqtSignal(dict, dict)
78
+ dap_summary_update = pyqtSignal(dict, dict)
79
79
  autorange_signal = pyqtSignal()
80
80
  new_scan = pyqtSignal()
81
81
 
@@ -1085,8 +1085,9 @@ class BECWaveform(BECPlotBase):
1085
1085
  curve.setData(x, y)
1086
1086
  curve.dap_params = msg["data"][1]["fit_parameters"]
1087
1087
  curve.dap_summary = msg["data"][1]["fit_summary"]
1088
- self.dap_params_update.emit(curve.dap_params)
1089
- self.dap_summary_update.emit(curve.dap_summary)
1088
+ metadata.update({"curve_id": curve_id_request})
1089
+ self.dap_params_update.emit(curve.dap_params, metadata)
1090
+ self.dap_summary_update.emit(curve.dap_summary, metadata)
1090
1091
  break
1091
1092
 
1092
1093
  @Slot(dict, dict)
File without changes
@@ -0,0 +1 @@
1
+ {'files': ['lmfit_dialog.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
+
6
+ from bec_widgets.utils.bec_designer import designer_material_icon
7
+ from bec_widgets.widgets.lmfit_dialog.lmfit_dialog import LMFitDialog
8
+
9
+ DOM_XML = """
10
+ <ui language='c++'>
11
+ <widget class='LMFitDialog' name='lm_fit_dialog'>
12
+ </widget>
13
+ </ui>
14
+ """
15
+
16
+
17
+ class LMFitDialogPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
18
+ def __init__(self):
19
+ super().__init__()
20
+ self._form_editor = None
21
+
22
+ def createWidget(self, parent):
23
+ t = LMFitDialog(parent)
24
+ return t
25
+
26
+ def domXml(self):
27
+ return DOM_XML
28
+
29
+ def group(self):
30
+ return "BEC Utils"
31
+
32
+ def icon(self):
33
+ return designer_material_icon(LMFitDialog.ICON_NAME)
34
+
35
+ def includeFile(self):
36
+ return "lm_fit_dialog"
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 "LMFitDialog"
49
+
50
+ def toolTip(self):
51
+ return "LMFitDialog"
52
+
53
+ def whatsThis(self):
54
+ return self.toolTip()