|
1 | | -from typing import Callable, Self |
| 1 | +from typing import Self |
2 | 2 |
|
3 | 3 | from pptx.enum.text import MSO_TEXT_UNDERLINE_TYPE |
4 | 4 | from pptx.text.text import Font as PptxFont |
5 | 5 |
|
6 | 6 | from tppt.pptx.converter import PptxConvertible, to_pptx_length, to_tppt_length |
7 | | -from tppt.pptx.dml.color import ColorFormat, ColorFormatBuilder |
8 | | -from tppt.types._length import Length, LiteralLength |
| 7 | +from tppt.pptx.dml.color import ColorFormat |
| 8 | +from tppt.types._length import Length |
9 | 9 |
|
10 | 10 |
|
11 | 11 | class Font(PptxConvertible[PptxFont]): |
@@ -60,54 +60,9 @@ def color(self) -> ColorFormat: |
60 | 60 | def color(self, color: ColorFormat) -> None: |
61 | 61 | self._pptx.color = color.to_pptx() |
62 | 62 |
|
63 | | - def builder(self) -> "FontBuilder": |
64 | | - return FontBuilder(self._pptx) |
65 | | - |
66 | 63 | def to_pptx(self) -> PptxFont: |
67 | 64 | return self._pptx |
68 | 65 |
|
69 | 66 | @classmethod |
70 | 67 | def from_pptx(cls, pptx_obj: PptxFont) -> Self: |
71 | 68 | return cls(pptx_obj) |
72 | | - |
73 | | - |
74 | | -class FontBuilder: |
75 | | - def __init__(self, pptx_obj: PptxFont) -> None: |
76 | | - self._pptx = pptx_obj |
77 | | - |
78 | | - def name(self, name: str) -> Self: |
79 | | - self._pptx.name = name |
80 | | - |
81 | | - return self |
82 | | - |
83 | | - def size(self, size: Length | LiteralLength) -> Self: |
84 | | - self._pptx.size = to_pptx_length(size) |
85 | | - |
86 | | - return self |
87 | | - |
88 | | - def bold(self, bold: bool) -> Self: |
89 | | - self._pptx.bold = bold |
90 | | - |
91 | | - return self |
92 | | - |
93 | | - def italic(self, italic: bool) -> Self: |
94 | | - self._pptx.italic = italic |
95 | | - |
96 | | - return self |
97 | | - |
98 | | - def underline(self, underline: bool | MSO_TEXT_UNDERLINE_TYPE) -> Self: |
99 | | - self._pptx.underline = underline |
100 | | - |
101 | | - return self |
102 | | - |
103 | | - def color( |
104 | | - self, callable: Callable[[ColorFormat], ColorFormat | ColorFormatBuilder] |
105 | | - ) -> Self: |
106 | | - color = callable(ColorFormat(self._pptx.color)) |
107 | | - if isinstance(color, ColorFormatBuilder): |
108 | | - color._build() |
109 | | - |
110 | | - return self |
111 | | - |
112 | | - def _build(self) -> Font: |
113 | | - return Font(self._pptx) |
0 commit comments