diff --git a/bec_widgets/widgets/plots/scatter_waveform/scatter_curve.py b/bec_widgets/widgets/plots/scatter_waveform/scatter_curve.py index c27d3546..4ad325ae 100644 --- a/bec_widgets/widgets/plots/scatter_waveform/scatter_curve.py +++ b/bec_widgets/widgets/plots/scatter_waveform/scatter_curve.py @@ -79,7 +79,7 @@ class ScatterCurve(BECConnector, pg.PlotDataItem): name = config.label self.parent_item = parent_item self.parent_id = self.parent_item.gui_id - object_name = name.replace("-", "_") if name else None + object_name = name.replace("-", "_").replace(" ", "_") if name else None super().__init__(name=name, object_name=object_name, config=config, gui_id=gui_id, **kwargs) self.data_z = None # color scaling needs to be cashed for changing colormap diff --git a/tests/end-2-end/test_plotting_framework_e2e.py b/tests/end-2-end/test_plotting_framework_e2e.py index 0efe7a73..dc532b73 100644 --- a/tests/end-2-end/test_plotting_framework_e2e.py +++ b/tests/end-2-end/test_plotting_framework_e2e.py @@ -35,10 +35,22 @@ def test_rpc_plotting_shortcuts_init_configs(qtbot, connected_client_gui_obj): mw = dock.new("mw_dock").new("MultiWaveform") c1 = wf.plot(x_name="samx", y_name="bpm4i") + # Adding custom curves, removing one and adding it again should not crash + c2 = wf.plot(y=[1, 2, 3], x=[1, 2, 3]) + assert c2.object_name == "Curve_0" + c2.remove() + c3 = wf.plot(y=[1, 2, 3], x=[1, 2, 3]) + assert c3.object_name == "Curve_0" + im_item = im.image(monitor="eiger") mm.map(x_name="samx", y_name="samy") sw.plot(x_name="samx", y_name="samy", z_name="bpm4i") + assert sw.main_curve.object_name == "bpm4i_bpm4i" + # Create a new curve on the scatter waveform should replace the old one + sw.plot(x_name="samx", y_name="samy", z_name="bpm4a") + assert sw.main_curve.object_name == "bpm4a_bpm4a" mw.plot(monitor="waveform") + # Adding multiple custom curves sho # Checking if classes are correctly initialised assert len(dock.panel_list) == 5