Skip to content

Commit

Permalink
Merge pull request #44 from DiamondLightSource/fix-gui-pvs
Browse files Browse the repository at this point in the history
Fix GUI PVs with no attribute path
  • Loading branch information
GDYendell authored Jun 18, 2024
2 parents bf15b28 + c3bdbd3 commit e5b86c4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/fastcs/backends/epics/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ def __init__(self, mapping: Mapping, pv_prefix: str) -> None:
self._pv_prefix = pv_prefix

def _get_pv(self, attr_path: list[str], name: str):
attr_prefix = ":".join(attr_path)
pv_prefix = ":".join((self._pv_prefix, attr_prefix))
return f"{pv_prefix}:{name.title().replace('_', '')}"
attr_prefix = ":".join([self._pv_prefix] + attr_path)
return f"{attr_prefix}:{name.title().replace('_', '')}"

@staticmethod
def _get_read_widget(datatype: DataType) -> ReadWidget:
Expand Down
11 changes: 11 additions & 0 deletions tests/backends/epics/test_gui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from fastcs.backends.epics.gui import EpicsGUI
from fastcs.controller import Controller
from fastcs.mapping import Mapping


def test_get_pv():
gui = EpicsGUI(Mapping(Controller()), "DEVICE")

assert gui._get_pv([], "A") == "DEVICE:A"
assert gui._get_pv(["B"], "C") == "DEVICE:B:C"
assert gui._get_pv(["D", "E"], "F") == "DEVICE:D:E:F"

0 comments on commit e5b86c4

Please sign in to comment.