Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
prerelease: ${{ contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc') }}
files: |
"*"
schemas/*.yml
schemas/*.json
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16 changes: 8 additions & 8 deletions src/techui_builder/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Generator:
screen_components: list[Entity] = field(init=False)

# These are global params for the class (not accessible by user)
ibek_map: dict = field(init=False, repr=False)
techui_support: dict = field(init=False, repr=False)
default_size: int = field(default=100, init=False, repr=False)
P: str = field(default="P", init=False, repr=False)
M: str = field(default="M", init=False, repr=False)
Expand All @@ -43,14 +43,14 @@ def __post_init__(self):
self._read_map()

def _read_map(self):
"""Read the ibek-mapping.yaml file from techui-support."""
ibek_map = self.services_dir.parent.parent.joinpath(
"src/techui_support/ibek_mapping.yaml"
"""Read the techui_support.yaml file from techui-support."""
techui_support = self.services_dir.parent.parent.joinpath(
"src/techui_support/techui_support.yaml"
).absolute()
LOGGER.debug(f"ibek_mapping.yaml location: {ibek_map}")
LOGGER.debug(f"techui_support.yaml location: {techui_support}")

with open(ibek_map) as map:
self.ibek_map = yaml.safe_load(map)
with open(techui_support) as map:
self.techui_support = yaml.safe_load(map)

def load_screen(self, screen_name: str, screen_components: list[Entity]):
self.screen_name = screen_name
Expand Down Expand Up @@ -213,7 +213,7 @@ def _create_widget(
support_path = base_dir.joinpath("src/techui_support")

try:
scrn_mapping = self.ibek_map[component.type]
scrn_mapping = self.techui_support[component.type]
except KeyError:
LOGGER.warning(
f"No available widget for {component.type} in screen \
Expand Down
15 changes: 7 additions & 8 deletions src/techui_builder/schema_generator.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import json
from pathlib import Path

import yaml

from techui_builder.models import (
GuiComponents,
TechUi,
Expand All @@ -11,18 +10,18 @@
SCHEMAS_DIR.mkdir(exist_ok=True)


def write_yaml_schema(model_name: str, schema_dict: dict) -> None:
out = SCHEMAS_DIR / f"{model_name}.schema.yml"
def write_json_schema(model_name: str, schema_dict: dict) -> None:
out = SCHEMAS_DIR / f"{model_name}.schema.json"
with out.open("w", encoding="utf-8") as f:
yaml.safe_dump(schema_dict, f, sort_keys=False)
json.dump(schema_dict, f, sort_keys=False)
print(f"✅ Wrote {out}")


def schema_generator() -> None:
# techui
tu = TechUi.model_json_schema()
write_yaml_schema("techui", tu)
write_json_schema("techui", tu)

# ibek_mapping
ibek = GuiComponents.model_json_schema()
write_yaml_schema("ibek_mapping", ibek)
tu_support = GuiComponents.model_json_schema()
write_json_schema("techui.support", tu_support)
2 changes: 1 addition & 1 deletion src/techui_support