Skip to content

Commit 0bced8d

Browse files
committed
refactor: rename Point to Points and update related references in length and table modules
1 parent 2956649 commit 0bced8d

File tree

7 files changed

+300
-125
lines changed

7 files changed

+300
-125
lines changed

src/tppt/_tppt/__init__.py

Whitespace-only changes.

src/tppt/_utils/__init__.py

Whitespace-only changes.

src/tppt/pptx/converter.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@
44

55
from pptx.dml.color import RGBColor as PptxRGBColor
66
from pptx.util import Cm as PptxCm
7+
from pptx.util import Emu as PptxEmu
78
from pptx.util import Inches as PptxInches
89
from pptx.util import Length as PptxLength
10+
from pptx.util import Mm as PptxMm
911
from pptx.util import Pt as PptxPt
1012

1113
from tppt.types._color import Color, LiteralColor, to_color
1214
from tppt.types._length import (
13-
Centimeter,
14-
Inch,
15+
Centimeters,
16+
EnglishMetricUnits,
17+
Inchs,
1518
Length,
1619
LiteralLength,
17-
Point,
20+
Millimeters,
21+
Points,
1822
to_length,
1923
)
2024

@@ -48,24 +52,31 @@ def to_pptx_length(length: Length | LiteralLength | None) -> PptxLength | None:
4852
length = to_length(length)
4953

5054
match length:
51-
case Inch():
55+
case Inchs():
5256
return PptxInches(length.value)
53-
case Centimeter():
57+
case Centimeters():
5458
return PptxCm(length.value)
55-
case Point():
59+
case Points():
5660
return PptxPt(length.value)
61+
case Millimeters():
62+
return PptxMm(length.value)
63+
case EnglishMetricUnits():
64+
return PptxEmu(length.value)
5765
case None:
5866
return None
5967
case _:
6068
assert_never(length)
6169

70+
6271
def to_tppt_length(length: PptxLength) -> Length:
6372
return to_length((length.cm, "cm"))
6473

74+
6575
def to_pptx_color(color: Color | LiteralColor) -> PptxRGBColor:
6676
color = to_color(color)
6777

6878
return PptxRGBColor(color.r, color.g, color.b)
6979

80+
7081
def to_tppt_color(color: PptxRGBColor) -> Color:
7182
return Color(*color)

src/tppt/pptx/shape/table.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
PolarsDataFrame,
1313
PolarsLazyFrame,
1414
)
15-
from tppt.types._length import LiteralPoint, Point
15+
from tppt.types._length import LiteralPoint, Points
1616

1717
from ..converter import to_pptx_length
1818
from . import RangeProps, Shape
@@ -30,7 +30,7 @@ class TableCellStyle(TypedDict):
3030
vertical_align: NotRequired[Literal["top", "middle", "bottom"]]
3131
bold: NotRequired[bool]
3232
italic: NotRequired[bool]
33-
font_size: NotRequired[Point | LiteralPoint]
33+
font_size: NotRequired[Points | LiteralPoint]
3434
font_name: NotRequired[str]
3535

3636

src/tppt/types/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
LiteralLength as LiteralLength,
1717
)
1818
from ._length import (
19-
Point as Point,
19+
Points as Points,
2020
)
2121
from ._length import (
2222
to_length as to_length,

0 commit comments

Comments
 (0)