Skip to content

Update border_radius parameter type to float#492

Open
HU-Bro wants to merge 1 commit intopresenton:mainfrom
HU-Bro:patch-2
Open

Update border_radius parameter type to float#492
HU-Bro wants to merge 1 commit intopresenton:mainfrom
HU-Bro:patch-2

Conversation

@HU-Bro
Copy link
Copy Markdown

@HU-Bro HU-Bro commented Apr 3, 2026

Change border_radius type from int to float for better precision. This is part of fixing powerpoint export errors, together with

PptxAutoShapeBoxModel border_radius: Optional[int] = NoneOptional[float]

PptxPictureBoxModel border_radius: Optional[List[int]] = NoneOptional[List[float]]
https://github.com/presenton/presenton/tree/main/electron/servers/fastapi/services/pptx_presentation_creator.py apply_border_radius_to_shape(self, shape, border_radius: Optional[int])Optional[float]
https://github.com/presenton/presenton/tree/main/electron/servers/fastapi/utils/image_utils.py round_image_corners(image, radii: List[int])List[float]

Change border_radius type from int to float for better precision.
This is part of fixing powerpoint export errors, together with 

`PptxAutoShapeBoxModel` `border_radius: Optional[int] = None` → `Optional[float]`

PptxPictureBoxModel `border_radius: Optional[List[int]] = None` → `Optional[List[float]]`
 https://github.com/presenton/presenton/tree/main/electron/servers/fastapi/services/pptx_presentation_creator.py  `apply_border_radius_to_shape(self, shape, border_radius: Optional[int])` → `Optional[float]`
 https://github.com/presenton/presenton/tree/main/electron/servers/fastapi/utils/image_utils.py  `round_image_corners(image, radii: List[int])` → `List[float]`
Copilot AI review requested due to automatic review settings April 3, 2026 08:47
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 3, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to improve border radius precision for PowerPoint shape rendering by changing the border_radius type used when applying corner rounding to PPTX shapes.

Changes:

  • Updated apply_border_radius_to_shape(...) to accept border_radius: Optional[float] instead of Optional[int].

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +447 to 449
def apply_border_radius_to_shape(self, shape: Shape, border_radius: Optional[float]):
if not border_radius:
return
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

The method annotation was updated to Optional[float], but the source model still defines border_radius as Optional[int] and actively rounds floats to ints via validators (see electron/servers/fastapi/models/pptx_models.py around lines 131–142). As a result, float precision likely won’t reach this method, and the change doesn’t fully match the PR description (also applies to PptxPictureBoxModel.border_radius, which is still List[int]). Consider updating the Pydantic models/validators (and any image rounding helpers) to accept/store floats end-to-end, or revert this signature change if rounding-to-int is intentional.

Copilot uses AI. Check for mistakes.
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.

3 participants