-
Notifications
You must be signed in to change notification settings - Fork 11
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:cache_gui_files #236
fix:cache_gui_files #236
Conversation
companion to OpenVoiceOS/ovos-gui#53 and OpenVoiceOS/ovos-bus-client#120 this should be merged first as it does not require the others to work and does not break anything in the wild
WalkthroughThe changes focus on enhancing the Changes
Poem
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (2)
Files not reviewed due to no reviewable changes (1)
Additional comments not posted (1)
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
Outside diff range and nitpick comments (1)
ovos_workshop/skills/ovos.py (1)
2739-2762
: The_cache_gui_files
logic looks good! Consider a minor refactor to reduce nesting.The function correctly handles caching the skill's GUI resources, supporting both the new and old style directory structures. Removing the existing cache before copying new resources ensures the cache stays up to date.
To improve readability, consider extracting the cache copying logic into a separate function to reduce nesting:
def _copy_gui_files(self, base_dir, output_dir): # backwards compat - TODO update once we support more than QT5 if os.path.isdir(f"{base_dir}/qt5"): # new style, multi GUI frameworks supported shutil.copytree(base_dir, output_dir) else: # old style, QT5 only LOG.warning(f"GUI resources moved to platform specific subfolder, " f"please move contents from {base_dir} to 'qt5' subfolder") shutil.copytree(base_dir, f"{output_dir}/qt5") def _cache_gui_files(self): base = f"{self._skill.root_dir}/ui" if not os.path.isdir(base): LOG.debug(f"{self.skill_id} has no GUI resources: {base}") return GUI_CACHE_PATH = get_xdg_cache_save_path('ovos_gui') output_path = f"{GUI_CACHE_PATH}/{self.skill_id}" if os.path.exists(output_path): LOG.info(f"Removing existing {self.skill_id} cached GUI resources before updating") shutil.rmtree(output_path) self._copy_gui_files(base, output_path) LOG.debug(f"Copied {self.skill_id} resources from {base} to {output_path}")
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- ovos_workshop/skills/ovos.py (5 hunks)
Additional context used
Ruff
ovos_workshop/skills/ovos.py
2735-2735: Do not use bare
except
(E722)
companion to OpenVoiceOS/ovos-gui#53 and OpenVoiceOS/ovos-bus-client#120 this should be merged first as it does not require the others to work and does not break anything in the wild
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #236 +/- ##
==========================================
- Coverage 53.41% 49.09% -4.32%
==========================================
Files 37 37
Lines 4362 4379 +17
==========================================
- Hits 2330 2150 -180
- Misses 2032 2229 +197 ☔ View full report in Codecov by Sentry. |
doing it under bus-client while keeping compat instead |
companion to OpenVoiceOS/ovos-gui#53 and OpenVoiceOS/ovos-bus-client#120
this should be merged first as it does not require the others to work and does not break anything in the wild
Summary by CodeRabbit
New Features
Bug Fixes
ovos_bus_client
dependency to allow for newer features and bug fixes.Chores