-
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.
Merge pull request #203 from spc-group/filters
Support for XIA PFCU filters
- Loading branch information
Showing
22 changed files
with
6,500 additions
and
39 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
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import json | ||
from typing import Sequence | ||
|
||
from pydm.widgets import PyDMEmbeddedDisplay | ||
|
||
from firefly import display | ||
from haven import registry | ||
|
||
|
||
class FiltersDisplay(display.FireflyDisplay): | ||
filters: Sequence | ||
|
||
def ui_filename(self): | ||
return "filters.ui" | ||
|
||
def customize_device(self): | ||
filters = registry.findall(label="filters", allow_none=True) | ||
self.filters = sorted( | ||
filters, key=lambda dev: (dev.material.get(), dev.thickness.get()) | ||
) | ||
|
||
def customize_ui(self): | ||
# Delete existing filter widgets | ||
for idx in reversed(range(self.filters_layout.count())): | ||
self.filters_layout.takeAt(idx).widget().deleteLater() | ||
# Add embedded displays for all the ion chambers | ||
self._filter_displays = [] | ||
for idx, device in enumerate(self.filters): | ||
# Create the display object | ||
disp = PyDMEmbeddedDisplay(parent=self) | ||
disp.macros = json.dumps({"DEV": device.name}) | ||
disp.filename = "filters_row.ui" | ||
# Add the Embedded Display to the Results Layout | ||
self.filters_layout.addWidget(disp) | ||
self._filter_displays.append(disp) |
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 |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>Form</class> | ||
<widget class="QWidget" name="Form"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>598</width> | ||
<height>376</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Form</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout_2"> | ||
<item> | ||
<layout class="QVBoxLayout" name="filters_layout"> | ||
<property name="spacing"> | ||
<number>0</number> | ||
</property> | ||
<item> | ||
<widget class="PyDMEmbeddedDisplay" name="PyDMEmbeddedDisplay_2"> | ||
<property name="toolTip"> | ||
<string/> | ||
</property> | ||
<property name="frameShape"> | ||
<enum>QFrame::NoFrame</enum> | ||
</property> | ||
<property name="filename" stdset="0"> | ||
<string>filters_row.ui</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="PyDMEmbeddedDisplay" name="PyDMEmbeddedDisplay"> | ||
<property name="toolTip"> | ||
<string/> | ||
</property> | ||
<property name="frameShape"> | ||
<enum>QFrame::NoFrame</enum> | ||
</property> | ||
<property name="filename" stdset="0"> | ||
<string>filters_row.ui</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="PyDMEmbeddedDisplay" name="PyDMEmbeddedDisplay_3"> | ||
<property name="toolTip"> | ||
<string/> | ||
</property> | ||
<property name="frameShape"> | ||
<enum>QFrame::NoFrame</enum> | ||
</property> | ||
<property name="filename" stdset="0"> | ||
<string>filters_row.ui</string> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
<item> | ||
<spacer name="verticalSpacer"> | ||
<property name="orientation"> | ||
<enum>Qt::Vertical</enum> | ||
</property> | ||
<property name="sizeHint" stdset="0"> | ||
<size> | ||
<width>20</width> | ||
<height>40</height> | ||
</size> | ||
</property> | ||
</spacer> | ||
</item> | ||
</layout> | ||
</widget> | ||
<customwidgets> | ||
<customwidget> | ||
<class>PyDMEmbeddedDisplay</class> | ||
<extends>QFrame</extends> | ||
<header>pydm.widgets.embedded_display</header> | ||
</customwidget> | ||
</customwidgets> | ||
<resources> | ||
<include location="resources/beamline_components.qrc"/> | ||
</resources> | ||
<connections/> | ||
</ui> |
Oops, something went wrong.