-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Decoupled display and FireflyApplication for more displays.
- Loading branch information
1 parent
d877d48
commit 01d306f
Showing
11 changed files
with
138 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -395,6 +395,7 @@ def update_queue_controls(self, new_status): | |
super().update_queue_controls(new_status) | ||
self.ui.navbar.setVisible(bool(new_status['in_use'])) | ||
|
||
|
||
# ----------------------------------------------------------------------------- | ||
# :author: Mark Wolfman | ||
# :email: [email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -162,6 +162,92 @@ def test_open_area_detector_viewer_actions(ffapp, qtbot, sim_camera): | |
list(ffapp.area_detector_actions.values())[0].trigger() | ||
assert "FireflyMainWindow_area_detector_s255id-gige-A" in ffapp.windows.keys() | ||
|
||
|
||
############ | ||
# From old src/firefly/tests/test_motor_menu.py | ||
|
||
|
||
@pytest.fixture | ||
def fake_motors(sim_registry): | ||
motor_names = ["motorA", "motorB", "motorC"] | ||
motors = [] | ||
for name in motor_names: | ||
this_motor = make_fake_device(motor.HavenMotor)( | ||
name=name, labels={"extra_motors"} | ||
) | ||
motors.append(this_motor) | ||
return motors | ||
|
||
|
||
def test_open_motor_window(fake_motors, qapp, qtbot): | ||
# Simulate clicking on the menu action (they're in alpha order) | ||
action = ffapp.motor_actions["motorC"] | ||
action.trigger() | ||
# See if the window was created | ||
motor_3_name = "FireflyMainWindow_motor_motorC" | ||
assert motor_3_name in ffapp.windows.keys() | ||
macros = ffapp.windows[motor_3_name].display_widget().macros() | ||
assert macros["MOTOR"] == "motorC" | ||
|
||
|
||
def test_motor_menu(fake_motors, qapp, qtbot): | ||
# Create the window | ||
window = FireflyMainWindow() | ||
qtbot.addWidget(window) | ||
# Check that the menu items have been created | ||
assert hasattr(window.ui, "positioners_menu") | ||
assert len(ffapp.motor_actions) == 3 | ||
window.destroy() | ||
|
||
|
||
########################################## | ||
# From src/firefly/tests/test_queue_client.py | ||
|
||
|
||
def test_queue_stopped(client): | ||
"""Does the action respond to changes in the queue stopped pending?""" | ||
assert not ffapp.queue_stop_action.isChecked() | ||
client.queue_stop_changed.emit(True) | ||
assert ffapp.queue_stop_action.isChecked() | ||
client.queue_stop_changed.emit(False) | ||
assert not ffapp.queue_stop_action.isChecked() | ||
|
||
|
||
def test_autostart_changed(client, qtbot): | ||
"""Does the action respond to changes in the queue autostart | ||
status? | ||
""" | ||
ffapp.queue_autostart_action.setChecked(True) | ||
assert ffapp.queue_autostart_action.isChecked() | ||
with qtbot.waitSignal(client.autostart_changed, timeout=3): | ||
client.autostart_changed.emit(False) | ||
assert not ffapp.queue_autostart_action.isChecked() | ||
with qtbot.waitSignal(client.autostart_changed, timeout=3): | ||
client.autostart_changed.emit(True) | ||
assert ffapp.queue_autostart_action.isChecked() | ||
|
||
|
||
|
||
############################################################### | ||
# From: src/firefly/tests/test_xrf_detector_display.py | ||
|
||
def test_open_xrf_detector_viewer_actions(ffapp, qtbot, det_fixture, request): | ||
sim_det = request.getfixturevalue(det_fixture) | ||
# Get the area detector parts ready | ||
ffapp._prepare_device_windows( | ||
device_label="xrf_detectors", | ||
attr_name="xrf_detector", | ||
ui_file="xrf_detector.py", | ||
device_key="DEV", | ||
) | ||
assert hasattr(ffapp, "xrf_detector_actions") | ||
assert len(ffapp.xrf_detector_actions) == 1 | ||
# Launch an action and see that a window opens | ||
list(ffapp.xrf_detector_actions.values())[0].trigger() | ||
assert "FireflyMainWindow_xrf_detector_vortex_me4" in ffapp.windows.keys() | ||
|
||
|
||
# ----------------------------------------------------------------------------- | ||
# :author: Mark Wolfman | ||
# :email: [email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ def cameras_display(qtbot, sim_camera): | |
|
||
@pytest.fixture() | ||
def camera_display(qtbot, sim_camera): | ||
display = CamerasDisplay() | ||
display = CameraDisplay() | ||
qtbot.addWidget(display) | ||
return display | ||
|
||
|
@@ -36,57 +36,6 @@ def test_embedded_displays(cameras_display, sim_camera): | |
assert json.loads(display._camera_displays[0].macros) == expected_macros | ||
|
||
|
||
def test_camera_channel_status(camera_display): | ||
"""Test that the camera status indicator responds to camera connection | ||
status PV. | ||
""" | ||
display = camera_display | ||
# Check that the pydm connections have been made to EPICS | ||
assert isinstance(display.detector_state, PyDMChannel) | ||
assert display.detector_state.address == "camera_ioc:cam1:DetectorState_RBV" | ||
|
||
|
||
def test_set_status_byte(camera_display): | ||
display = camera_display | ||
display.show() | ||
# All devices are disconnected | ||
byte = display.camera_status_indicator | ||
bit = byte._indicators[0] | ||
label = display.camera_status_label | ||
# Set the color to something else, then check that it gets set back to white | ||
bit.setColor(QtGui.QColor(255, 0, 0)) | ||
# Simulated the IOC being disconnected | ||
display.update_camera_connection(False) | ||
assert bit._brush.color().getRgb() == (255, 255, 255, 255) | ||
assert not label.isVisible(), "State label should be hidden by default" | ||
# Make the signals connected and see that it's green | ||
display.update_camera_connection(True) | ||
display.update_camera_state(DetectorStates.IDLE) | ||
assert bit._brush.color().getRgb() == (0, 255, 0, 255) | ||
assert not label.isVisible(), "State label should be hidden by default" | ||
# Make the camera be disconnected and see if it's red | ||
display.update_camera_state(DetectorStates.DISCONNECTED) | ||
assert bit._brush.color().getRgb() == (255, 0, 0, 255) | ||
assert label.isVisible(), "State label should be visible when disconnected" | ||
# Make the camera be acquiring and see if it's yellow | ||
display.update_camera_state(DetectorStates.ACQUIRE) | ||
assert bit._brush.color().getRgb() == (255, 255, 0, 255) | ||
assert not label.isVisible(), "State label should be hidden by default" | ||
|
||
|
||
@pytest.mark.xfail | ||
def test_camera_viewer_button(qtbot, ffapp, ioc_area_detector, mocker): | ||
action = QtWidgets.QAction(ffapp) | ||
ffapp.camera_actions.append(action) | ||
display = CameraDisplay(macros=macros) | ||
display.show() | ||
# Click the button | ||
btn = display.ui.camera_viewer_button | ||
with qtbot.waitSignal(action.triggered): | ||
qtbot.mouseClick(btn, QtCore.Qt.LeftButton) | ||
|
||
|
||
# ----------------------------------------------------------------------------- | ||
# :author: Mark Wolfman | ||
# :email: [email protected] | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.