0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-13 19:21:50 +02:00

fix(waveform): legend is correctly updated when changed from curve dialog

This commit is contained in:
2025-03-25 12:47:29 +01:00
parent b91f1fe487
commit c2d2c484cd
4 changed files with 11 additions and 6 deletions

View File

@ -3468,6 +3468,12 @@ class Waveform(RPCBase):
Public method if you want the old `select_roi` style.
"""
@rpc_call
def clear_all(self):
"""
Clear all curves from the plot widget.
"""
class WebsiteWidget(RPCBase):
"""A simple widget to display a website"""

View File

@ -290,8 +290,7 @@ class CurveRow(QTreeWidgetItem):
self.entry_edit.setText(device_entry)
self.config.signal = DeviceSignal(name=device_name, entry=device_entry)
self.config.source = "device"
if not self.config.label:
self.config.label = f"{device_name}-{device_entry}".strip("-")
self.config.label = f"{device_name}-{device_entry}"
else:
# DAP logic
parent_conf_dict = {}
@ -310,7 +309,7 @@ class CurveRow(QTreeWidgetItem):
self.config.signal = DeviceSignal(name=dev_name, entry=dev_entry, dap=new_dap)
self.config.source = "dap"
self.config.parent_label = parent_conf.label
self.config.label = f"{parent_conf.label}-{new_dap}".strip("-")
self.config.label = f"{parent_conf.label}-{new_dap}"
# Common style fields
self.config.color = self.color_button.color()

View File

@ -97,6 +97,7 @@ class Waveform(PlotBase):
"get_all_data",
"get_curve",
"select_roi",
"clear_all",
]
sync_signal_update = Signal()

View File

@ -344,7 +344,6 @@ def test_export_data_dap(curve_tree_fixture):
# Add a device curve with specific parameters
device_row = curve_tree.add_new_curve(name="bpm4i", entry="bpm4i")
device_row.config.label = "bpm4i-main"
# Add a DAP child
device_row.add_dap_row()
@ -358,8 +357,8 @@ def test_export_data_dap(curve_tree_fixture):
# Check the exported data
assert exported["source"] == "dap"
assert exported["parent_label"] == "bpm4i-main"
assert exported["parent_label"] == "bpm4i-bpm4i"
assert exported["signal"]["name"] == "bpm4i"
assert exported["signal"]["entry"] == "bpm4i"
assert exported["signal"]["dap"] == "GaussianModel"
assert exported["label"] == "bpm4i-main-GaussianModel"
assert exported["label"] == "bpm4i-bpm4i-GaussianModel"