Repository navigation
Fix AttributeError in _edit_text: use Gimp.Unit.pixel() instead of Gimp.Unit.PIXEL on GIMP 3.2 - #59
tarikkircali-amg wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. WalkthroughThe ChangesText editing
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~2 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The font-size editing path now uses the compatible pixel-unit API, so no merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
In
_edit_text, the font-size branch passes the text unit asGimp.Unit.PIXEL:On the GIMP 3.2.6 Python (GObject Introspection) binding,
Gimp.Unitis an object type that has noPIXELattribute, so evaluatingGimp.Unit.PIXELraises:Python evaluates that argument before
set_propertyruns, so anyedit_textcall that sets a new font size fails every time on GIMP 3.2.The correct API is the function
Gimp.Unit.pixel(), which returns the pixelsGimp.Unitobject. The same file already uses this correct form when creating text layers (Gimp.TextLayer.new(..., Gimp.Unit.pixel())), so this line was simply inconsistent.Fix
One line:
Verification
_edit_text(gimp-text-layer-set-font-sizewithunit=Gimp.Unit.pixel(), font-size 42): the procedure returned SUCCESS and the text layer's actual font size read back as 42.0 pixels.python -m py_compile gimp-mcp-plugin.pypassed.git diff --checkpassed.Scope: 1 line changed (1 insertion, 1 deletion) in
gimp-mcp-plugin.py.Summary by CodeRabbit