Skip to content

refactor!: Deprecate EnclosureAPI and refactor GUIInterface with PageTemplates enum#197

Draft
JarbasAl wants to merge 4 commits intodevfrom
gui_depr
Draft

refactor!: Deprecate EnclosureAPI and refactor GUIInterface with PageTemplates enum#197
JarbasAl wants to merge 4 commits intodevfrom
gui_depr

Conversation

@JarbasAl
Copy link
Copy Markdown
Member

@JarbasAl JarbasAl commented Feb 3, 2026

Summary by CodeRabbit

  • Deprecations

    • EnclosureAPI marked for deprecation; functionality transitioning to platform-specific plugins with visual output managed through the updated UI framework.
  • Breaking Changes

    • GUI interface initialization refactored with parameter removal and method visibility adjustments.
  • New Features

    • Standardized template identifiers introduced for GUI pages, replacing string-based references with enumerated constants.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 3, 2026

📝 Walkthrough

Walkthrough

The GUI module undergoes significant refactoring: a new PageTemplates enum standardizes template names, replacing scattered string literals throughout the codebase. Several public GUI methods are converted to private variants. The ui_directories parameter is removed from initialization. The EnclosureAPI receives a deprecation notice.

Changes

Cohort / File(s) Summary
Deprecation Notice
ovos_bus_client/apis/enclosure.py
Added deprecation notice to EnclosureAPI class docstring indicating planned deprecation and migration to mk1-specific plugins with visual output moving to GUIInterface.
GUI Refactoring & Enum Introduction
ovos_bus_client/apis/gui.py
Introduced PageTemplates enum to standardize template names; converted public methods to private variants (show_page_show_page, remove_page_remove_page, etc.); removed ui_directories parameter and GUI file caching logic; updated return types to use PageTemplates instead of raw strings; removed show_input_box, remove_input_box, and _normalize_page_name; rerouted GUI interactions through enum-based page templates.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Templates now dance in ordered array,
Strings transformed to enums today!
Private methods hide what once was shown,
GUIInterface claims its throne.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 88.00% which is sufficient. The required threshold is 80.00%.
Title check ✅ Passed The title accurately summarizes the main changes: deprecating EnclosureAPI and refactoring GUIInterface with PageTemplates enum, which directly matches the content of the pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch gui_depr

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@JarbasAl JarbasAl marked this pull request as ready for review February 3, 2026 18:21
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
ovos_bus_client/apis/gui.py (1)

62-70: ⚠️ Potential issue | 🟡 Minor

Stale docstring references removed parameter.

Line 69 documents @param ui_directories but this parameter was removed from the signature. Remove the stale documentation.

📝 Proposed fix
         `@param` skill_id: ID of this interface
         `@param` bus: MessagebusClient object to connect to
         `@param` config: dict gui Configuration
-        `@param` ui_directories: dict framework to directory containing resources
         """
🤖 Fix all issues with AI agents
In `@ovos_bus_client/apis/gui.py`:
- Line 25: The WEATHER enum value is misspelled as "SYSTEm_weather"; update the
constant WEATHER to use the correct template name "SYSTEM_weather" so it matches
the naming convention used by other templates and avoids mismatches when the GUI
service looks up templates (locate the WEATHER symbol in
ovos_bus_client/apis/gui.py and replace the string value accordingly).
🧹 Nitpick comments (4)
ovos_bus_client/apis/gui.py (4)

62-62: Consider using explicit Optional for type hints.

Per PEP 484, use Optional[dict] or dict | None instead of implicit Optional when a parameter defaults to None.

♻️ Suggested change
     def __init__(self, skill_id: str, bus=None,
-                 config: dict = None):
+                 config: Optional[dict] = None):

133-138: Clarify or remove the TODO comment.

The return type is already List[PageTemplates] and self._pages is typed as such (line 75). The TODO comment "return PageTemplates.XXX" is unclear—if it's resolved, remove it; otherwise, clarify the intent.


276-279: Apply explicit Optional type hints consistently.

The override_idle parameter defaults to None but is typed as Union[bool, int]. Use Union[bool, int, None] or Optional[Union[bool, int]] for clarity.

♻️ Suggested change for both methods
-    def _show_page(self, name: PageTemplates,
-                   override_idle: Union[bool, int] = None,
+    def _show_page(self, name: PageTemplates,
+                   override_idle: Union[bool, int, None] = None,
-    def _show_pages(self, page_names: List[PageTemplates], index: int = 0,
-                    override_idle: Union[bool, int] = None,
+    def _show_pages(self, page_names: List[PageTemplates], index: int = 0,
+                    override_idle: Union[bool, int, None] = None,

Also applies to: 289-292


392-394: Same implicit Optional issue in show_loading_animation and other show_* methods.

For consistency with the fixes suggested above, update override_idle parameter types in all public show_* methods (show_loading_animation, show_status_animation, show_text, show_image, show_animated_image, show_html, show_url).

Comment thread ovos_bus_client/apis/gui.py Outdated
@JarbasAl JarbasAl marked this pull request as draft February 3, 2026 18:41
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@JarbasAl JarbasAl changed the title refactor!: GUI deprecation refactor!: Deprecate EnclosureAPI and refactor GUIInterface with PageTemplates enum Feb 3, 2026
@github-actions github-actions Bot added breaking and removed breaking labels Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant