diff --git a/src/firefly/application.py b/src/firefly/application.py index 56d106bf..a8846cac 100644 --- a/src/firefly/application.py +++ b/src/firefly/application.py @@ -265,10 +265,7 @@ def _prepare_device_windows(self, device_label: str, attr_name: str): window_slots = [] setattr(self, f"{attr_name}_window_slots", window_slots) setattr(self, f"{attr_name}_windows", {}) - # if attr_name == "ion_chamber": - # breakpoint() for device in devices: - # Check that we don't already have actions set # Create the window action action = QtWidgets.QAction(self) action.setObjectName(f"actionShow_{attr_name}_{device.name}") diff --git a/src/firefly/tests/test_xrf_detector_display.py b/src/firefly/tests/test_xrf_detector_display.py index e256d355..5b2afba8 100644 --- a/src/firefly/tests/test_xrf_detector_display.py +++ b/src/firefly/tests/test_xrf_detector_display.py @@ -10,6 +10,9 @@ from firefly.xrf_roi import XRFROIDisplay +detectors = ['xspress',] + + @pytest.fixture() def xrf_display(ffapp, request): """Parameterized fixture for creating a display based on a specific @@ -21,18 +24,18 @@ def xrf_display(ffapp, request): # Create the display display = XRFDetectorDisplay(macros={"DEV": det.name}) # Set sensible starting values - spectra = np.random.default_rng(seed=0).integers( - 0, 65536, dtype=np.int_, size=(4, 1024) - ) - plot_widget = display.mca_plot_widget - plot_widget.update_spectrum(0, spectra[0]) - plot_widget.update_spectrum(1, spectra[1]) - plot_widget.update_spectrum(2, spectra[2]) - plot_widget.update_spectrum(3, spectra[3]) - return display - - -@pytest.mark.parametrize("det_fixture", ["dxp", "xspress"]) + # spectra = np.random.default_rng(seed=0).integers( + # 0, 65536, dtype=np.int_, size=(4, 1024) + # ) + # plot_widget = display.mca_plot_widget + # plot_widget.update_spectrum(0, spectra[0]) + # plot_widget.update_spectrum(1, spectra[1]) + # plot_widget.update_spectrum(2, spectra[2]) + # plot_widget.update_spectrum(3, spectra[3]) + yield display + + +@pytest.mark.parametrize("det_fixture", detectors) def test_open_xrf_detector_viewer_actions(ffapp, qtbot, det_fixture, request): sim_det = request.getfixturevalue(det_fixture) # Get the area detector parts ready @@ -44,7 +47,7 @@ def test_open_xrf_detector_viewer_actions(ffapp, qtbot, det_fixture, request): assert "FireflyMainWindow_xrf_detector_vortex_me4" in ffapp.windows.keys() -@pytest.mark.parametrize("xrf_display", ["dxp", "xspress"], indirect=True) +@pytest.mark.parametrize("xrf_display", detectors, indirect=True) def test_roi_widgets(xrf_display): xrf_display.draw_roi_widgets(2) # Check that the widgets were drawn @@ -52,7 +55,7 @@ def test_roi_widgets(xrf_display): disp = xrf_display.roi_displays[0] -@pytest.mark.parametrize("xrf_display", ["dxp", "xspress"], indirect=True) +@pytest.mark.parametrize("xrf_display", detectors, indirect=True) def test_roi_element_comboboxes(ffapp, qtbot, xrf_display): # Check that the comboboxes have the right number of entries element_cb = xrf_display.ui.mca_combobox @@ -61,7 +64,7 @@ def test_roi_element_comboboxes(ffapp, qtbot, xrf_display): assert roi_cb.count() == xrf_display.device.num_rois -@pytest.mark.parametrize("det_fixture", ["dxp", "xspress"]) +@pytest.mark.parametrize("det_fixture", detectors) def test_roi_selection(ffapp, qtbot, det_fixture, request): det = request.getfixturevalue(det_fixture) display = XRFROIDisplay(macros={"DEV": det.name, "NUM": 2, "MCA": 2, "ROI": 2}) @@ -78,7 +81,7 @@ def test_roi_selection(ffapp, qtbot, det_fixture, request): assert f"background: {display.selected_background}" not in display.styleSheet() -@pytest.mark.parametrize("xrf_display", ["dxp", "xspress"], indirect=True) +@pytest.mark.parametrize("xrf_display", detectors, indirect=True) def test_all_rois_selection(xrf_display): """Are all the other ROIs disabled when one is selected?""" roi_display = xrf_display.roi_displays[0] diff --git a/src/haven/instrument/xspress.py b/src/haven/instrument/xspress.py index 3dea0ca2..dc63e9b4 100644 --- a/src/haven/instrument/xspress.py +++ b/src/haven/instrument/xspress.py @@ -81,30 +81,30 @@ class ChannelSignal(MultiDerivedSignal): """A high/low range limit channel for an ROI.""" - def set( - self, - value: OphydDataType, - *, - timeout: Optional[float] = None, - settle_time: Optional[float] = None, - ) -> StatusBase: - # Check for existing signals and, if necessary, wait them out - signals = [ - self.parent.hi_chan, - self.parent.lo_chan, - self.parent.size, - self.parent._lo_chan, - ] - - def get_threads(): - thds = [sig._set_thread for sig in signals if sig._set_thread] - return [th for th in thds if th is not None] - - while len(threads := get_threads()) > 0: - for th in threads: - th.join() - # Set the signal like normal - return super().set(value, timeout=timeout, settle_time=settle_time) + # def set( + # self, + # value: OphydDataType, + # *, + # timeout: Optional[float] = None, + # settle_time: Optional[float] = None, + # ) -> StatusBase: + # # Check for existing signals and, if necessary, wait them out + # signals = [ + # self.parent.hi_chan, + # self.parent.lo_chan, + # self.parent.size, + # self.parent._lo_chan, + # ] + + # def get_threads(): + # thds = [sig._set_thread for sig in signals if sig._set_thread] + # return [th for th in thds if th is not None] + + # while len(threads := get_threads()) > 0: + # for th in threads: + # th.join() + # # Set the signal like normal + # return super().set(value, timeout=timeout, settle_time=settle_time) class ROI(ROIMixin):