Skip to content

Guard Pillow-dependent features - #246

Open
PedroBMR wants to merge 1 commit into
mainfrom
codex/add-pillow-import-handling-and-documentation
Open

Guard Pillow-dependent features#246
PedroBMR wants to merge 1 commit into
mainfrom
codex/add-pillow-import-handling-and-documentation

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

Labels-App/editor/widget.py

Lines 578 to 582 in c3c686a

image = render_template(
backend_dict,
context,
calibration=self.scene.calibration,
)

[P1] Skip preview update when Pillow is unavailable

LabelEditorWidget._perform_preview_update calls render_template(...) unconditionally. When Pillow is not installed, the new guards in render.preview raise RuntimeError, so the editor still crashes during initialisation even though the UI disables preview controls when ImageQt is missing. Short-circuit this method or catch the exception when Pillow cannot be imported so the application can keep running without preview support.


result = render_element_image(
self._element,
context,
page,
calibration=calibration,

[P1] Guard element pixmap updates when Pillow is missing

GraphicsElementItem._update_pixmap calls render_element_image(...) before checking whether Pillow is available. Because the renderer now raises a RuntimeError when Pillow is absent, loading any document still blows up instead of falling back to the placeholder UI. The method should skip or handle pixmap generation when ImageQt (and therefore Pillow) is unavailable.

ℹ️ 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant