Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated PandABlocks to interface with PVI 0.10.0 #132

Merged
merged 22 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies = [
"h5py",
"softioc>=4.4.0",
"pandablocks~=0.10.0",
"pvi~=0.7.0",
"pvi~=0.10.0",
"typing-extensions;python_version<'3.8'",
] # Add project dependencies here, e.g. ["click", "numpy"]
dynamic = ["version"]
Expand Down
52 changes: 27 additions & 25 deletions src/pandablocks_ioc/_pvi.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,24 @@ def add_data_capture_pvi_info(
):
component = SignalRW(
name=epics_to_pvi_name(data_capture_record_name),
pv=data_capture_record_name,
widget=ButtonPanel(actions={"Start": "1", "Stop": "0"}),
read_pv=data_capture_record_name,
DiamondRC marked this conversation as resolved.
Show resolved Hide resolved
write_pv=f"{Pvi.record_prefix}:{data_capture_record_name}",
write_widget=ButtonPanel(actions={"Start": "1", "Stop": "0"}),
read_widget=LED(),
)
add_pvi_info_to_record(data_capture_pvi_record, data_capture_record_name, "rw")
Pvi.add_pvi_info(
record_name=data_capture_record_name, group=group, component=component
)


#arm_epics_name: EpicsName,
DiamondRC marked this conversation as resolved.
Show resolved Hide resolved
def add_pcap_arm_pvi_info(group: PviGroup, pcap_arm_pvi_record: RecordWrapper):
pcap_arm_record_name = EpicsName("PCAP:ARM")
component = SignalRW(
name=epics_to_pvi_name(pcap_arm_record_name),
pv=pcap_arm_record_name,
widget=ButtonPanel(actions={"Arm": "1", "Disarm": "0"}),
read_pv=pcap_arm_record_name,
DiamondRC marked this conversation as resolved.
Show resolved Hide resolved
write_pv=f"{Pvi.record_prefix}:{pcap_arm_record_name}",
write_widget=ButtonPanel(actions={"Arm": "1", "Disarm": "0"}),
read_widget=LED(),
)
add_pvi_info_to_record(pcap_arm_pvi_record, pcap_arm_record_name, "rw")
Expand All @@ -122,14 +124,14 @@ def add_automatic_pvi_info(
if record_name == "PCAP:ARM":
component = SignalRW(
name=pvi_name,
pv=record_name,
widget=ButtonPanel(actions={"Arm": "1", "Disarm": "0"}),
write_pv=f"{Pvi.record_prefix}:{record_name}",
write_widget=ButtonPanel(actions={"Arm": "1", "Disarm": "0"}),
read_widget=LED(),
)
access = "rw"

else:
component = SignalX(name=pvi_name, pv=record_name, value="")
component = SignalX(name=pvi_name, write_pv=record_name, value="")
DiamondRC marked this conversation as resolved.
Show resolved Hide resolved
access = "x"
elif writeable:
if useComboBox:
Expand All @@ -142,8 +144,7 @@ def add_automatic_pvi_info(
widget = TextWrite(format=TextFormat.string)
else:
widget = TextWrite(format=None)

component = SignalRW(name=pvi_name, pv=record_name, widget=widget)
component = SignalRW(name=pvi_name, write_pv=f"{Pvi.record_prefix}:{record_name}", write_widget=widget)
access = "rw"
else:
if record_creation_func in (
Expand All @@ -154,7 +155,7 @@ def add_automatic_pvi_info(
else:
widget = TextRead(format=None)

component = SignalR(name=pvi_name, pv=record_name, widget=widget)
component = SignalR(name=pvi_name, read_pv=f"{Pvi.record_prefix}:{record_name}", read_widget=widget)
access = "r"

add_pvi_info_to_record(record, record_name, access)
Expand Down Expand Up @@ -185,38 +186,38 @@ def add_positions_table_row(
SignalR(
name=epics_to_pvi_name(value_record_name),
label=value_record_name,
pv=value_record_name,
widget=TextRead(),
read_pv=f"{Pvi.record_prefix}:{value_record_name}",
read_widget=TextRead(),
),
SignalRW(
name=epics_to_pvi_name(units_record_name),
label=units_record_name,
pv=units_record_name,
widget=TextWrite(),
write_pv=f"{Pvi.record_prefix}:{value_record_name}",
write_widget=TextWrite(),
),
SignalRW(
name=epics_to_pvi_name(scale_record_name),
label=scale_record_name,
pv=scale_record_name,
widget=TextWrite(),
write_pv=f"{Pvi.record_prefix}:{scale_record_name}",
write_widget=TextWrite(),
),
SignalRW(
name=epics_to_pvi_name(offset_record_name),
label=offset_record_name,
pv=offset_record_name,
widget=TextWrite(),
write_pv=f"{Pvi.record_prefix}:{offset_record_name}",
write_widget=TextWrite(),
),
SignalRW(
name=epics_to_pvi_name(dataset_record_name),
label=dataset_record_name,
pv=dataset_record_name,
widget=TextWrite(),
write_pv=f"{Pvi.record_prefix}:{dataset_record_name}",
write_widget=TextWrite(),
),
SignalRW(
name=epics_to_pvi_name(capture_record_name),
label=capture_record_name,
pv=capture_record_name,
widget=ComboBox(),
write_pv=f"{Pvi.record_prefix}:{capture_record_name}",
write_widget=ComboBox(),
),
]

Expand All @@ -239,6 +240,7 @@ class Pvi:

_screens_dir: Optional[Path] = None
_clear_bobfiles: bool = False
record_prefix: Optional[str] = None

# We may want general device refs, e.g every CAPTURE group having a reference
# to the positions table
Expand All @@ -260,7 +262,7 @@ def configure_pvi(screens_dir: Optional[str], clear_bobfiles: bool):

Pvi._clear_bobfiles = clear_bobfiles

@staticmethod
DiamondRC marked this conversation as resolved.
Show resolved Hide resolved
def add_pvi_info(record_name: EpicsName, group: PviGroup, component: Component):
"""Add PVI Info to the global collection"""

Expand Down Expand Up @@ -375,4 +377,4 @@ def create_pvi_records(record_prefix: str):

Pvi.add_general_device_refs_to_groups(device)

formatter.format(device, record_prefix + ":", bobfile_path)
formatter.format(device, bobfile_path)
DiamondRC marked this conversation as resolved.
Show resolved Hide resolved
8 changes: 6 additions & 2 deletions src/pandablocks_ioc/_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,11 @@ def __init__(
Pvi.add_pvi_info(
table_name,
pvi_group,
SignalRW(name=pvi_table_name, pv=table_name, widget=TableWrite(widgets=[])),
SignalRW(
name=pvi_table_name,
write_pv=f"{Pvi.record_prefix}:{table_name}",
write_widget=TableWrite(widgets=[]),
),
)

# Note that the table_updater's table_fields are guaranteed sorted in bit order,
Expand Down Expand Up @@ -308,7 +312,7 @@ def __init__(
Pvi.add_pvi_info(
mode_record_name,
pvi_group,
SignalRW(name=pvi_name, pv=mode_record_name, widget=ComboBox()),
SignalRW(name=pvi_name, write_pv=f"{Pvi.record_prefix}:{mode_record_name}", write_widget=ComboBox()),
)

self.mode_record_info = RecordInfo(lambda x: x, labels, False)
Expand Down
2 changes: 2 additions & 0 deletions src/pandablocks_ioc/ioc.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ def __init__(

# Set the record prefix
builder.SetDeviceName(self._record_prefix)
Pvi.record_prefix = self._record_prefix

# All records should be blocking
builder.SetBlocking(True)
Expand Down Expand Up @@ -1770,6 +1771,7 @@ async def _arm_on_update(self, new_val: int) -> None:

def create_block_records(
self,
#prefix: EpicsName,
DiamondRC marked this conversation as resolved.
Show resolved Hide resolved
block: str,
block_info: BlockInfo,
block_values: Dict[EpicsName, str],
Expand Down
27 changes: 20 additions & 7 deletions tests/test-bobfiles/DATA.bob
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<display version="2.0.0">
<name>Display</name>
<name>DATA</name>
<x>0</x>
<y>0</y>
<y use_class="true">0</y>
<width>506</width>
<height>463</height>
<grid_step_x>4</grid_step_x>
<grid_step_y>4</grid_step_y>
<widget type="label" version="2.0.0">
<name>Title</name>
<class>TITLE</class>
<text>DATA - TEST_PREFIX:</text>
<text>DATA</text>
<x use_class="true">0</x>
<y use_class="true">0</y>
<width>506</width>
Expand Down Expand Up @@ -39,6 +39,7 @@
<y>0</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="textentry" version="3.0.0">
<name>TextEntry</name>
Expand All @@ -57,6 +58,7 @@
<y>25</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="textentry" version="3.0.0">
<name>TextEntry</name>
Expand All @@ -74,6 +76,7 @@
<y>50</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="textupdate" version="2.0.0">
<name>TextUpdate</name>
Expand All @@ -95,6 +98,7 @@
<y>75</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="textentry" version="3.0.0">
<name>TextEntry</name>
Expand All @@ -113,6 +117,7 @@
<y>100</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="textupdate" version="2.0.0">
<name>TextUpdate</name>
Expand Down Expand Up @@ -143,6 +148,7 @@
<y>0</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="textentry" version="3.0.0">
<name>TextEntry</name>
Expand All @@ -160,6 +166,7 @@
<y>25</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="textupdate" version="2.0.0">
<name>TextUpdate</name>
Expand All @@ -181,6 +188,7 @@
<y>50</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="textupdate" version="2.0.0">
<name>TextUpdate</name>
Expand All @@ -202,6 +210,7 @@
<y>75</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="textentry" version="3.0.0">
<name>TextEntry</name>
Expand All @@ -219,6 +228,7 @@
<y>100</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="action_button" version="3.0.0">
<name>WritePV</name>
Expand All @@ -235,7 +245,7 @@
<y>100</y>
<width>65</width>
<height>20</height>
<tooltip>$(actions)</tooltip>
<tooltip>TEST_PREFIX:DATA:CAPTURE = 1</tooltip>
</widget>
<widget type="action_button" version="3.0.0">
<name>WritePV</name>
Expand All @@ -252,11 +262,11 @@
<y>100</y>
<width>65</width>
<height>20</height>
<tooltip>$(actions)</tooltip>
<tooltip>TEST_PREFIX:DATA:CAPTURE = 0</tooltip>
</widget>
<widget type="led" version="2.0.0">
<name>LED</name>
<pv_name>TEST_PREFIX:DATA:CAPTURE</pv_name>
<pv_name>DATA:CAPTURE</pv_name>
<x>417</x>
<y>100</y>
<width>20</width>
Expand All @@ -269,6 +279,7 @@
<y>125</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="combo" version="2.0.0">
<name>ComboBox</name>
Expand All @@ -285,6 +296,7 @@
<y>150</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="action_button" version="3.0.0">
<name>OpenDisplay</name>
Expand All @@ -295,7 +307,7 @@
<description>Open Display</description>
</action>
</actions>
<text>All Postion Capture Parameters</text>
<text>SubScreen</text>
<x>255</x>
<y>150</y>
<width>205</width>
Expand All @@ -317,6 +329,7 @@
<y>0</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="textupdate" version="2.0.0">
<name>TextUpdate</name>
Expand Down
Loading
Loading