Skip to content

Commit

Permalink
Merge pull request #150 from spc-group/mirrors
Browse files Browse the repository at this point in the history
Mirror support at S25
  • Loading branch information
canismarko authored Dec 8, 2023
2 parents 2a274d7 + f6c36af commit 40d36b6
Show file tree
Hide file tree
Showing 47 changed files with 36,807 additions and 5,353 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ gui = ["pyqt>=5.12", "tiled-client", "qtawesome", "pydm", "pyqtgraph"]
"Homepage" = "https://haven-spc.readthedocs.io/en/latest/"
"Bug Tracker" = "https://github.com/spc-group/haven/issues"

[project.entry-points."pydm.data_plugin"]
HavenPlugin = "firefly.pydm_plugin:HavenPlugin"

[project.scripts]
haven_config = "haven._iconfig:print_config_value"

Expand Down
2 changes: 1 addition & 1 deletion src/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def shutters(sim_registry):

@pytest.fixture(scope="session")
def pydm_ophyd_plugin():
return pydm.data_plugins.plugin_for_address("sig://")
return pydm.data_plugins.plugin_for_address("haven://")


qs_status = {
Expand Down
22 changes: 18 additions & 4 deletions src/firefly/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

from haven import HavenMotor, load_config, registry
from haven.exceptions import ComponentNotFound
from haven.instrument.device import titelize

from . import beamline_components_rc
from .main_window import FireflyMainWindow, PlanMainWindow
Expand Down Expand Up @@ -178,6 +179,18 @@ def setup_window_actions(self):
ui_file="slits.py",
device_key="DEVICE",
)
self._prepare_device_windows(
device_label="kb_mirrors",
attr_name="kb_mirrors",
ui_file="kb_mirrors.py",
device_key="DEVICE",
)
self._prepare_device_windows(
device_label="mirrors",
attr_name="mirror",
ui_file="mirror.py",
device_key="DEVICE",
)
self._prepare_device_windows(
device_label="xrf_detectors",
attr_name="xrf_detector",
Expand Down Expand Up @@ -335,8 +348,6 @@ def _prepare_device_windows(
*window_slot* is used.
"""
# if device_label == "motors":
# breakpoint()
# We need a UI file, unless a custom window_slot is given
if ui_file is None and window_slot is None:
raise ValueError(
Expand All @@ -358,7 +369,8 @@ def _prepare_device_windows(
# Create the window action
action = QtWidgets.QAction(self)
action.setObjectName(f"action_show_{attr_name}_{device.name}")
action.setText(device.name)
display_text = titelize(device.name)
action.setText(display_text)
actions[device.name] = action
# Create a slot for opening the device window
if window_slot is not None:
Expand Down Expand Up @@ -545,11 +557,13 @@ def show_device_window(
"""
device_pyname = device.name.replace(" ", "_")
device_title = titelize(device.name)
self.show_window(
FireflyMainWindow,
ui_dir / ui_file,
name=f"FireflyMainWindow_{device_label}_{device_pyname}",
macros={device_key: device.name},
macros={device_key: device.name,
f"{device_key}_TITLE": device_title},
)

def show_status_window(self, stylesheet_path=None):
Expand Down
12 changes: 6 additions & 6 deletions src/firefly/area_detector_overlay.ui
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<string/>
</property>
<property name="channel" stdset="0">
<string>sig://${AD}.overlays.overlay_${OV}.use</string>
<string>haven://${AD}.overlays.overlay_${OV}.use</string>
</property>
</widget>
</item>
Expand All @@ -61,7 +61,7 @@
<string/>
</property>
<property name="channel" stdset="0">
<string>sig://${AD}.overlays.overlay_${OV}.shape</string>
<string>haven://${AD}.overlays.overlay_${OV}.shape</string>
</property>
</widget>
</item>
Expand All @@ -75,7 +75,7 @@
<string/>
</property>
<property name="channel" stdset="0">
<string>sig://${AD}.overlays.overlay_${OV}.position_y</string>
<string>haven://${AD}.overlays.overlay_${OV}.position_y</string>
</property>
<property name="orientation" stdset="0">
<enum>Qt::Vertical</enum>
Expand All @@ -100,7 +100,7 @@
<string/>
</property>
<property name="channel" stdset="0">
<string>sig://${AD}.overlays.overlay_${OV}.position_x</string>
<string>haven://${AD}.overlays.overlay_${OV}.position_x</string>
</property>
<property name="step_size" stdset="0">
<number>0</number>
Expand Down Expand Up @@ -132,7 +132,7 @@
<string/>
</property>
<property name="channel" stdset="0">
<string>sig://${AD}.overlays.overlay_${OV}.size_y</string>
<string>haven://${AD}.overlays.overlay_${OV}.size_y</string>
</property>
<property name="orientation" stdset="0">
<enum>Qt::Vertical</enum>
Expand All @@ -157,7 +157,7 @@
<string/>
</property>
<property name="channel" stdset="0">
<string>sig://${AD}.overlays.overlay_${OV}.size_x</string>
<string>haven://${AD}.overlays.overlay_${OV}.size_x</string>
</property>
</widget>
</item>
Expand Down
16 changes: 8 additions & 8 deletions src/firefly/area_detector_roi.ui
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<string>NaN</string>
</property>
<property name="channel" stdset="0">
<string>sig://${AD}.stats${R}.mean_value</string>
<string>haven://${AD}.stats${R}.mean_value</string>
</property>
</widget>
</item>
Expand All @@ -77,7 +77,7 @@
<string>NaN</string>
</property>
<property name="channel" stdset="0">
<string>sig://${AD}.stats${R}.min_value</string>
<string>haven://${AD}.stats${R}.min_value</string>
</property>
</widget>
</item>
Expand All @@ -104,7 +104,7 @@
<string>NaN</string>
</property>
<property name="channel" stdset="0">
<string>sig://${AD}.stats${R}.max_value</string>
<string>haven://${AD}.stats${R}.max_value</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -132,7 +132,7 @@
<string>Show</string>
</property>
<property name="channel" stdset="0">
<string>sig://${AD}.overlays.overlay_${R}.use</string>
<string>haven://${AD}.overlays.overlay_${R}.use</string>
</property>
</widget>
</item>
Expand All @@ -144,7 +144,7 @@
<string/>
</property>
<property name="channel" stdset="0">
<string>sig://${AD}.roi${R}.min_xyz.min_y</string>
<string>haven://${AD}.roi${R}.min_xyz.min_y</string>
</property>
<property name="orientation" stdset="0">
<enum>Qt::Vertical</enum>
Expand All @@ -169,7 +169,7 @@
<string/>
</property>
<property name="channel" stdset="0">
<string>sig://${AD}.roi${R}.min_xyz.min_x</string>
<string>haven://${AD}.roi${R}.min_xyz.min_x</string>
</property>
<property name="step_size" stdset="0">
<number>0</number>
Expand Down Expand Up @@ -201,7 +201,7 @@
<string/>
</property>
<property name="channel" stdset="0">
<string>sig://${AD}.roi${R}.size.y</string>
<string>haven://${AD}.roi${R}.size.y</string>
</property>
<property name="orientation" stdset="0">
<enum>Qt::Vertical</enum>
Expand All @@ -226,7 +226,7 @@
<string/>
</property>
<property name="channel" stdset="0">
<string>sig://${AD}.roi${R}.size.x</string>
<string>haven://${AD}.roi${R}.size.x</string>
</property>
</widget>
</item>
Expand Down
16 changes: 8 additions & 8 deletions src/firefly/area_detector_viewer.ui
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="channel" stdset="0">
<string>sig://${AD}.cam.array_size.array_size_y</string>
<string>haven://${AD}.cam.array_size.array_size_y</string>
</property>
</widget>
</item>
Expand All @@ -153,7 +153,7 @@
<string>1224</string>
</property>
<property name="channel" stdset="0">
<string>sig://${AD}.cam.array_size.array_size_x</string>
<string>haven://${AD}.cam.array_size.array_size_x</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -206,7 +206,7 @@
<string>[]</string>
</property>
<property name="channel" stdset="0">
<string>sig://${AD}.cam.gain</string>
<string>haven://${AD}.cam.gain</string>
</property>
<property name="tickPosition" stdset="0">
<enum>QSlider::TicksBelow</enum>
Expand Down Expand Up @@ -234,7 +234,7 @@
<string>Auto</string>
</property>
<property name="channel" stdset="0">
<string>sig://${AD}.cam.gain_auto</string>
<string>haven://${AD}.cam.gain_auto</string>
</property>
<property name="pressValue" stdset="0">
<string>1</string>
Expand All @@ -257,7 +257,7 @@
<string>[]</string>
</property>
<property name="channel" stdset="0">
<string>sig://${AD}.cam.acquire_time</string>
<string>haven://${AD}.cam.acquire_time</string>
</property>
<property name="tickPosition" stdset="0">
<enum>QSlider::TicksBelow</enum>
Expand All @@ -282,7 +282,7 @@
<string>Auto</string>
</property>
<property name="channel" stdset="0">
<string>sig://${AD}.cam.acquire_time_auto</string>
<string>haven://${AD}.cam.acquire_time_auto</string>
</property>
<property name="pressValue" stdset="0">
<string>1</string>
Expand Down Expand Up @@ -313,7 +313,7 @@
<bool>false</bool>
</property>
<property name="channel" stdset="0">
<string>sig://${AD}.cam.acquire</string>
<string>haven://${AD}.cam.acquire</string>
</property>
<property name="passwordProtected" stdset="0">
<bool>false</bool>
Expand Down Expand Up @@ -356,7 +356,7 @@
<string>[{&quot;name&quot;: &quot;enable_acquire_buttons&quot;, &quot;property&quot;: &quot;Enable&quot;, &quot;initial_value&quot;: &quot;&quot;, &quot;expression&quot;: &quot;ch[0] == 1&quot;, &quot;channels&quot;: [{&quot;channel&quot;: &quot;${PREFIX}cam1:Acquire&quot;, &quot;trigger&quot;: true, &quot;use_enum&quot;: false}]}]</string>
</property>
<property name="channel" stdset="0">
<string>sig://${AD}.cam.acquire</string>
<string>haven://${AD}.cam.acquire</string>
</property>
<property name="pressValue" stdset="0">
<string>0</string>
Expand Down
Loading

0 comments on commit 40d36b6

Please sign in to comment.