Skip to content

Guard Pillow-dependent features - #247

Merged
PedroBMR merged 1 commit into
mainfrom
codex/add-pillow-import-handling-and-documentation-5f3101
Sep 30, 2025
Merged

Guard Pillow-dependent features#247
PedroBMR merged 1 commit into
mainfrom
codex/add-pillow-import-handling-and-documentation-5f3101

Conversation

@PedroBMR

Copy link
Copy Markdown
Owner

Summary

  • guard Pillow imports across compilation, imaging, rendering, and UI modules and raise clear runtime errors when Pillow is unavailable
  • disable preview widgets and quick print previews when Pillow cannot be imported while keeping the application responsive
  • ensure Pillow-requiring tests skip gracefully when the library is missing and document the runtime limitation in the README

Testing

  • pytest -q

https://chatgpt.com/codex/tasks/task_e_68dbe9cc3a30832c954f15d561ceee71

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Comment thread editor/widget.py
Comment on lines +266 to 273
self._pillow_available = ImageQt is not None
if not self._pillow_available:
self.placeholder.setText(
"Pré-visualização indisponível: instale Pillow."
)
self.refresh_button.setEnabled(False)
self.metadata_label.setText("Pré-visualização desativada")
self._update_controls_enabled(False)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P1] Skip preview rendering when Pillow is unavailable

The new _pillow_available flag disables the preview controls when Pillow cannot be imported, but TemplateEditorWidget._perform_preview_update() still runs and unconditionally calls render_template. When Pillow is missing, that call triggers render.preview._require_pillow() and raises RuntimeError, so opening the editor still crashes despite the UI being disabled. Consider short‑circuiting update_preview/_perform_preview_update when _pillow_available is false so that no rendering is attempted without Pillow.

Useful? React with 👍 / 👎.

@PedroBMR
PedroBMR merged commit 29ef520 into main Sep 30, 2025
1 check failed
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