From 8483ee1eae50423abd887972b328a3f6ce349f26 Mon Sep 17 00:00:00 2001 From: Richard Cunningham Date: Fri, 27 Sep 2024 10:22:56 +0100 Subject: [PATCH] labelling across _pvi and _tables --- src/pandablocks_ioc/_pvi.py | 31 +++++++++++++++---------------- src/pandablocks_ioc/_tables.py | 4 ++-- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/pandablocks_ioc/_pvi.py b/src/pandablocks_ioc/_pvi.py index 59b756f5..1861439e 100644 --- a/src/pandablocks_ioc/_pvi.py +++ b/src/pandablocks_ioc/_pvi.py @@ -83,7 +83,7 @@ def add_data_capture_pvi_info( component = SignalRW( name=epics_to_pvi_name(data_capture_record_name), read_pv=data_capture_record_name, - write_pv=data_capture_record_name, + write_pv=f"{Pvi.record_prefix}:{data_capture_record_name}", write_widget=ButtonPanel(actions={"Start": "1", "Stop": "0"}), read_widget=LED(), ) @@ -98,7 +98,7 @@ def add_pcap_arm_pvi_info(group: PviGroup, pcap_arm_pvi_record: RecordWrapper): component = SignalRW( name=epics_to_pvi_name(pcap_arm_record_name), read_pv=pcap_arm_record_name, - write_pv=pcap_arm_record_name, + write_pv=f"{Pvi.record_prefix}:{pcap_arm_record_name}", write_widget=ButtonPanel(actions={"Arm": "1", "Disarm": "0"}), read_widget=LED(), ) @@ -186,37 +186,37 @@ def add_positions_table_row( SignalR( name=epics_to_pvi_name(value_record_name), label=value_record_name, - read_pv=value_record_name, + 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, - write_pv=units_record_name, + 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, - write_pv=scale_record_name, + 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, - write_pv=offset_record_name, + 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, - write_pv=dataset_record_name, + 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, - write_pv=capture_record_name, + write_pv=f"{Pvi.record_prefix}:{capture_record_name}", write_widget=ComboBox(), ), ] @@ -262,20 +262,19 @@ def configure_pvi(screens_dir: Optional[str], clear_bobfiles: bool): Pvi._clear_bobfiles = clear_bobfiles - @staticmethod + def add_pvi_info(record_name: EpicsName, group: PviGroup, component: Component): """Add PVI Info to the global collection""" - prefix, block, *_ = record_name.split(":") - record_name = f"{prefix}:{block}" + record_base, _ = record_name.split(":", 1) - if record_name in Pvi.pvi_info_dict: - if group in Pvi.pvi_info_dict[record_name]: - Pvi.pvi_info_dict[record_name][group].append(component) + if record_base in Pvi.pvi_info_dict: + if group in Pvi.pvi_info_dict[record_base]: + Pvi.pvi_info_dict[record_base][group].append(component) else: - Pvi.pvi_info_dict[record_name][group] = [component] + Pvi.pvi_info_dict[record_base][group] = [component] else: - Pvi.pvi_info_dict[record_name] = {group: [component]} + Pvi.pvi_info_dict[record_base] = {group: [component]} @staticmethod def add_general_device_refs_to_groups(device: Device): diff --git a/src/pandablocks_ioc/_tables.py b/src/pandablocks_ioc/_tables.py index 14309737..3644d7a6 100644 --- a/src/pandablocks_ioc/_tables.py +++ b/src/pandablocks_ioc/_tables.py @@ -238,7 +238,7 @@ def __init__( pvi_group, SignalRW( name=pvi_table_name, - write_pv=table_name, + write_pv=f"{Pvi.record_prefix}:{table_name}", write_widget=TableWrite(widgets=[]), ), ) @@ -312,7 +312,7 @@ def __init__( Pvi.add_pvi_info( mode_record_name, pvi_group, - SignalRW(name=pvi_name, write_pv=mode_record_name, write_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)