Skip to content

Commit e5b86c4

Browse files
authored
Merge pull request #44 from DiamondLightSource/fix-gui-pvs
Fix GUI PVs with no attribute path
2 parents bf15b28 + c3bdbd3 commit e5b86c4

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/fastcs/backends/epics/gui.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,8 @@ def __init__(self, mapping: Mapping, pv_prefix: str) -> None:
5050
self._pv_prefix = pv_prefix
5151

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

5756
@staticmethod
5857
def _get_read_widget(datatype: DataType) -> ReadWidget:

tests/backends/epics/test_gui.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from fastcs.backends.epics.gui import EpicsGUI
2+
from fastcs.controller import Controller
3+
from fastcs.mapping import Mapping
4+
5+
6+
def test_get_pv():
7+
gui = EpicsGUI(Mapping(Controller()), "DEVICE")
8+
9+
assert gui._get_pv([], "A") == "DEVICE:A"
10+
assert gui._get_pv(["B"], "C") == "DEVICE:B:C"
11+
assert gui._get_pv(["D", "E"], "F") == "DEVICE:D:E:F"

0 commit comments

Comments
 (0)