From 58d44a23eabb0b9fea1cf6f02a41e8d8ef0615f3 Mon Sep 17 00:00:00 2001 From: Richard Cunningham Date: Tue, 24 Sep 2024 15:40:41 +0100 Subject: [PATCH] Updated PandABlocks to interface with PVI 0.10.0 --- pyproject.toml | 2 +- src/pandablocks_ioc/_pvi.py | 47 +++++++++++++++-------------- src/pandablocks_ioc/_tables.py | 8 +++-- tests/test-bobfiles/DATA.bob | 55 ++++++++++++++++++++-------------- tests/test-bobfiles/PCAP.bob | 29 ++++++++++-------- tests/test-bobfiles/PULSE.bob | 12 ++++---- tests/test-bobfiles/PandA.bob | 6 ++-- tests/test-bobfiles/SEQ.bob | 18 +++++++---- tests/test-bobfiles/index.bob | 18 ++++++----- tests/test_ioc_system.py | 2 +- 10 files changed, 117 insertions(+), 80 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 33c01564..9156f04a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"] diff --git a/src/pandablocks_ioc/_pvi.py b/src/pandablocks_ioc/_pvi.py index 2849b244..5e6ff30e 100644 --- a/src/pandablocks_ioc/_pvi.py +++ b/src/pandablocks_ioc/_pvi.py @@ -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") @@ -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") @@ -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: @@ -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 ( @@ -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) @@ -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(), ), ] @@ -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) diff --git a/src/pandablocks_ioc/_tables.py b/src/pandablocks_ioc/_tables.py index 25df25c2..14309737 100644 --- a/src/pandablocks_ioc/_tables.py +++ b/src/pandablocks_ioc/_tables.py @@ -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, @@ -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) diff --git a/tests/test-bobfiles/DATA.bob b/tests/test-bobfiles/DATA.bob index 51939078..14a479f6 100644 --- a/tests/test-bobfiles/DATA.bob +++ b/tests/test-bobfiles/DATA.bob @@ -1,7 +1,7 @@ - Display + DATA 0 - 0 + 0 506 463 4 @@ -9,7 +9,7 @@ Title TITLE - DATA - TEST_PREFIX: + DATA 0 0 506 @@ -39,10 +39,11 @@ 0 250 20 + $(text) TextEntry - TEST_PREFIX:DATA:HDF_DIRECTORY + DATA:HDF_DIRECTORY 255 0 205 @@ -57,10 +58,11 @@ 25 250 20 + $(text) TextEntry - TEST_PREFIX:DATA:CREATE_DIRECTORY + DATA:CREATE_DIRECTORY 255 25 205 @@ -74,10 +76,11 @@ 50 250 20 + $(text) TextUpdate - TEST_PREFIX:DATA:DIRECTORY_EXISTS + DATA:DIRECTORY_EXISTS 255 50 205 @@ -95,10 +98,11 @@ 75 250 20 + $(text) TextEntry - TEST_PREFIX:DATA:HDF_FILE_NAME + DATA:HDF_FILE_NAME 255 75 205 @@ -113,10 +117,11 @@ 100 250 20 + $(text) TextUpdate - TEST_PREFIX:DATA:HDF_FULL_FILE_PATH + DATA:HDF_FULL_FILE_PATH 255 100 205 @@ -126,7 +131,6 @@ 1 - 6 @@ -143,10 +147,11 @@ 0 250 20 + $(text) TextEntry - TEST_PREFIX:DATA:NUM_CAPTURE + DATA:NUM_CAPTURE 255 0 205 @@ -160,10 +165,11 @@ 25 250 20 + $(text) TextUpdate - TEST_PREFIX:DATA:NUM_CAPTURED + DATA:NUM_CAPTURED 255 25 205 @@ -181,10 +187,11 @@ 50 250 20 + $(text) TextUpdate - TEST_PREFIX:DATA:NUM_RECEIVED + DATA:NUM_RECEIVED 255 50 205 @@ -202,10 +209,11 @@ 75 250 20 + $(text) TextEntry - TEST_PREFIX:DATA:FLUSH_PERIOD + DATA:FLUSH_PERIOD 255 75 205 @@ -219,10 +227,11 @@ 100 250 20 + $(text) WritePV - TEST_PREFIX:DATA:CAPTURE + DATA:CAPTURE $(pv_name) @@ -235,11 +244,11 @@ 100 65 20 - $(actions) + DATA:CAPTURE = 1 WritePV - TEST_PREFIX:DATA:CAPTURE + DATA:CAPTURE $(pv_name) @@ -252,11 +261,11 @@ 100 65 20 - $(actions) + DATA:CAPTURE = 0 LED - TEST_PREFIX:DATA:CAPTURE + DATA:CAPTURE 417 100 20 @@ -269,10 +278,11 @@ 125 250 20 + $(text) ComboBox - TEST_PREFIX:DATA:CAPTURE_MODE + DATA:CAPTURE_MODE 255 125 205 @@ -285,6 +295,7 @@ 150 250 20 + $(text) OpenDisplay @@ -295,7 +306,7 @@ Open Display - All Postion Capture Parameters + SubScreen 255 150 205 @@ -317,10 +328,11 @@ 0 250 20 + $(text) TextUpdate - TEST_PREFIX:DATA:STATUS + DATA:STATUS 255 0 205 @@ -330,7 +342,6 @@ 1 - 6 diff --git a/tests/test-bobfiles/PCAP.bob b/tests/test-bobfiles/PCAP.bob index b12f84f6..7586bb06 100644 --- a/tests/test-bobfiles/PCAP.bob +++ b/tests/test-bobfiles/PCAP.bob @@ -1,7 +1,7 @@ - Display + PCAP 0 - 0 + 0 506 227 4 @@ -9,7 +9,7 @@ Title TITLE - PCAP - TEST_PREFIX: + PCAP 0 0 506 @@ -39,10 +39,11 @@ 0 250 20 + $(text) TextEntry - TEST_PREFIX:PCAP:LABEL + PCAP:LABEL 255 0 205 @@ -57,10 +58,11 @@ 25 250 20 + $(text) WritePV - TEST_PREFIX:PCAP:ARM + PCAP:ARM $(pv_name) @@ -73,11 +75,11 @@ 25 65 20 - $(actions) + PCAP:ARM = 1 WritePV - TEST_PREFIX:PCAP:ARM + PCAP:ARM $(pv_name) @@ -90,11 +92,11 @@ 25 65 20 - $(actions) + PCAP:ARM = 0 LED - TEST_PREFIX:PCAP:ARM + PCAP:ARM 417 25 20 @@ -107,10 +109,11 @@ 50 250 20 + $(text) TextEntry - TEST_PREFIX:PCAP:GATE + PCAP:GATE 255 50 205 @@ -125,10 +128,11 @@ 75 250 20 + $(text) TextEntry - TEST_PREFIX:PCAP:GATE:DELAY + PCAP:GATE:DELAY 255 75 205 @@ -150,10 +154,11 @@ 0 250 20 + $(text) ComboBox - TEST_PREFIX:PCAP:TRIG_EDGE + PCAP:TRIG_EDGE 255 0 205 diff --git a/tests/test-bobfiles/PULSE.bob b/tests/test-bobfiles/PULSE.bob index ad90b719..193fe0a2 100644 --- a/tests/test-bobfiles/PULSE.bob +++ b/tests/test-bobfiles/PULSE.bob @@ -1,7 +1,7 @@ - Display + PULSE 0 - 0 + 0 506 116 4 @@ -9,7 +9,7 @@ Title TITLE - PULSE - TEST_PREFIX: + PULSE 0 0 506 @@ -39,10 +39,11 @@ 0 250 20 + $(text) TextEntry - TEST_PREFIX:PULSE:DELAY + PULSE:DELAY 255 0 205 @@ -56,10 +57,11 @@ 25 250 20 + $(text) ComboBox - TEST_PREFIX:PULSE:DELAY:UNITS + PULSE:DELAY:UNITS 255 25 205 diff --git a/tests/test-bobfiles/PandA.bob b/tests/test-bobfiles/PandA.bob index 7e9133dd..a09c6be9 100644 --- a/tests/test-bobfiles/PandA.bob +++ b/tests/test-bobfiles/PandA.bob @@ -1,7 +1,7 @@ - Display + PandA 0 - 0 + 0 46 71 4 @@ -9,7 +9,7 @@ Title TITLE - PandA - TEST_PREFIX: + PandA 0 0 46 diff --git a/tests/test-bobfiles/SEQ.bob b/tests/test-bobfiles/SEQ.bob index 0093e4af..40722aa3 100644 --- a/tests/test-bobfiles/SEQ.bob +++ b/tests/test-bobfiles/SEQ.bob @@ -1,7 +1,7 @@ - Display + SEQ 0 - 0 + 0 506 296 4 @@ -9,7 +9,7 @@ Title TITLE - SEQ - TEST_PREFIX: + SEQ 0 0 506 @@ -34,11 +34,18 @@ true Table - pva://TEST_PREFIX:SEQ:TABLE + pva://SEQ:TABLE 0 0 0 200 + + + Column 1 + 100 + true + + Label @@ -47,10 +54,11 @@ 205 250 20 + $(text) ComboBox - TEST_PREFIX:SEQ:TABLE:MODE + SEQ:TABLE:MODE 255 205 205 diff --git a/tests/test-bobfiles/index.bob b/tests/test-bobfiles/index.bob index 7cd3fe08..8172b259 100644 --- a/tests/test-bobfiles/index.bob +++ b/tests/test-bobfiles/index.bob @@ -1,7 +1,7 @@ - Display + index 0 - 0 + 0 488 130 4 @@ -9,7 +9,7 @@ Title TITLE - index - TEST_PREFIX: + index 0 0 488 @@ -32,6 +32,7 @@ 30 250 20 + $(text) OpenDisplay @@ -42,7 +43,7 @@ Open Display - PCAP + SubScreen 278 30 205 @@ -56,6 +57,7 @@ 55 250 20 + $(text) OpenDisplay @@ -66,7 +68,7 @@ Open Display - DATA + SubScreen 278 55 205 @@ -80,6 +82,7 @@ 80 250 20 + $(text) OpenDisplay @@ -90,7 +93,7 @@ Open Display - SEQ + SubScreen 278 80 205 @@ -104,6 +107,7 @@ 105 250 20 + $(text) OpenDisplay @@ -114,7 +118,7 @@ Open Display - PULSE + SubScreen 278 105 205 diff --git a/tests/test_ioc_system.py b/tests/test_ioc_system.py index f56c5713..a2a316d4 100644 --- a/tests/test_ioc_system.py +++ b/tests/test_ioc_system.py @@ -389,7 +389,7 @@ async def test_create_bobfiles_deletes_existing_files_with_clear_bobfiles( Pvi.add_pvi_info( pv, PviGroup.PARAMETERS, - SignalX(name="TrigEdge", pv=pv, value="Falling"), + SignalX(name="TrigEdge", write_pv=pv, value="Falling"), ) Pvi.create_pvi_records(new_random_test_prefix)