Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coerce controller paths to PascalCase for pvi Group names #35

Merged
merged 1 commit into from
May 16, 2024
Merged
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
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(" ", "")

Check warning on line 3 in src/fastcs/util.py

View check run for this annotation

Codecov / codecov/patch

src/fastcs/util.py#L3

Added line #L3 was not covered by tests