Skip to content

Commit

Permalink
Updated PandABlocks to interface with PVI 0.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Cunningham committed Sep 24, 2024
1 parent 4f9247d commit 58d44a2
Show file tree
Hide file tree
Showing 10 changed files with 117 additions and 80 deletions.
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",
"typing-extensions;python_version<'3.8'",
] # Add project dependencies here, e.g. ["click", "numpy"]
dynamic = ["version"]
Expand Down
47 changes: 25 additions & 22 deletions src/pandablocks_ioc/_pvi.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ 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,
write_pv=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")
Expand All @@ -96,8 +97,9 @@ 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,
write_pv=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,15 @@ def add_automatic_pvi_info(
if record_name == "PCAP:ARM":
component = SignalRW(
name=pvi_name,
pv=record_name,
read_pv=record_name,
# write_pv=record_name,
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="")
access = "x"
elif writeable:
if useComboBox:
Expand All @@ -142,8 +145,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=record_name, write_widget=widget)
access = "rw"
else:
if record_creation_func in (
Expand All @@ -154,7 +156,8 @@ 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=record_name)
# , read_widget=widget
access = "r"

add_pvi_info_to_record(record, record_name, access)
Expand Down Expand Up @@ -185,38 +188,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=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=units_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=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=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=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=capture_record_name,
write_widget=ComboBox(),
),
]

Expand Down Expand Up @@ -375,4 +378,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)
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=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=mode_record_name, write_widget=ComboBox()),
)

self.mode_record_info = RecordInfo(lambda x: x, labels, False)
Expand Down
55 changes: 33 additions & 22 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,10 +39,11 @@
<y>0</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="textentry" version="3.0.0">
<name>TextEntry</name>
<pv_name>TEST_PREFIX:DATA:HDF_DIRECTORY</pv_name>
<pv_name>DATA:HDF_DIRECTORY</pv_name>
<x>255</x>
<y>0</y>
<width>205</width>
Expand All @@ -57,10 +58,11 @@
<y>25</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="textentry" version="3.0.0">
<name>TextEntry</name>
<pv_name>TEST_PREFIX:DATA:CREATE_DIRECTORY</pv_name>
<pv_name>DATA:CREATE_DIRECTORY</pv_name>
<x>255</x>
<y>25</y>
<width>205</width>
Expand All @@ -74,10 +76,11 @@
<y>50</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="textupdate" version="2.0.0">
<name>TextUpdate</name>
<pv_name>TEST_PREFIX:DATA:DIRECTORY_EXISTS</pv_name>
<pv_name>DATA:DIRECTORY_EXISTS</pv_name>
<x>255</x>
<y>50</y>
<width>205</width>
Expand All @@ -95,10 +98,11 @@
<y>75</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="textentry" version="3.0.0">
<name>TextEntry</name>
<pv_name>TEST_PREFIX:DATA:HDF_FILE_NAME</pv_name>
<pv_name>DATA:HDF_FILE_NAME</pv_name>
<x>255</x>
<y>75</y>
<width>205</width>
Expand All @@ -113,10 +117,11 @@
<y>100</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="textupdate" version="2.0.0">
<name>TextUpdate</name>
<pv_name>TEST_PREFIX:DATA:HDF_FULL_FILE_PATH</pv_name>
<pv_name>DATA:HDF_FULL_FILE_PATH</pv_name>
<x>255</x>
<y>100</y>
<width>205</width>
Expand All @@ -126,7 +131,6 @@
</font>
</font>
<horizontal_alignment>1</horizontal_alignment>
<format>6</format>
</widget>
</widget>
<widget type="group" version="2.0.0">
Expand All @@ -143,10 +147,11 @@
<y>0</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="textentry" version="3.0.0">
<name>TextEntry</name>
<pv_name>TEST_PREFIX:DATA:NUM_CAPTURE</pv_name>
<pv_name>DATA:NUM_CAPTURE</pv_name>
<x>255</x>
<y>0</y>
<width>205</width>
Expand All @@ -160,10 +165,11 @@
<y>25</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="textupdate" version="2.0.0">
<name>TextUpdate</name>
<pv_name>TEST_PREFIX:DATA:NUM_CAPTURED</pv_name>
<pv_name>DATA:NUM_CAPTURED</pv_name>
<x>255</x>
<y>25</y>
<width>205</width>
Expand All @@ -181,10 +187,11 @@
<y>50</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="textupdate" version="2.0.0">
<name>TextUpdate</name>
<pv_name>TEST_PREFIX:DATA:NUM_RECEIVED</pv_name>
<pv_name>DATA:NUM_RECEIVED</pv_name>
<x>255</x>
<y>50</y>
<width>205</width>
Expand All @@ -202,10 +209,11 @@
<y>75</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="textentry" version="3.0.0">
<name>TextEntry</name>
<pv_name>TEST_PREFIX:DATA:FLUSH_PERIOD</pv_name>
<pv_name>DATA:FLUSH_PERIOD</pv_name>
<x>255</x>
<y>75</y>
<width>205</width>
Expand All @@ -219,10 +227,11 @@
<y>100</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="action_button" version="3.0.0">
<name>WritePV</name>
<pv_name>TEST_PREFIX:DATA:CAPTURE</pv_name>
<pv_name>DATA:CAPTURE</pv_name>
<actions>
<action type="write_pv">
<pv_name>$(pv_name)</pv_name>
Expand All @@ -235,11 +244,11 @@
<y>100</y>
<width>65</width>
<height>20</height>
<tooltip>$(actions)</tooltip>
<tooltip>DATA:CAPTURE = 1</tooltip>
</widget>
<widget type="action_button" version="3.0.0">
<name>WritePV</name>
<pv_name>TEST_PREFIX:DATA:CAPTURE</pv_name>
<pv_name>DATA:CAPTURE</pv_name>
<actions>
<action type="write_pv">
<pv_name>$(pv_name)</pv_name>
Expand All @@ -252,11 +261,11 @@
<y>100</y>
<width>65</width>
<height>20</height>
<tooltip>$(actions)</tooltip>
<tooltip>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,10 +278,11 @@
<y>125</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="combo" version="2.0.0">
<name>ComboBox</name>
<pv_name>TEST_PREFIX:DATA:CAPTURE_MODE</pv_name>
<pv_name>DATA:CAPTURE_MODE</pv_name>
<x>255</x>
<y>125</y>
<width>205</width>
Expand All @@ -285,6 +295,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 +306,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,10 +328,11 @@
<y>0</y>
<width>250</width>
<height>20</height>
<tooltip>$(text)</tooltip>
</widget>
<widget type="textupdate" version="2.0.0">
<name>TextUpdate</name>
<pv_name>TEST_PREFIX:DATA:STATUS</pv_name>
<pv_name>DATA:STATUS</pv_name>
<x>255</x>
<y>0</y>
<width>205</width>
Expand All @@ -330,7 +342,6 @@
</font>
</font>
<horizontal_alignment>1</horizontal_alignment>
<format>6</format>
</widget>
</widget>
</display>
Loading

0 comments on commit 58d44a2

Please sign in to comment.