Guard Pillow-dependent features - #247
Conversation
There was a problem hiding this comment.
💡 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
| 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) |
There was a problem hiding this comment.
[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 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_68dbe9cc3a30832c954f15d561ceee71