Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
13 changes: 8 additions & 5 deletions src/fastcs/transports/epics/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def _get_pv(self, attr_path: list[str], name: str):
)
return f"{attr_prefix}:{snake_to_pascal(name)}"

def _get_read_widget(self, fastcs_datatype: DataType) -> ReadWidgetUnion | None:
match fastcs_datatype:
def _get_read_widget(self, attribute: Attribute) -> ReadWidgetUnion | None:
match attribute.datatype:
case Bool():
return LED()
case Int():
Expand All @@ -71,7 +71,10 @@ def _get_read_widget(self, fastcs_datatype: DataType) -> ReadWidgetUnion | None:
return TextRead(format=TextFormat.string)
case Waveform() as waveform:
if len(waveform.shape) > 1:
logger.warning("EPICS CA transport only supports 1D waveforms")
logger.warning(
"EPICS CA transport only supports 1D waveforms,"
+ f"{attribute} is a {waveform.shape} waveform"
)
return None

return ArrayTrace(axis="x")
Expand Down Expand Up @@ -102,7 +105,7 @@ def _get_attribute_component(
name = snake_to_pascal(name)
match attribute:
case AttrRW():
read_widget = self._get_read_widget(attribute.datatype)
read_widget = self._get_read_widget(attribute)
write_widget = self._get_write_widget(attribute.datatype)
if write_widget is None or read_widget is None:
return None
Expand All @@ -115,7 +118,7 @@ def _get_attribute_component(
read_widget=read_widget,
)
case AttrR():
read_widget = self._get_read_widget(attribute.datatype)
read_widget = self._get_read_widget(attribute)
if read_widget is None:
return None
return SignalR(
Expand Down
13 changes: 8 additions & 5 deletions src/fastcs/transports/epics/pva/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
WriteWidgetUnion,
)

from fastcs.attributes.attr_r import AttrR
from fastcs.attributes.attribute import Attribute
from fastcs.datatypes import Bool, DataType, Table, Waveform, numpy_to_fastcs_datatype
from fastcs.transports.epics.gui import EpicsGUI

Expand All @@ -20,17 +22,18 @@ class PvaEpicsGUI(EpicsGUI):
def _get_pv(self, attr_path: list[str], name: str):
return f"pva://{super()._get_pv(attr_path, name)}"

def _get_read_widget(self, fastcs_datatype: DataType) -> ReadWidgetUnion | None:
match fastcs_datatype:
def _get_read_widget(self, attribute: Attribute) -> ReadWidgetUnion | None:
match attribute.datatype:
case Table():
fastcs_datatypes = [
numpy_to_fastcs_datatype(datatype)
for _, datatype in fastcs_datatype.structured_dtype
for _, datatype in attribute.datatype.structured_dtype
]

base_get_read_widget = super()._get_read_widget
widgets = [
base_get_read_widget(datatype) for datatype in fastcs_datatypes
base_get_read_widget(AttrR(datatype))
for datatype in fastcs_datatypes
]

return TableRead(widgets=widgets) # type: ignore
Expand All @@ -39,7 +42,7 @@ def _get_read_widget(self, fastcs_datatype: DataType) -> ReadWidgetUnion | None:
height=height, width=width, color_map=ImageColorMap.GRAY
)
case _:
return super()._get_read_widget(fastcs_datatype)
return super()._get_read_widget(attribute)

def _get_write_widget(self, fastcs_datatype: DataType) -> WriteWidgetUnion | None:
match fastcs_datatype:
Expand Down