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

fix:examples_visibility #109

Merged
merged 10 commits into from
Nov 14, 2024
Merged

fix:examples_visibility #109

merged 10 commits into from
Nov 14, 2024

Conversation

JarbasAl
Copy link
Member

@JarbasAl JarbasAl commented Sep 10, 2024

dont render the icon + empty text quotes if no skill examples are available

Related: #128

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced error handling for homescreen updates, ensuring better stability.
    • Improved logic for managing skill examples, now disabling the feature if the API is unavailable.
  • Bug Fixes

    • Adjusted visibility conditions for example displays, ensuring they reflect the correct state based on user settings.
  • Chores

    • Updated resource directory references in the setup configuration for better resource management.
    • Removed outdated scripts related to locale migration and skill store preparation.

Copy link

coderabbitai bot commented Sep 10, 2024

Walkthrough

The pull request introduces significant modifications to the OVOSHomescreenSkill class, enhancing error handling and refining logic for managing skill examples. The handle_idle method now includes error logging for specific updates, while the update_examples method has been restructured to handle the absence of the skill_info_api. Changes in the QML files simplify how example visibility is managed, directly linking it to idleRoot.examplesEnabled. Additionally, the setup.py file has been updated to change resource directory names.

Changes

File Change Summary
__init__.py Enhanced error handling in handle_idle and restructured update_examples logic for better clarity.
gui/qt5/BottomWidgetsArea.qml Removed examplesDisplayEnabled; visibility now directly tied to idleRoot.examplesEnabled.
gui/qt5/ExamplesDisplay.qml Removed examplesPrefix property; updated Label visibility based on idleRoot.examplesEnabled.
gui/qt5/idle.qml Updated examplesEnabled logic to set it to false when sessionData.skill_info_enabled is truthy.
setup.py Changed resource_base_dirs from "ui" to "gui" in find_resource_files function.
MANIFEST.in Removed recursive inclusion of ui directory and added recursive inclusion of gui directory.
scripts/migrate_locale.py Deleted script for migrating locale files from vocab and dialog directories.
scripts/prepare_skillstore.py Deleted script for managing skill entries from a GitHub repository.
scripts/prepare_translations.py Deleted script for processing localization files for different languages.
scripts/translate.py Deleted script for translating text files using the LibreTranslate API.

Possibly related issues

Possibly related PRs

  • fix:droplf #124: The changes in the OVOSHomescreenSkill class in both PRs involve modifications to methods that enhance error handling and update logic, particularly in the update_dt method, which is related to the overall functionality of the homescreen skill.

Poem

🐰 In the meadow where skills do play,
Errors handled in a graceful way.
Examples now shine, bright and clear,
With each change, we bring good cheer!
So hop along, let’s celebrate,
A homescreen skill that’s truly great! 🌼

Warning

Rate limit exceeded

@JarbasAl has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 9 minutes and 22 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between fa60817 and 9240deb.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@JarbasAl JarbasAl marked this pull request as ready for review November 14, 2024 14:14
@github-actions github-actions bot added the fix label Nov 14, 2024
@github-actions github-actions bot added fix and removed fix labels Nov 14, 2024
Copy link

@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: 3

🧹 Outside diff range and nitpick comments (2)
gui/qt5/idle.qml (1)

Line range hint 19-19: Verify text model behavior with disabled examples

The textModel updates and timer continue to run even when examples are disabled. Consider optimizing by conditionally running the timer only when examples are enabled:

    onTextModelChanged: {
+       if (!idleRoot.examplesEnabled) {
+           return;
+       }
        exampleEntry = idleRoot.textModel[0] ? idleRoot.textModel[0] : ""
        exampleEntryUpdate(exampleEntry)
        textTimer.running = true
    }

    onVisibleChanged: {
-       if(visible && idleRoot.textModel){
+       if(visible && idleRoot.textModel && idleRoot.examplesEnabled){
            textTimer.running = true
        }
    }

Also applies to: 142-152

__init__.py (1)

201-214: Improved example management with better error handling!

The changes effectively handle cases where examples are not available and prevent displaying empty quotes, which aligns with the PR objective.

However, the warning message could be formatted better for readability.

Consider this improvement:

-            LOG.warning("NOT IMPLEMENTED ERROR: utterance examples enabled in settings.json but not yet implemented! "
-                        "use an external skill_id via 'examples_skill' setting as an alternative")
+            LOG.warning(
+                "NOT IMPLEMENTED ERROR: utterance examples enabled in settings.json "
+                "but not yet implemented! Use an external skill_id via "
+                "'examples_skill' setting as an alternative"
+            )
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 7ff51ff and fa60817.

⛔ Files ignored due to path filters (40)
  • gui/qt5/icons/alarmicon.svg is excluded by !**/*.svg
  • gui/qt5/icons/cam.svg is excluded by !**/*.svg
  • gui/qt5/icons/clear.svg is excluded by !**/*.svg
  • gui/qt5/icons/close.svg is excluded by !**/*.svg
  • gui/qt5/icons/clouds.svg is excluded by !**/*.svg
  • gui/qt5/icons/delete.svg is excluded by !**/*.svg
  • gui/qt5/icons/dialog-close.svg is excluded by !**/*.svg
  • gui/qt5/icons/down.svg is excluded by !**/*.svg
  • gui/qt5/icons/fog.svg is excluded by !**/*.svg
  • gui/qt5/icons/high_temperature.svg is excluded by !**/*.svg
  • gui/qt5/icons/humidity.svg is excluded by !**/*.svg
  • gui/qt5/icons/low_temperature.svg is excluded by !**/*.svg
  • gui/qt5/icons/mic-min.svg is excluded by !**/*.svg
  • gui/qt5/icons/mic-start.svg is excluded by !**/*.svg
  • gui/qt5/icons/mic.svg is excluded by !**/*.svg
  • gui/qt5/icons/moon.svg is excluded by !**/*.svg
  • gui/qt5/icons/no-internet.svg is excluded by !**/*.svg
  • gui/qt5/icons/notification-icon.svg is excluded by !**/*.svg
  • gui/qt5/icons/notificationicon.svg is excluded by !**/*.svg
  • gui/qt5/icons/offline_layer_one.svg is excluded by !**/*.svg
  • gui/qt5/icons/offline_layer_two.svg is excluded by !**/*.svg
  • gui/qt5/icons/partial_clouds.svg is excluded by !**/*.svg
  • gui/qt5/icons/partial_clouds_day.svg is excluded by !**/*.svg
  • gui/qt5/icons/partial_clouds_night.svg is excluded by !**/*.svg
  • gui/qt5/icons/rain.svg is excluded by !**/*.svg
  • gui/qt5/icons/snow.svg is excluded by !**/*.svg
  • gui/qt5/icons/storm.svg is excluded by !**/*.svg
  • gui/qt5/icons/sun.svg is excluded by !**/*.svg
  • gui/qt5/icons/sunrise.svg is excluded by !**/*.svg
  • gui/qt5/icons/sunset.svg is excluded by !**/*.svg
  • gui/qt5/icons/timericon.svg is excluded by !**/*.svg
  • gui/qt5/icons/wind.svg is excluded by !**/*.svg
  • gui/qt5/sounds/clicked.wav is excluded by !**/*.wav
  • gui/qt5/sounds/start-listening.wav is excluded by !**/*.wav
  • gui/qt5/wallpapers/background-01.png is excluded by !**/*.png
  • gui/qt5/wallpapers/background-02.png is excluded by !**/*.png
  • gui/qt5/wallpapers/background-03.png is excluded by !**/*.png
  • gui/qt5/wallpapers/background-04.png is excluded by !**/*.png
  • gui/qt5/wallpapers/background-05.png is excluded by !**/*.png
  • gui/qt5/wallpapers/default.jpg is excluded by !**/*.jpg
📒 Files selected for processing (5)
  • __init__.py (2 hunks)
  • gui/qt5/BottomWidgetsArea.qml (2 hunks)
  • gui/qt5/ExamplesDisplay.qml (1 hunks)
  • gui/qt5/idle.qml (1 hunks)
  • setup.py (1 hunks)
🔇 Additional comments (4)
gui/qt5/ExamplesDisplay.qml (1)

Line range hint 29-30: LGTM: Icon visibility properly synchronized

The icon visibility is correctly tied to idleRoot.examplesEnabled, ensuring consistent visibility state with the example text.

gui/qt5/idle.qml (1)

23-23: LGTM: Property change aligns with PR objectives

The change to examplesEnabled property ensures examples are disabled by default (when skill_info_enabled is falsy), which aligns with the PR objective of not rendering icons with empty text quotes.

Let's verify the impact on related components:

✅ Verification successful

Property change affects multiple UI components - needs attention

The change to examplesEnabled property impacts visibility in several components:

  • ExamplesDisplay.qml: Two visibility bindings
  • BottomWidgetsArea.qml: Both visibility and enabled states are affected

Property change is safe and consistent with UI behavior

The change to examplesEnabled property is well-integrated with the UI components:

  • In ExamplesDisplay.qml, it controls visibility of example text and icon, which should be hidden when skill_info_enabled is falsy
  • In BottomWidgetsArea.qml, it properly handles widget visibility in conjunction with media widget state
  • The default false state aligns with the text model handling in idle.qml where examples are only shown when valid content exists
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for components that might be affected by examplesEnabled property

# Search for components using examplesEnabled
rg "examplesEnabled" --type qml

# Search for components handling example visibility
rg "visible.*example" --type qml

Length of output: 820


Script:

#!/bin/bash
# Let's check the actual usage context in these files
echo "=== ExamplesDisplay.qml ==="
rg -A 5 "visible: idleRoot.examplesEnabled" gui/qt5/ExamplesDisplay.qml

echo -e "\n=== BottomWidgetsArea.qml ==="
rg -A 5 "visible: idleRoot.examplesEnabled" gui/qt5/BottomWidgetsArea.qml

# Also check if there are any other properties depending on examples state
echo -e "\n=== Other example-related properties ==="
rg "example" --type qml

Length of output: 3485

__init__.py (2)

179-190: Well-structured error handling implementation!

The addition of separate try-except blocks for each update operation is a good practice. This ensures that failures in one update don't prevent others from executing, improving the homescreen's resilience.


209-213: Verify QML handling of example visibility

Let's ensure the QML files correctly handle the visibility states based on skill_info_enabled.

✅ Verification successful

QML files correctly handle example visibility states

The verification confirms proper handling of skill_info_enabled in the QML files:

  • idle.qml correctly binds the Python property to examplesEnabled
  • ExamplesDisplay.qml uses examplesEnabled to control visibility of example text and icons
  • BottomWidgetsArea.qml properly handles example visibility in the widget area

The QML implementation aligns with the Python changes, using the skill_info_enabled state to toggle example visibility.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for QML files handling example visibility
rg -t qml "skill_info_enabled|examples" -A 5

Length of output: 4410

gui/qt5/BottomWidgetsArea.qml Show resolved Hide resolved
gui/qt5/ExamplesDisplay.qml Show resolved Hide resolved
setup.py Show resolved Hide resolved
Copy link

@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: 0

🧹 Outside diff range and nitpick comments (1)
__init__.py (1)

205-206: Consider improving the warning message format.

The warning message could be more concise and clearer.

-            LOG.warning("NOT IMPLEMENTED ERROR: utterance examples enabled in settings.json but not yet implemented! "
-                        "use an external skill_id via 'examples_skill' setting as an alternative")
+            LOG.warning("Examples enabled in settings.json but skill_info_api not implemented. "
+                       "Use 'examples_skill' setting to specify an external skill.")
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between fa60817 and 9240deb.

📒 Files selected for processing (7)
  • MANIFEST.in (1 hunks)
  • __init__.py (3 hunks)
  • gui/qt5/idle.qml (2 hunks)
  • scripts/migrate_locale.py (0 hunks)
  • scripts/prepare_skillstore.py (0 hunks)
  • scripts/prepare_translations.py (0 hunks)
  • scripts/translate.py (0 hunks)
💤 Files with no reviewable changes (4)
  • scripts/migrate_locale.py
  • scripts/prepare_skillstore.py
  • scripts/prepare_translations.py
  • scripts/translate.py
✅ Files skipped from review due to trivial changes (1)
  • MANIFEST.in
🚧 Files skipped from review as they are similar to previous changes (1)
  • gui/qt5/idle.qml
🔇 Additional comments (2)
__init__.py (2)

179-190: LGTM! Well-structured error handling.

The addition of individual try-except blocks for each update operation improves robustness by:

  • Preventing cascading failures
  • Providing specific error context
  • Allowing the homescreen to remain functional even if one component fails

201-211: LGTM! Improved example handling logic.

The changes effectively address the PR objective by:

  • Initializing examples as empty by default
  • Only showing examples when actually available
  • Properly handling the case when skill_info_api is unavailable

@JarbasAl JarbasAl merged commit e52589b into dev Nov 14, 2024
10 of 11 checks passed
@JarbasAl JarbasAl deleted the fixvisibility branch November 14, 2024 14:47
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