From cdb60cec96e305b507270adc8140f361cf177e82 Mon Sep 17 00:00:00 2001 From: kajaskerlj Date: Mon, 2 Feb 2026 18:36:43 +0100 Subject: [PATCH 1/6] Made the second and third container responsive --- tui/components.py | 118 ++++++++++++++-------------------------------- tui/styles.css | 18 +++++-- 2 files changed, 49 insertions(+), 87 deletions(-) diff --git a/tui/components.py b/tui/components.py index 252876f..6d02d7c 100644 --- a/tui/components.py +++ b/tui/components.py @@ -232,70 +232,44 @@ async def clear_substates(self): class RenderingInfoBox(Vertical): - """Container with ASCII border for module and functionality information.""" + """Responsive container for module and functionality information.""" def __init__(self, **kwargs): super().__init__(**kwargs) self.module_text = "" self.functionality_text = "" + self.module_widget: Static | None = None + self.functionality_widget: Static | None = None def update_module(self, text: str) -> None: - """Update the module name and refresh the display.""" + """Update the module name display.""" self.module_text = text self._refresh_content() def update_functionality(self, text: str) -> None: - """Update the functionality text and refresh the display.""" + """Update the functionality text display.""" self.functionality_text = text self._refresh_content() def _refresh_content(self) -> None: - """Refresh the content of the box.""" - try: - widget = self.query_one("#rendering-info-content", Static) - # Calculate the width needed for the border - lines = [] - if self.module_text: - lines.append(f" {self.module_text}") - if self.functionality_text: - lines.append(f" {self.functionality_text}") - - if not lines: - widget.update("") - return - - # Find the longest line to determine border width - max_width = max(len(line) for line in lines) if lines else 40 - border_width = max(max_width + 2, 42) # At least 42 chars wide - - # Build the bordered box with title - title = " Currently rendering " - top_border = "┌[#FFFFFF]" + title + "[/#FFFFFF]" + "─" * (border_width - len(title)) + "┐" - bottom_border = "└" + "─" * border_width + "┘" - - content_lines = [top_border] - # Add top padding (empty line) - content_lines.append(f"│{' ' * border_width}│") - for line in lines: - padding = border_width - len(line) - content_lines.append(f"│{line}{' ' * padding}│") - # Add bottom padding (empty line) - content_lines.append(f"│{' ' * border_width}│") - content_lines.append(bottom_border) - - widget.update("\n".join(content_lines)) - except Exception: - pass + """Refresh text inside the box.""" + if self.module_widget is not None: + self.module_widget.update(self.module_text or "") + if self.functionality_widget is not None: + self.functionality_widget.update(self.functionality_text or "") def on_mount(self) -> None: - """Initialize the box with empty state on mount.""" - # Set default empty labels + """Initialize default labels on mount.""" self.module_text = "Module: " self.functionality_text = "Functionality:" self._refresh_content() def compose(self): - yield Static("", id="rendering-info-content", classes="rendering-info-box") + self.module_widget = Static(self.module_text, classes="rendering-info-row") + self.functionality_widget = Static(self.functionality_text, classes="rendering-info-row") + with Vertical(classes="rendering-info-box"): + yield self.module_widget + yield self.functionality_widget class TestScriptsContainer(Vertical): @@ -315,6 +289,9 @@ def __init__( self.unit_test_text = ScriptOutputType.UNIT_TEST_OUTPUT_TEXT.value self.conformance_test_text = ScriptOutputType.CONFORMANCE_TEST_OUTPUT_TEXT.value self.testing_env_text = ScriptOutputType.TESTING_ENVIRONMENT_OUTPUT_TEXT.value + self.unit_widget: Static | None = None + self.conformance_widget: Static | None = None + self.testing_widget: Static | None = None def update_unit_test(self, text: str) -> None: """Update unit test output and refresh.""" @@ -332,52 +309,29 @@ def update_testing_env(self, text: str) -> None: self._refresh_content() def _refresh_content(self) -> None: - """Refresh the bordered box content.""" - try: - widget = self.query_one("#test-scripts-content", Static) - - # Collect lines to display - lines = [] - if self.show_unit_test: - lines.append(f" {self.unit_test_text}") - if self.show_conformance_test: - lines.append(f" {self.conformance_test_text}") - if self.show_testing_env: - lines.append(f" {self.testing_env_text}") - - if not lines: - widget.update("") - return - - # Find the longest line to determine border width - max_width = max(len(line) for line in lines) - border_width = max(max_width + 2, 80) # Minimum width of 80 chars - - # Build the bordered box with title - title = " Latest test scripts " - top_border = "┌[#FFFFFF]" + title + "[/#FFFFFF]" + "─" * (border_width - len(title)) + "┐" - bottom_border = "└" + "─" * border_width + "┘" - - content_lines = [top_border] - # Add top padding (empty line) - content_lines.append(f"│{' ' * border_width}│") - for line in lines: - padding = border_width - len(line) - content_lines.append(f"│{line}{' ' * padding}│") - # Add bottom padding (empty line) - content_lines.append(f"│{' ' * border_width}│") - content_lines.append(bottom_border) - - widget.update("\n".join(content_lines)) - except Exception: - pass + """Refresh the test script rows.""" + if self.unit_widget is not None: + self.unit_widget.update(self.unit_test_text) + self.unit_widget.display = self.show_unit_test + if self.conformance_widget is not None: + self.conformance_widget.update(self.conformance_test_text) + self.conformance_widget.display = self.show_conformance_test + if self.testing_widget is not None: + self.testing_widget.update(self.testing_env_text) + self.testing_widget.display = self.show_testing_env def on_mount(self) -> None: """Initialize the box on mount.""" self._refresh_content() def compose(self): - yield Static("", id="test-scripts-content", classes="test-scripts-box") + with Vertical(classes="test-scripts-box"): + self.unit_widget = Static(self.unit_test_text, classes="test-script-row") + self.conformance_widget = Static(self.conformance_test_text, classes="test-script-row") + self.testing_widget = Static(self.testing_env_text, classes="test-script-row") + yield self.unit_widget + yield self.conformance_widget + yield self.testing_widget class FRIDProgress(Vertical): diff --git a/tui/styles.css b/tui/styles.css index 2aaae99..cad5ccd 100644 --- a/tui/styles.css +++ b/tui/styles.css @@ -34,13 +34,11 @@ We might need those at some point, so just commenting them out for now. margin-left: 2; margin-right: 2; height: auto; - color: grey; } #render-status-widget { margin: 0 3; height: auto; - color: #4D4D4D; } #render-status-widget.success { @@ -64,7 +62,12 @@ RenderingInfoBox { .rendering-info-box { height: auto; - color: #888; + border: solid #FFF; + padding: 0 1; +} + +.rendering-info-row { + color: #FFF; } ProgressItem { @@ -101,13 +104,13 @@ ProgressItem { margin-bottom: 1; margin-left: 2; margin-right: 2; - color: #4D4D4D; + color: #FFF; } #render-module-name-widget { margin-left: 2; margin-right: 2; - color: #4D4D4D; + color: #FFF; } TestScriptsContainer { @@ -118,8 +121,13 @@ TestScriptsContainer { .test-scripts-box { height: auto; color: #888; + border: solid #FFF; + padding: 0 1; } +.test-script-row { + color: #FFF; +} #unit-test-script-output-widget, #conformance-tests-script-output-widget, #testing-environment-script-output-widget { From 0cb821e170225cb551d053af0b4072d898c81240 Mon Sep 17 00:00:00 2001 From: kajaskerlj Date: Mon, 2 Feb 2026 18:46:03 +0100 Subject: [PATCH 2/6] Changed the header of the TUI --- tui/plain2code_tui.py | 5 +---- tui/styles.css | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/tui/plain2code_tui.py b/tui/plain2code_tui.py index 3059e8d..9c62437 100644 --- a/tui/plain2code_tui.py +++ b/tui/plain2code_tui.py @@ -175,10 +175,7 @@ def compose(self) -> ComposeResult: with Vertical(id=TUIComponents.DASHBOARD_VIEW.value): with VerticalScroll(): yield Static( - "┌────────────────────────────────────────────────────────────────┐\n" - "│ [#E0FF6E]*codeplain[/#E0FF6E] │ how to get started │\n" - "│ [#888888](v0.5.0)[/#888888] │ [#888888]Use ctrl + l to see the logs for debuging[/#888888] │\n" - "└────────────────────────────────────────────────────────────────┘", + "[#E0FF6E]*codeplain[/#E0FF6E] [#888888](v0.5.0)[/#888888]\n", id="codeplain-header", classes="codeplain-header", ) diff --git a/tui/styles.css b/tui/styles.css index cad5ccd..c59292b 100644 --- a/tui/styles.css +++ b/tui/styles.css @@ -10,7 +10,7 @@ Screen { /* Codeplain Header Box */ #codeplain-header { dock: top; - margin: 1 2; + margin: 1 0; width: auto; height: auto; } From e782647b9fc7361ea18b034ebc42f6a517d0decf Mon Sep 17 00:00:00 2001 From: kajaskerlj Date: Mon, 2 Feb 2026 19:09:54 +0100 Subject: [PATCH 3/6] Added titles to each container and changed the styling --- tui/components.py | 6 ++++-- tui/plain2code_tui.py | 2 +- tui/styles.css | 15 ++++++++++++--- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/tui/components.py b/tui/components.py index 6d02d7c..90ecca2 100644 --- a/tui/components.py +++ b/tui/components.py @@ -260,13 +260,14 @@ def _refresh_content(self) -> None: def on_mount(self) -> None: """Initialize default labels on mount.""" - self.module_text = "Module: " - self.functionality_text = "Functionality:" + self.module_text = "module: " + self.functionality_text = "functionality:" self._refresh_content() def compose(self): self.module_widget = Static(self.module_text, classes="rendering-info-row") self.functionality_widget = Static(self.functionality_text, classes="rendering-info-row") + yield Static("module status", classes="rendering-info-title") with Vertical(classes="rendering-info-box"): yield self.module_widget yield self.functionality_widget @@ -325,6 +326,7 @@ def on_mount(self) -> None: self._refresh_content() def compose(self): + yield Static("latest test scripts", classes="test-scripts-title") with Vertical(classes="test-scripts-box"): self.unit_widget = Static(self.unit_test_text, classes="test-script-row") self.conformance_widget = Static(self.conformance_test_text, classes="test-script-row") diff --git a/tui/plain2code_tui.py b/tui/plain2code_tui.py index 9c62437..9e07174 100644 --- a/tui/plain2code_tui.py +++ b/tui/plain2code_tui.py @@ -175,7 +175,7 @@ def compose(self) -> ComposeResult: with Vertical(id=TUIComponents.DASHBOARD_VIEW.value): with VerticalScroll(): yield Static( - "[#E0FF6E]*codeplain[/#E0FF6E] [#888888](v0.5.0)[/#888888]\n", + "[#FFFFFF]*codeplain[/#FFFFFF] [#888888](v0.5.0)[/#888888]\n", id="codeplain-header", classes="codeplain-header", ) diff --git a/tui/styles.css b/tui/styles.css index c59292b..faf3af2 100644 --- a/tui/styles.css +++ b/tui/styles.css @@ -37,7 +37,6 @@ We might need those at some point, so just commenting them out for now. } #render-status-widget { - margin: 0 3; height: auto; } @@ -62,7 +61,7 @@ RenderingInfoBox { .rendering-info-box { height: auto; - border: solid #FFF; + border: solid #E0FF6E; padding: 0 1; } @@ -70,6 +69,11 @@ RenderingInfoBox { color: #FFF; } +.rendering-info-title { + color: #E0FF6E; + margin-bottom: 0; +} + ProgressItem { height: auto; } @@ -121,10 +125,15 @@ TestScriptsContainer { .test-scripts-box { height: auto; color: #888; - border: solid #FFF; + border: solid #E0FF6E; padding: 0 1; } +.test-scripts-title { + color: #E0FF6E; + margin-bottom: 0; +} + .test-script-row { color: #FFF; } From 37b56c74a7172cb389a7e6909ead29393e23744d Mon Sep 17 00:00:00 2001 From: kajaskerlj Date: Tue, 3 Feb 2026 10:40:56 +0100 Subject: [PATCH 4/6] Added a live client version to the header --- plain2code.py | 1 + tui/plain2code_tui.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/plain2code.py b/plain2code.py index 011c93d..ed980ac 100644 --- a/plain2code.py +++ b/plain2code.py @@ -227,6 +227,7 @@ def render(args, run_state: RunState, codeplain_api, event_bus: EventBus): # no unittests_script=args.unittests_script, conformance_tests_script=args.conformance_tests_script, prepare_environment_script=args.prepare_environment_script, + state_machine_version=system_config.client_version, css_path="styles.css", ) result = app.run() diff --git a/tui/plain2code_tui.py b/tui/plain2code_tui.py index 9e07174..8985ab5 100644 --- a/tui/plain2code_tui.py +++ b/tui/plain2code_tui.py @@ -66,6 +66,7 @@ def __init__( unittests_script: str, conformance_tests_script: str, prepare_environment_script: str, + state_machine_version: str, **kwargs, ): super().__init__(**kwargs) @@ -76,6 +77,7 @@ def __init__( self.unittests_script: Optional[str] = unittests_script self.conformance_tests_script: Optional[str] = conformance_tests_script self.prepare_environment_script: Optional[str] = prepare_environment_script + self.state_machine_version = state_machine_version # Initialize state handlers self._state_handlers: dict[str, StateHandler] = { @@ -175,7 +177,7 @@ def compose(self) -> ComposeResult: with Vertical(id=TUIComponents.DASHBOARD_VIEW.value): with VerticalScroll(): yield Static( - "[#FFFFFF]*codeplain[/#FFFFFF] [#888888](v0.5.0)[/#888888]\n", + f"[#FFFFFF]*codeplain[/#FFFFFF] [#888888](v{self.state_machine_version})[/#888888]\n", id="codeplain-header", classes="codeplain-header", ) From 8aa7b56cea674d1b354cdeee48f5f0601b9046bf Mon Sep 17 00:00:00 2001 From: kajaskerlj Date: Tue, 3 Feb 2026 10:41:21 +0100 Subject: [PATCH 5/6] Corrected the wording from FR to functionality --- render_machine/actions/render_functional_requirement.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/render_machine/actions/render_functional_requirement.py b/render_machine/actions/render_functional_requirement.py index 959620d..3bbc958 100644 --- a/render_machine/actions/render_functional_requirement.py +++ b/render_machine/actions/render_functional_requirement.py @@ -27,7 +27,7 @@ def execute(self, render_context: RenderContext, _previous_action_payload: Any | if render_context.verbose: msg = "-------------------------------------\n" msg += f"Module: {render_context.module_name}\n" - msg += f"Rendering functional requirement {render_context.frid_context.frid}" + msg += f"Rendering functionality {render_context.frid_context.frid}" if render_context.frid_context.functional_requirement_render_attempts > 1: msg += f", attempt number {render_context.frid_context.functional_requirement_render_attempts}/{MAX_CODE_GENERATION_RETRIES}." msg += f"\n{render_context.frid_context.functional_requirement_text}\n" From 4ebf27f20b83fbdda7ef9982be1c75c7c4b8dc44 Mon Sep 17 00:00:00 2001 From: kajaskerlj Date: Tue, 3 Feb 2026 10:46:20 +0100 Subject: [PATCH 6/6] Content and styling changes of the status titles --- tui/components.py | 40 +++++++++++++++++++++------------------- tui/styles.css | 26 +++++++++++++++++++------- 2 files changed, 40 insertions(+), 26 deletions(-) diff --git a/tui/components.py b/tui/components.py index 90ecca2..7a6d677 100644 --- a/tui/components.py +++ b/tui/components.py @@ -24,8 +24,8 @@ def compose(self): class ScriptOutputType(str, Enum): - UNIT_TEST_OUTPUT_TEXT = "Unit tests: " - CONFORMANCE_TEST_OUTPUT_TEXT = "Conformance tests: " + UNIT_TEST_OUTPUT_TEXT = "Unit tests output: " + CONFORMANCE_TEST_OUTPUT_TEXT = "Conformance tests output: " TESTING_ENVIRONMENT_OUTPUT_TEXT = "Testing environment preparation execution output: " @staticmethod @@ -260,8 +260,8 @@ def _refresh_content(self) -> None: def on_mount(self) -> None: """Initialize default labels on mount.""" - self.module_text = "module: " - self.functionality_text = "functionality:" + self.module_text = "Module: " + self.functionality_text = "Functionality:" self._refresh_content() def compose(self): @@ -326,7 +326,7 @@ def on_mount(self) -> None: self._refresh_content() def compose(self): - yield Static("latest test scripts", classes="test-scripts-title") + yield Static("testing status", classes="test-scripts-title") with Vertical(classes="test-scripts-box"): self.unit_widget = Static(self.unit_test_text, classes="test-script-row") self.conformance_widget = Static(self.conformance_test_text, classes="test-script-row") @@ -378,24 +378,26 @@ def on_mount(self) -> None: def compose(self): yield RenderingInfoBox() - yield ProgressItem( - self.IMPLEMENTING_FUNCTIONALITY_TEXT, - id=TUIComponents.FRID_PROGRESS_RENDER_FR.value, - ) - if self.unittests_script is not None: + yield Static("rendering status", classes="frid-state-machine-title") + with Vertical(classes="frid-state-machine-box"): yield ProgressItem( - self.UNIT_TEST_VALIDATION_TEXT, - id=TUIComponents.FRID_PROGRESS_UNIT_TEST.value, + self.IMPLEMENTING_FUNCTIONALITY_TEXT, + id=TUIComponents.FRID_PROGRESS_RENDER_FR.value, ) - yield ProgressItem( - self.REFACTORING_TEXT, - id=TUIComponents.FRID_PROGRESS_REFACTORING.value, - ) - if self.conformance_tests_script is not None: + if self.unittests_script is not None: + yield ProgressItem( + self.UNIT_TEST_VALIDATION_TEXT, + id=TUIComponents.FRID_PROGRESS_UNIT_TEST.value, + ) yield ProgressItem( - self.CONFORMANCE_TEST_VALIDATION_TEXT, - id=TUIComponents.FRID_PROGRESS_CONFORMANCE_TEST.value, + self.REFACTORING_TEXT, + id=TUIComponents.FRID_PROGRESS_REFACTORING.value, ) + if self.conformance_tests_script is not None: + yield ProgressItem( + self.CONFORMANCE_TEST_VALIDATION_TEXT, + id=TUIComponents.FRID_PROGRESS_CONFORMANCE_TEST.value, + ) class LogEntry(Vertical): diff --git a/tui/styles.css b/tui/styles.css index faf3af2..e0e99c4 100644 --- a/tui/styles.css +++ b/tui/styles.css @@ -7,7 +7,7 @@ Screen { margin: 0 2; } -/* Codeplain Header Box */ +/* Codeplain Header Box - *codeplain (version)*/ #codeplain-header { dock: top; margin: 1 0; @@ -53,15 +53,16 @@ We might need those at some point, so just commenting them out for now. height: auto; } -/* Rendering Info Box */ +/* Module Status */ RenderingInfoBox { height: auto; margin: 1 0; } +/* Module Status box border */ .rendering-info-box { height: auto; - border: solid #E0FF6E; + border: solid #888; padding: 0 1; } @@ -70,7 +71,12 @@ RenderingInfoBox { } .rendering-info-title { - color: #E0FF6E; + color: #888; + margin-bottom: 0; +} + +.frid-state-machine-title { + color: #888; margin-bottom: 0; } @@ -105,7 +111,6 @@ ProgressItem { } #frid-progress-header { - margin-bottom: 1; margin-left: 2; margin-right: 2; color: #FFF; @@ -122,21 +127,28 @@ TestScriptsContainer { height: auto; } +/* Latest script output container */ .test-scripts-box { height: auto; color: #888; - border: solid #E0FF6E; + border: solid #888; padding: 0 1; } .test-scripts-title { - color: #E0FF6E; + color: #888; margin-bottom: 0; } .test-script-row { color: #FFF; } + +/* State machine container border */ +.frid-state-machine-box { + border: solid #888; + padding: 0 1; +} #unit-test-script-output-widget, #conformance-tests-script-output-widget, #testing-environment-script-output-widget {