Skip to content

Commit

Permalink
Merge pull request #35 from DiamondLightSource/pascal-group-names
Browse files Browse the repository at this point in the history
Coerce controller paths to PascalCase for pvi Group names
  • Loading branch information
GDYendell committed May 16, 2024
2 parents 2c46785 + eacc9e6 commit 1ea3e53
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/fastcs/backends/epics/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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),
)
Expand Down
3 changes: 3 additions & 0 deletions src/fastcs/util.py
Original file line number Diff line number Diff line change
@@ -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(" ", "")

0 comments on commit 1ea3e53

Please sign in to comment.