diff --git a/src/fastcs/backends/epics/gui.py b/src/fastcs/backends/epics/gui.py index bf2a8a5d..fa613efa 100644 --- a/src/fastcs/backends/epics/gui.py +++ b/src/fastcs/backends/epics/gui.py @@ -29,6 +29,7 @@ from fastcs.datatypes import Bool, DataType, Float, Int, String from fastcs.exceptions import FastCSException from fastcs.mapping import Mapping, SingleMapping +from fastcs.util import snake_to_pascal class EpicsGUIFormat(Enum): @@ -130,7 +131,7 @@ def create_gui(self, options: EpicsGUIOptions | None = None) -> None: for sub_controller_mapping in sub_controller_mappings: components.append( Group( - name=sub_controller_mapping.controller.path, + name=snake_to_pascal(sub_controller_mapping.controller.path), layout=SubScreen(), children=self.extract_mapping_components(sub_controller_mapping), ) diff --git a/src/fastcs/util.py b/src/fastcs/util.py new file mode 100644 index 00000000..e976e463 --- /dev/null +++ b/src/fastcs/util.py @@ -0,0 +1,3 @@ +def snake_to_pascal(input: str) -> str: + """Convert a snake_case or UPPER_SNAKE_CASE string to PascalCase.""" + return input.lower().replace("_", " ").title().replace(" ", "")