drawlib 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of drawlib might be problematic. Click here for more details.
- drawlib/.pylintrc +2 -0
- drawlib/__init__.py +33 -0
- drawlib/__main__.py +21 -0
- drawlib/apis.py +22 -0
- drawlib/assets/__init__.py +8 -0
- drawlib/assets/v0_1/__init__.py +8 -0
- drawlib/assets/v0_1/fonticons/__init__.py +8 -0
- drawlib/assets/v0_1/fonts/__init__.py +8 -0
- drawlib/v0_1/__init__.py +31 -0
- drawlib/v0_1/__main__.py +20 -0
- drawlib/v0_1/apis.py +127 -0
- drawlib/v0_1/private/__init__.py +20 -0
- drawlib/v0_1/private/arg_validator.py +163 -0
- drawlib/v0_1/private/command.py +204 -0
- drawlib/v0_1/private/core/__init__.py +15 -0
- drawlib/v0_1/private/core/colors.py +285 -0
- drawlib/v0_1/private/core/dimage.py +510 -0
- drawlib/v0_1/private/core/fonts.py +324 -0
- drawlib/v0_1/private/core/model.py +1082 -0
- drawlib/v0_1/private/core/model_validator.py +175 -0
- drawlib/v0_1/private/core/theme.py +1042 -0
- drawlib/v0_1/private/core/util.py +809 -0
- drawlib/v0_1/private/core_canvas/__init__.py +15 -0
- drawlib/v0_1/private/core_canvas/base.py +653 -0
- drawlib/v0_1/private/core_canvas/canvas.py +88 -0
- drawlib/v0_1/private/core_canvas/image.py +154 -0
- drawlib/v0_1/private/core_canvas/line.py +263 -0
- drawlib/v0_1/private/core_canvas/original_arrow.py +139 -0
- drawlib/v0_1/private/core_canvas/original_polygon.py +584 -0
- drawlib/v0_1/private/core_canvas/patches.py +547 -0
- drawlib/v0_1/private/core_canvas/text.py +136 -0
- drawlib/v0_1/private/download.py +58 -0
- drawlib/v0_1/private/dutil.py +28 -0
- drawlib/v0_1/private/icons/__init__.py +15 -0
- drawlib/v0_1/private/icons/phosphor.py +35275 -0
- drawlib/v0_1/private/icons/util.py +82 -0
- drawlib/v0_1/private/logging.py +38 -0
- drawlib/v0_1/private/settings.py +233 -0
- drawlib/v0_1/private/smartarts/__init__.py +15 -0
- drawlib/v0_1/private/smartarts/cycle.py +11 -0
- drawlib/v0_1/private/smartarts/dsart.py +17 -0
- drawlib/v0_1/private/smartarts/groups.py +20 -0
- drawlib/v0_1/private/smartarts/pyramid.py +18 -0
- drawlib/v0_1/private/smartarts/sourcecode.py +216 -0
- drawlib/v0_1/private/smartarts/table.py +11 -0
- drawlib/v0_1/private/smartarts/tree.py +18 -0
- drawlib/v0_1/private/tools.py +161 -0
- drawlib/v0_1/private/util.py +353 -0
- drawlib-0.1.1.dist-info/LICENSE.txt +202 -0
- drawlib-0.1.1.dist-info/METADATA +36 -0
- drawlib-0.1.1.dist-info/RECORD +52 -0
- drawlib-0.1.1.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,1082 @@
|
|
|
1
|
+
# Copyright (c) 2024 Yuichi Ito (yuichi@yuichi.com)
|
|
2
|
+
#
|
|
3
|
+
# This software is licensed under the Apache License, Version 2.0.
|
|
4
|
+
# For more information, please visit: https://github.com/yuichi110/drawlib
|
|
5
|
+
#
|
|
6
|
+
# This software is provided "as is", without warranty of any kind,
|
|
7
|
+
# express or implied, including but not limited to the warranties of
|
|
8
|
+
# merchantability, fitness for a particular purpose and noninfringement.
|
|
9
|
+
|
|
10
|
+
"""Wrapper of matplotlib drawing object style
|
|
11
|
+
|
|
12
|
+
This module contains drawlib's style classes.
|
|
13
|
+
They provide consistent style setting ways for line/text/shapes.
|
|
14
|
+
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
# pylint: disable=too-many-instance-attributes
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
#
|
|
21
|
+
# Please don't use external data classes such as pydantic.
|
|
22
|
+
# Use property for validation
|
|
23
|
+
#
|
|
24
|
+
|
|
25
|
+
import dataclasses
|
|
26
|
+
from typing import (
|
|
27
|
+
Union,
|
|
28
|
+
Optional,
|
|
29
|
+
Tuple,
|
|
30
|
+
Literal,
|
|
31
|
+
Final,
|
|
32
|
+
)
|
|
33
|
+
from drawlib.v0_1.private.core.fonts import (
|
|
34
|
+
Font,
|
|
35
|
+
FontArabic,
|
|
36
|
+
FontBase,
|
|
37
|
+
FontSerif,
|
|
38
|
+
FontSanSerif,
|
|
39
|
+
FontChinese,
|
|
40
|
+
FontJapanese,
|
|
41
|
+
FontKorean,
|
|
42
|
+
FontMonoSpace,
|
|
43
|
+
FontRoboto,
|
|
44
|
+
FontSourceCode,
|
|
45
|
+
FontFile,
|
|
46
|
+
)
|
|
47
|
+
from drawlib.v0_1.private.core.model_validator import (
|
|
48
|
+
ColorValidator,
|
|
49
|
+
AlignValidator,
|
|
50
|
+
LineValidator,
|
|
51
|
+
TextValidator,
|
|
52
|
+
CoordinateValidator,
|
|
53
|
+
)
|
|
54
|
+
from drawlib.v0_1.private.core.colors import Colors
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class IconStyleDefault:
|
|
58
|
+
"""default value of IconStyle."""
|
|
59
|
+
|
|
60
|
+
style: Final[str] = "thin"
|
|
61
|
+
color: Final[Tuple[int, int, int]] = Colors.Black
|
|
62
|
+
alpha: Final[None] = None
|
|
63
|
+
haligh: Final[str] = "center"
|
|
64
|
+
valign: Final[str] = "center"
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@dataclasses.dataclass
|
|
68
|
+
class IconStyle:
|
|
69
|
+
"""drawlib image style dataclass."""
|
|
70
|
+
|
|
71
|
+
style: Optional[Literal["thin", "light", "regular", "bold", "fill"]] = None
|
|
72
|
+
color: Union[Tuple[int, int, int], Tuple[int, int, int, float], None] = None
|
|
73
|
+
alpha: Optional[float] = None
|
|
74
|
+
halign: Optional[Literal["left", "center", "right"]] = None
|
|
75
|
+
valign: Optional[Literal["bottom", "center", "top"]] = None
|
|
76
|
+
|
|
77
|
+
@property # type: ignore[no-redef]
|
|
78
|
+
def style(self) -> Optional[str]:
|
|
79
|
+
"""getter of style"""
|
|
80
|
+
return getattr(self, "_style", None)
|
|
81
|
+
|
|
82
|
+
@style.setter
|
|
83
|
+
def style(self, value: Optional[str]) -> None:
|
|
84
|
+
"""setter of style"""
|
|
85
|
+
if isinstance(value, property) or value is None:
|
|
86
|
+
self._style = None
|
|
87
|
+
return
|
|
88
|
+
|
|
89
|
+
if value not in ["thin", "light", "regular", "bold", "fill"]:
|
|
90
|
+
raise ValueError(f'IconStyle.style does not support "{value}".')
|
|
91
|
+
self._style = value
|
|
92
|
+
|
|
93
|
+
@property # type: ignore[no-redef]
|
|
94
|
+
def color(self) -> Union[Tuple[int, int, int], Tuple[int, int, int, float], None]:
|
|
95
|
+
"""getter of color"""
|
|
96
|
+
return self._color
|
|
97
|
+
|
|
98
|
+
@color.setter
|
|
99
|
+
def color(self, value: Union[Tuple[int, int, int], Tuple[int, int, int, float], None]) -> None:
|
|
100
|
+
"""setter of style"""
|
|
101
|
+
if isinstance(value, property) or value is None:
|
|
102
|
+
self._color = None
|
|
103
|
+
return
|
|
104
|
+
|
|
105
|
+
ColorValidator.validate_color(value)
|
|
106
|
+
self._color = value
|
|
107
|
+
|
|
108
|
+
@property # type: ignore[no-redef]
|
|
109
|
+
def alpha(self) -> Optional[float]:
|
|
110
|
+
"""getter of alpha"""
|
|
111
|
+
return self._alpha
|
|
112
|
+
|
|
113
|
+
@alpha.setter
|
|
114
|
+
def alpha(self, value: Optional[float]) -> None:
|
|
115
|
+
"""setter of alpha"""
|
|
116
|
+
if isinstance(value, property) or value is None:
|
|
117
|
+
self._alpha = None
|
|
118
|
+
return
|
|
119
|
+
|
|
120
|
+
ColorValidator.validate_alpha(value)
|
|
121
|
+
self._alpha = value
|
|
122
|
+
|
|
123
|
+
@property # type: ignore[no-redef]
|
|
124
|
+
def halign(self) -> Optional[str]:
|
|
125
|
+
"""getter of halign"""
|
|
126
|
+
return self._halign
|
|
127
|
+
|
|
128
|
+
@halign.setter
|
|
129
|
+
def halign(self, value: Optional[Literal["left", "center", "right"]]) -> None:
|
|
130
|
+
"""setter of halign"""
|
|
131
|
+
if isinstance(value, property) or value is None:
|
|
132
|
+
self._halign = None
|
|
133
|
+
return
|
|
134
|
+
|
|
135
|
+
AlignValidator.validate_halign(value)
|
|
136
|
+
self._halign = value
|
|
137
|
+
|
|
138
|
+
@property # type: ignore[no-redef]
|
|
139
|
+
def valign(self) -> Optional[str]:
|
|
140
|
+
"""getter of valign"""
|
|
141
|
+
return self._valign
|
|
142
|
+
|
|
143
|
+
@valign.setter
|
|
144
|
+
def valign(self, value: Optional[Literal["bottom", "center", "top"]]) -> None:
|
|
145
|
+
"""setter of valign"""
|
|
146
|
+
if isinstance(value, property) or value is None:
|
|
147
|
+
self._valign = None
|
|
148
|
+
return
|
|
149
|
+
|
|
150
|
+
AlignValidator.validate_valign(value)
|
|
151
|
+
self._valign = value
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
class ImageStyleDefault:
|
|
155
|
+
lstyle: Final[str] = "thin"
|
|
156
|
+
lcolor: Final[Tuple[int, int, int]] = Colors.Black
|
|
157
|
+
lwidth: Final[float] = 0
|
|
158
|
+
halign: Final[str] = "center"
|
|
159
|
+
valign: Final[str] = "center"
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
@dataclasses.dataclass
|
|
163
|
+
class ImageStyle:
|
|
164
|
+
"""drawlib image style dataclass."""
|
|
165
|
+
|
|
166
|
+
halign: Optional[Literal["left", "center", "right"]] = None
|
|
167
|
+
valign: Optional[Literal["bottom", "center", "top"]] = None
|
|
168
|
+
lwidth: Optional[float] = None
|
|
169
|
+
lstyle: Optional[Literal["solid", "dashed", "dotted", "dashdot"]] = None
|
|
170
|
+
lcolor: Union[Tuple[int, int, int], Tuple[int, int, int, float], None] = None
|
|
171
|
+
|
|
172
|
+
@property # type: ignore[no-redef]
|
|
173
|
+
def halign(self) -> Optional[str]:
|
|
174
|
+
"""getter of halign"""
|
|
175
|
+
return self._halign
|
|
176
|
+
|
|
177
|
+
@halign.setter
|
|
178
|
+
def halign(self, value: Optional[Literal["left", "center", "right"]]) -> None:
|
|
179
|
+
"""setter of halign"""
|
|
180
|
+
if isinstance(value, property) or value is None:
|
|
181
|
+
self._halign = None
|
|
182
|
+
return
|
|
183
|
+
|
|
184
|
+
AlignValidator.validate_halign(value)
|
|
185
|
+
self._halign = value
|
|
186
|
+
|
|
187
|
+
@property # type: ignore[no-redef]
|
|
188
|
+
def valign(self) -> Optional[str]:
|
|
189
|
+
"""getter of valign"""
|
|
190
|
+
return self._valign
|
|
191
|
+
|
|
192
|
+
@valign.setter
|
|
193
|
+
def valign(self, value: Optional[Literal["bottom", "center", "top"]]) -> None:
|
|
194
|
+
"""setter of valign"""
|
|
195
|
+
if isinstance(value, property) or value is None:
|
|
196
|
+
self._valign = None
|
|
197
|
+
return
|
|
198
|
+
|
|
199
|
+
AlignValidator.validate_valign(value)
|
|
200
|
+
self._valign = value
|
|
201
|
+
|
|
202
|
+
@property # type: ignore[no-redef]
|
|
203
|
+
def lwidth(self) -> Optional[float]:
|
|
204
|
+
"""getter of lwidth"""
|
|
205
|
+
return self._lwidth
|
|
206
|
+
|
|
207
|
+
@lwidth.setter
|
|
208
|
+
def lwidth(self, value: Optional[float]) -> None:
|
|
209
|
+
"""setter of lwidth"""
|
|
210
|
+
if isinstance(value, property) or value is None:
|
|
211
|
+
self._lwidth = None
|
|
212
|
+
return
|
|
213
|
+
|
|
214
|
+
LineValidator.validate_width(value)
|
|
215
|
+
self._lwidth = value
|
|
216
|
+
|
|
217
|
+
@property # type: ignore[no-redef]
|
|
218
|
+
def lstyle(self) -> Optional[str]:
|
|
219
|
+
"""getter of lstyle"""
|
|
220
|
+
return self._lstyle
|
|
221
|
+
|
|
222
|
+
@lstyle.setter
|
|
223
|
+
def lstyle(self, value: Optional[str]) -> None:
|
|
224
|
+
"""setter of lstyle"""
|
|
225
|
+
if isinstance(value, property) or value is None:
|
|
226
|
+
self._lstyle = None
|
|
227
|
+
return
|
|
228
|
+
|
|
229
|
+
LineValidator.validate_style(value)
|
|
230
|
+
self._lstyle = value
|
|
231
|
+
|
|
232
|
+
@property # type: ignore[no-redef]
|
|
233
|
+
def lcolor(self) -> Union[Tuple[int, int, int], Tuple[int, int, int, float], None]:
|
|
234
|
+
"""getter of lcolor"""
|
|
235
|
+
return self._lcolor
|
|
236
|
+
|
|
237
|
+
@lcolor.setter
|
|
238
|
+
def lcolor(self, value: Union[Tuple[int, int, int], Tuple[int, int, int, float], None]) -> None:
|
|
239
|
+
"""setter of lcolor"""
|
|
240
|
+
if isinstance(value, property) or value is None:
|
|
241
|
+
self._lcolor = None
|
|
242
|
+
return
|
|
243
|
+
|
|
244
|
+
ColorValidator.validate_color(value)
|
|
245
|
+
self._lcolor = value
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
class LineStyleDefault:
|
|
249
|
+
width: Final[float] = 1.0
|
|
250
|
+
style: Final[str] = "solid"
|
|
251
|
+
color: Final[Tuple[int, int, int]] = Colors.Black
|
|
252
|
+
alpha: Final[None] = None
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
@dataclasses.dataclass
|
|
256
|
+
class LineStyle:
|
|
257
|
+
"""drawlib line style dataclass.
|
|
258
|
+
|
|
259
|
+
Instead of providing lots of style parameters to drawing line
|
|
260
|
+
functions ``line()`` etc,
|
|
261
|
+
user set line style to line this way.
|
|
262
|
+
|
|
263
|
+
1. Provide line style settings to ``LineStyle``.
|
|
264
|
+
2. Provide the style instance to functions which uses line style.
|
|
265
|
+
3. Line style is applied to drawn lines.
|
|
266
|
+
|
|
267
|
+
It is easy for managing line styles and applying them to lots of texts.
|
|
268
|
+
|
|
269
|
+
Note:
|
|
270
|
+
Line style of shapes are configured at ``ShapeStyle``.
|
|
271
|
+
|
|
272
|
+
"""
|
|
273
|
+
|
|
274
|
+
width: Optional[float] = None
|
|
275
|
+
style: Optional[Literal["solid", "dashed", "dotted", "dashdot"]] = None
|
|
276
|
+
color: Union[Tuple[int, int, int], Tuple[int, int, int, float], None] = None
|
|
277
|
+
alpha: Optional[None] = None
|
|
278
|
+
|
|
279
|
+
@property # type: ignore[no-redef]
|
|
280
|
+
def width(self) -> Optional[float]:
|
|
281
|
+
"""getter of width"""
|
|
282
|
+
return self._width
|
|
283
|
+
|
|
284
|
+
@width.setter
|
|
285
|
+
def width(self, value: Optional[float]) -> None:
|
|
286
|
+
"""setter of style"""
|
|
287
|
+
if isinstance(value, property) or value is None:
|
|
288
|
+
self._width = None
|
|
289
|
+
return
|
|
290
|
+
|
|
291
|
+
LineValidator.validate_width(value)
|
|
292
|
+
self._width = value
|
|
293
|
+
|
|
294
|
+
@property # type: ignore[no-redef]
|
|
295
|
+
def style(self) -> Optional[str]:
|
|
296
|
+
"""getter of style"""
|
|
297
|
+
return self._style
|
|
298
|
+
|
|
299
|
+
@style.setter
|
|
300
|
+
def style(self, value: Optional[str]) -> None:
|
|
301
|
+
"""setter of style"""
|
|
302
|
+
if isinstance(value, property) or value is None:
|
|
303
|
+
self._style = None
|
|
304
|
+
return
|
|
305
|
+
|
|
306
|
+
LineValidator.validate_style(value)
|
|
307
|
+
self._style = value
|
|
308
|
+
|
|
309
|
+
@property # type: ignore[no-redef]
|
|
310
|
+
def color(self) -> Union[Tuple[int, int, int], Tuple[int, int, int, float], None]:
|
|
311
|
+
"""getter of color"""
|
|
312
|
+
return self._color
|
|
313
|
+
|
|
314
|
+
@color.setter
|
|
315
|
+
def color(self, value: Union[Tuple[int, int, int], Tuple[int, int, int, float], None]) -> None:
|
|
316
|
+
"""setter of color"""
|
|
317
|
+
if isinstance(value, property) or value is None:
|
|
318
|
+
self._color = None
|
|
319
|
+
return
|
|
320
|
+
|
|
321
|
+
ColorValidator.validate_color(value)
|
|
322
|
+
self._color = value
|
|
323
|
+
|
|
324
|
+
@property # type: ignore[no-redef]
|
|
325
|
+
def alpha(self) -> Optional[float]:
|
|
326
|
+
"""getter of alpha"""
|
|
327
|
+
return self._alpha
|
|
328
|
+
|
|
329
|
+
@alpha.setter
|
|
330
|
+
def alpha(self, value: Optional[float]) -> None:
|
|
331
|
+
"""setter of alpha"""
|
|
332
|
+
if isinstance(value, property) or value is None:
|
|
333
|
+
self._alpha = None
|
|
334
|
+
return
|
|
335
|
+
|
|
336
|
+
ColorValidator.validate_alpha(value)
|
|
337
|
+
self._alpha = value
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
class LineArrowStyleDefault:
|
|
341
|
+
lwidth: Final[float] = 1.0
|
|
342
|
+
lstyle: Final[str] = "solid"
|
|
343
|
+
hstyle: Final[str] = "->"
|
|
344
|
+
hscale: Final[float] = 20.0
|
|
345
|
+
color: Final[Tuple[int, int, int]] = Colors.Black
|
|
346
|
+
alpha: Final[None] = None
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
@dataclasses.dataclass
|
|
350
|
+
class LineArrowStyle:
|
|
351
|
+
"""drawlib line style dataclass.
|
|
352
|
+
|
|
353
|
+
Instead of providing lots of style parameters to drawing line
|
|
354
|
+
functions ``line()`` etc,
|
|
355
|
+
user set line style to line this way.
|
|
356
|
+
|
|
357
|
+
1. Provide line style settings to ``LineStyle``.
|
|
358
|
+
2. Provide the style instance to functions which uses line style.
|
|
359
|
+
3. Line style is applied to drawn lines.
|
|
360
|
+
|
|
361
|
+
It is easy for managing line styles and applying them to lots of texts.
|
|
362
|
+
|
|
363
|
+
Note:
|
|
364
|
+
Line style of shapes are configured at ``ShapeStyle``.
|
|
365
|
+
|
|
366
|
+
"""
|
|
367
|
+
|
|
368
|
+
lstyle: Optional[Literal["solid", "dashed", "dotted", "dashdot"]] = None
|
|
369
|
+
lwidth: Optional[float] = None
|
|
370
|
+
hstyle: Optional[Literal["->", "<-", "<->", "-|>", "<|-", "<|-|>"]] = None
|
|
371
|
+
hscale: Optional[int] = None
|
|
372
|
+
color: Union[Tuple[int, int, int], Tuple[int, int, int, float], None] = None
|
|
373
|
+
alpha: Optional[float] = None
|
|
374
|
+
|
|
375
|
+
@property # type: ignore[no-redef]
|
|
376
|
+
def lwidth(self) -> Optional[float]:
|
|
377
|
+
"""getter of lwidth"""
|
|
378
|
+
return self._lwidth
|
|
379
|
+
|
|
380
|
+
@lwidth.setter
|
|
381
|
+
def lwidth(self, value: Optional[float]) -> None:
|
|
382
|
+
"""setter of lwidth"""
|
|
383
|
+
if isinstance(value, property) or value is None:
|
|
384
|
+
self._lwidth = None
|
|
385
|
+
return
|
|
386
|
+
|
|
387
|
+
LineValidator.validate_width(value)
|
|
388
|
+
self._lwidth = value
|
|
389
|
+
|
|
390
|
+
@property # type: ignore[no-redef]
|
|
391
|
+
def lstyle(self) -> Optional[str]:
|
|
392
|
+
"""getter of lstyle"""
|
|
393
|
+
return self._lstyle
|
|
394
|
+
|
|
395
|
+
@lstyle.setter
|
|
396
|
+
def lstyle(self, value: Optional[str]) -> None:
|
|
397
|
+
"""setter of lstyle"""
|
|
398
|
+
if isinstance(value, property) or value is None:
|
|
399
|
+
self._lstyle = None
|
|
400
|
+
return
|
|
401
|
+
|
|
402
|
+
LineValidator.validate_style(value)
|
|
403
|
+
self._lstyle = value
|
|
404
|
+
|
|
405
|
+
@property # type: ignore[no-redef]
|
|
406
|
+
def hscale(self) -> Optional[float]:
|
|
407
|
+
"""getter of hscale"""
|
|
408
|
+
return self._hscale
|
|
409
|
+
|
|
410
|
+
@hscale.setter
|
|
411
|
+
def hscale(self, value: Optional[float]) -> None:
|
|
412
|
+
"""setter of hscale"""
|
|
413
|
+
if isinstance(value, property) or value is None:
|
|
414
|
+
self._hscale = None
|
|
415
|
+
return
|
|
416
|
+
|
|
417
|
+
LineValidator.validate_arrowhead_scale(value)
|
|
418
|
+
self._hscale = value
|
|
419
|
+
|
|
420
|
+
@property # type: ignore[no-redef]
|
|
421
|
+
def hstyle(self) -> Optional[str]:
|
|
422
|
+
"""getter of hstyle"""
|
|
423
|
+
return self._hstyle
|
|
424
|
+
|
|
425
|
+
@hstyle.setter
|
|
426
|
+
def hstyle(self, value: Optional[str]) -> None:
|
|
427
|
+
"""setter of lstyle"""
|
|
428
|
+
if isinstance(value, property) or value is None:
|
|
429
|
+
self._hstyle = None
|
|
430
|
+
return
|
|
431
|
+
|
|
432
|
+
LineValidator.validate_arrowhead_style(value)
|
|
433
|
+
self._hstyle = value
|
|
434
|
+
|
|
435
|
+
@property # type: ignore[no-redef]
|
|
436
|
+
def color(self) -> Union[Tuple[int, int, int], Tuple[int, int, int, float], None]:
|
|
437
|
+
"""getter of color"""
|
|
438
|
+
return self._color
|
|
439
|
+
|
|
440
|
+
@color.setter
|
|
441
|
+
def color(self, value: Union[Tuple[int, int, int], Tuple[int, int, int, float], None]) -> None:
|
|
442
|
+
"""setter of color"""
|
|
443
|
+
if isinstance(value, property) or value is None:
|
|
444
|
+
self._color = None
|
|
445
|
+
return
|
|
446
|
+
|
|
447
|
+
ColorValidator.validate_color(value)
|
|
448
|
+
self._color = value
|
|
449
|
+
|
|
450
|
+
@property # type: ignore[no-redef]
|
|
451
|
+
def alpha(self) -> Optional[float]:
|
|
452
|
+
"""getter of alpha"""
|
|
453
|
+
return self._alpha
|
|
454
|
+
|
|
455
|
+
@alpha.setter
|
|
456
|
+
def alpha(self, value: Optional[float]) -> None:
|
|
457
|
+
"""setter of alpha"""
|
|
458
|
+
if isinstance(value, property) or value is None:
|
|
459
|
+
self._alpha = None
|
|
460
|
+
return
|
|
461
|
+
|
|
462
|
+
ColorValidator.validate_alpha(value)
|
|
463
|
+
self._alpha = value
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
class ShapeStyleDefault:
|
|
467
|
+
halign: Final[str] = "center"
|
|
468
|
+
valign: Final[str] = "center"
|
|
469
|
+
lwidth: Final[float] = 1.0
|
|
470
|
+
lstyle: Final[str] = "solid"
|
|
471
|
+
lcolor: Final[Tuple[int, int, int]] = Colors.Black
|
|
472
|
+
fcolor: Final[Tuple[int, int, int]] = Colors.White
|
|
473
|
+
alpha: Final[None] = None
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
@dataclasses.dataclass
|
|
477
|
+
class ShapeStyle:
|
|
478
|
+
"""drawlib shape style dataclass.
|
|
479
|
+
|
|
480
|
+
Instead of providing lots of style parameters to drawing shape
|
|
481
|
+
functions ``circle()`` etc,
|
|
482
|
+
user set shape style to shape this way.
|
|
483
|
+
|
|
484
|
+
1. Provide text style settings to ``ShapeStyle``.
|
|
485
|
+
2. Provide the style instance to functions which use shape style.
|
|
486
|
+
3. Text style is applied to drawn shape.
|
|
487
|
+
|
|
488
|
+
It is easy for managing shape styles and applying them to lots of shapes.
|
|
489
|
+
|
|
490
|
+
Note:
|
|
491
|
+
Line style of shapes are also configured on ShapeStyle too.
|
|
492
|
+
LineStyle is not used.
|
|
493
|
+
|
|
494
|
+
"""
|
|
495
|
+
|
|
496
|
+
halign: Optional[Literal["left", "center", "right"]] = None
|
|
497
|
+
valign: Optional[Literal["bottom", "center", "top"]] = None
|
|
498
|
+
alpha: Optional[float] = None
|
|
499
|
+
lwidth: Optional[float] = None
|
|
500
|
+
lcolor: Union[Tuple[int, int, int], Tuple[int, int, int, float], None] = None
|
|
501
|
+
lstyle: Optional[Literal["solid", "dashed", "dotted", "dashdot"]] = None
|
|
502
|
+
fcolor: Union[Tuple[int, int, int], Tuple[int, int, int, float], None] = None
|
|
503
|
+
|
|
504
|
+
@property # type: ignore[no-redef]
|
|
505
|
+
def halign(self) -> Optional[str]:
|
|
506
|
+
"""getter of halign"""
|
|
507
|
+
return self._halign
|
|
508
|
+
|
|
509
|
+
@halign.setter
|
|
510
|
+
def halign(self, value: Optional[Literal["left", "center", "right"]]) -> None:
|
|
511
|
+
"""setter of halign"""
|
|
512
|
+
if isinstance(value, property) or value is None:
|
|
513
|
+
self._halign = None
|
|
514
|
+
return
|
|
515
|
+
|
|
516
|
+
AlignValidator.validate_halign(value)
|
|
517
|
+
self._halign = value
|
|
518
|
+
|
|
519
|
+
@property # type: ignore[no-redef]
|
|
520
|
+
def valign(self) -> Optional[str]:
|
|
521
|
+
"""getter of valign"""
|
|
522
|
+
return self._valign
|
|
523
|
+
|
|
524
|
+
@valign.setter
|
|
525
|
+
def valign(self, value: Optional[Literal["bottom", "center", "top"]]) -> None:
|
|
526
|
+
"""setter of valign"""
|
|
527
|
+
if isinstance(value, property) or value is None:
|
|
528
|
+
self._valign = None
|
|
529
|
+
return
|
|
530
|
+
|
|
531
|
+
AlignValidator.validate_valign(value)
|
|
532
|
+
self._valign = value
|
|
533
|
+
|
|
534
|
+
@property # type: ignore[no-redef]
|
|
535
|
+
def alpha(self) -> Optional[float]:
|
|
536
|
+
"""getter of alpha"""
|
|
537
|
+
return self._alpha
|
|
538
|
+
|
|
539
|
+
@alpha.setter
|
|
540
|
+
def alpha(self, value: Optional[float]) -> None:
|
|
541
|
+
"""setter of alpha"""
|
|
542
|
+
if isinstance(value, property) or value is None:
|
|
543
|
+
self._alpha = None
|
|
544
|
+
return
|
|
545
|
+
|
|
546
|
+
ColorValidator.validate_alpha(value)
|
|
547
|
+
self._alpha = value
|
|
548
|
+
|
|
549
|
+
@property # type: ignore[no-redef]
|
|
550
|
+
def lwidth(self) -> Optional[float]:
|
|
551
|
+
"""getter of lwidth"""
|
|
552
|
+
return self._lwidth
|
|
553
|
+
|
|
554
|
+
@lwidth.setter
|
|
555
|
+
def lwidth(self, value: Optional[float]) -> None:
|
|
556
|
+
"""setter of lwidth"""
|
|
557
|
+
if isinstance(value, property) or value is None:
|
|
558
|
+
self._lwidth = None
|
|
559
|
+
return
|
|
560
|
+
|
|
561
|
+
LineValidator.validate_width(value)
|
|
562
|
+
self._lwidth = value
|
|
563
|
+
|
|
564
|
+
@property # type: ignore[no-redef]
|
|
565
|
+
def lstyle(self) -> Optional[str]:
|
|
566
|
+
"""getter of lstyle"""
|
|
567
|
+
return self._lstyle
|
|
568
|
+
|
|
569
|
+
@lstyle.setter
|
|
570
|
+
def lstyle(self, value: Optional[str]) -> None:
|
|
571
|
+
"""setter of lstyle"""
|
|
572
|
+
if isinstance(value, property) or value is None:
|
|
573
|
+
self._lstyle = None
|
|
574
|
+
return
|
|
575
|
+
|
|
576
|
+
LineValidator.validate_style(value)
|
|
577
|
+
self._lstyle = value
|
|
578
|
+
|
|
579
|
+
@property # type: ignore[no-redef]
|
|
580
|
+
def lcolor(self) -> Union[Tuple[int, int, int], Tuple[int, int, int, float], None]:
|
|
581
|
+
"""getter of lcolor"""
|
|
582
|
+
return self._lcolor
|
|
583
|
+
|
|
584
|
+
@lcolor.setter
|
|
585
|
+
def lcolor(self, value: Union[Tuple[int, int, int], Tuple[int, int, int, float], None]) -> None:
|
|
586
|
+
"""setter of lcolor"""
|
|
587
|
+
if isinstance(value, property) or value is None:
|
|
588
|
+
self._lcolor = None
|
|
589
|
+
return
|
|
590
|
+
|
|
591
|
+
ColorValidator.validate_color(value)
|
|
592
|
+
self._lcolor = value
|
|
593
|
+
|
|
594
|
+
@property # type: ignore[no-redef]
|
|
595
|
+
def fcolor(self) -> Union[Tuple[int, int, int], Tuple[int, int, int, float], None]:
|
|
596
|
+
"""getter of fcolor"""
|
|
597
|
+
return self._fcolor
|
|
598
|
+
|
|
599
|
+
@fcolor.setter
|
|
600
|
+
def fcolor(self, value: Union[Tuple[int, int, int], Tuple[int, int, int, float], None]) -> None:
|
|
601
|
+
"""setter of fcolor"""
|
|
602
|
+
if isinstance(value, property) or value is None:
|
|
603
|
+
self._fcolor = None
|
|
604
|
+
return
|
|
605
|
+
|
|
606
|
+
ColorValidator.validate_color(value)
|
|
607
|
+
self._fcolor = value
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
class ShapeTextStyleDefault:
|
|
611
|
+
alpha: Final[None] = None
|
|
612
|
+
color: Final[Tuple[int, int, int]] = Colors.Black
|
|
613
|
+
size: Final[float] = 16
|
|
614
|
+
halign: Final[str] = "center"
|
|
615
|
+
valign: Final[str] = "center"
|
|
616
|
+
font: Final[Font] = Font.SANSSERIF_REGULAR
|
|
617
|
+
angle: Final[None] = None
|
|
618
|
+
flip: Final[bool] = False
|
|
619
|
+
xy_shift: Final[None] = None
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
@dataclasses.dataclass
|
|
623
|
+
class ShapeTextStyle:
|
|
624
|
+
"""drawlib text style dataclass.
|
|
625
|
+
|
|
626
|
+
Instead of providing lots of style parameters to drawing text
|
|
627
|
+
functions ``text()`` etc,
|
|
628
|
+
user set text style to text this way.
|
|
629
|
+
|
|
630
|
+
1. Provide text style settings to ``TextStyle``.
|
|
631
|
+
2. Provide the style instance to functions which uses text style.
|
|
632
|
+
3. Text style is applied to drawn text.
|
|
633
|
+
|
|
634
|
+
It is easy for managing text styles and applying them to lots of texts.
|
|
635
|
+
|
|
636
|
+
"""
|
|
637
|
+
|
|
638
|
+
alpha: Optional[float] = None
|
|
639
|
+
color: Union[Tuple[int, int, int], Tuple[int, int, int, float], None] = None
|
|
640
|
+
size: Union[float, str, None] = None
|
|
641
|
+
halign: Optional[Literal["left", "center", "right"]] = None
|
|
642
|
+
valign: Optional[Literal["bottom", "center", "top"]] = None
|
|
643
|
+
font: Union[
|
|
644
|
+
Font,
|
|
645
|
+
FontArabic,
|
|
646
|
+
FontBase,
|
|
647
|
+
FontSerif,
|
|
648
|
+
FontSanSerif,
|
|
649
|
+
FontChinese,
|
|
650
|
+
FontJapanese,
|
|
651
|
+
FontKorean,
|
|
652
|
+
FontMonoSpace,
|
|
653
|
+
FontRoboto,
|
|
654
|
+
FontSourceCode,
|
|
655
|
+
FontFile,
|
|
656
|
+
None,
|
|
657
|
+
] = None
|
|
658
|
+
angle: Optional[float] = None
|
|
659
|
+
flip: Optional[bool] = None
|
|
660
|
+
xy_shift: Optional[Tuple[float, float]] = None
|
|
661
|
+
|
|
662
|
+
@property # type: ignore[no-redef]
|
|
663
|
+
def halign(self) -> Optional[str]:
|
|
664
|
+
"""getter of halign"""
|
|
665
|
+
return self._halign
|
|
666
|
+
|
|
667
|
+
@halign.setter
|
|
668
|
+
def halign(self, value: Optional[Literal["left", "center", "right"]]) -> None:
|
|
669
|
+
"""setter of halign"""
|
|
670
|
+
if isinstance(value, property) or value is None:
|
|
671
|
+
self._halign = None
|
|
672
|
+
return
|
|
673
|
+
|
|
674
|
+
AlignValidator.validate_halign(value)
|
|
675
|
+
self._halign = value
|
|
676
|
+
|
|
677
|
+
@property # type: ignore[no-redef]
|
|
678
|
+
def valign(self) -> Optional[str]:
|
|
679
|
+
"""getter of valign"""
|
|
680
|
+
return self._valign
|
|
681
|
+
|
|
682
|
+
@valign.setter
|
|
683
|
+
def valign(self, value: Optional[Literal["bottom", "center", "top"]]) -> None:
|
|
684
|
+
"""setter of valign"""
|
|
685
|
+
if isinstance(value, property) or value is None:
|
|
686
|
+
self._valign = None
|
|
687
|
+
return
|
|
688
|
+
|
|
689
|
+
AlignValidator.validate_valign(value)
|
|
690
|
+
self._valign = value
|
|
691
|
+
|
|
692
|
+
@property # type: ignore[no-redef]
|
|
693
|
+
def color(self) -> Union[Tuple[int, int, int], Tuple[int, int, int, float], None]:
|
|
694
|
+
"""getter of color"""
|
|
695
|
+
return self._color
|
|
696
|
+
|
|
697
|
+
@color.setter
|
|
698
|
+
def color(self, value: Union[Tuple[int, int, int], Tuple[int, int, int, float], None]) -> None:
|
|
699
|
+
"""setter of color"""
|
|
700
|
+
if isinstance(value, property) or value is None:
|
|
701
|
+
self._color = None
|
|
702
|
+
return
|
|
703
|
+
|
|
704
|
+
ColorValidator.validate_color(value)
|
|
705
|
+
self._color = value
|
|
706
|
+
|
|
707
|
+
@property # type: ignore[no-redef]
|
|
708
|
+
def alpha(self) -> Optional[float]:
|
|
709
|
+
"""getter of alpha"""
|
|
710
|
+
return self._alpha
|
|
711
|
+
|
|
712
|
+
@alpha.setter
|
|
713
|
+
def alpha(self, value: Optional[float]) -> None:
|
|
714
|
+
"""setter of alpha"""
|
|
715
|
+
if isinstance(value, property) or value is None:
|
|
716
|
+
self._alpha = None
|
|
717
|
+
return
|
|
718
|
+
|
|
719
|
+
ColorValidator.validate_alpha(value)
|
|
720
|
+
self._alpha = value
|
|
721
|
+
|
|
722
|
+
@property # type: ignore[no-redef]
|
|
723
|
+
def size(self) -> Optional[float]:
|
|
724
|
+
"""getter of size"""
|
|
725
|
+
return self._size
|
|
726
|
+
|
|
727
|
+
@size.setter
|
|
728
|
+
def size(self, value: Optional[float]) -> None:
|
|
729
|
+
"""setter of size"""
|
|
730
|
+
if isinstance(value, property) or value is None:
|
|
731
|
+
self._size = None
|
|
732
|
+
return
|
|
733
|
+
|
|
734
|
+
TextValidator.validate_size(value)
|
|
735
|
+
self._size = value
|
|
736
|
+
|
|
737
|
+
@property # type: ignore[no-redef]
|
|
738
|
+
def font(self) -> Union[
|
|
739
|
+
Font,
|
|
740
|
+
FontArabic,
|
|
741
|
+
FontBase,
|
|
742
|
+
FontSerif,
|
|
743
|
+
FontSanSerif,
|
|
744
|
+
FontChinese,
|
|
745
|
+
FontJapanese,
|
|
746
|
+
FontKorean,
|
|
747
|
+
FontMonoSpace,
|
|
748
|
+
FontRoboto,
|
|
749
|
+
FontSourceCode,
|
|
750
|
+
FontFile,
|
|
751
|
+
None,
|
|
752
|
+
]:
|
|
753
|
+
"""getter of font"""
|
|
754
|
+
return self._font
|
|
755
|
+
|
|
756
|
+
@font.setter
|
|
757
|
+
def font(
|
|
758
|
+
self,
|
|
759
|
+
value: Union[
|
|
760
|
+
Font,
|
|
761
|
+
FontArabic,
|
|
762
|
+
FontBase,
|
|
763
|
+
FontSerif,
|
|
764
|
+
FontSanSerif,
|
|
765
|
+
FontChinese,
|
|
766
|
+
FontJapanese,
|
|
767
|
+
FontKorean,
|
|
768
|
+
FontMonoSpace,
|
|
769
|
+
FontRoboto,
|
|
770
|
+
FontSourceCode,
|
|
771
|
+
FontFile,
|
|
772
|
+
None,
|
|
773
|
+
],
|
|
774
|
+
) -> None:
|
|
775
|
+
"""setter of font"""
|
|
776
|
+
if isinstance(value, property) or value is None:
|
|
777
|
+
self._font = None
|
|
778
|
+
return
|
|
779
|
+
|
|
780
|
+
TextValidator.validate_font(value)
|
|
781
|
+
self._font = value
|
|
782
|
+
|
|
783
|
+
@property # type: ignore[no-redef]
|
|
784
|
+
def angle(self) -> Optional[float]:
|
|
785
|
+
"""getter of angle"""
|
|
786
|
+
return self._angle
|
|
787
|
+
|
|
788
|
+
@angle.setter
|
|
789
|
+
def angle(self, value: Optional[float]) -> None:
|
|
790
|
+
"""setter of alpha"""
|
|
791
|
+
if isinstance(value, property) or value is None:
|
|
792
|
+
self._angle = None
|
|
793
|
+
return
|
|
794
|
+
|
|
795
|
+
CoordinateValidator.validate_angle(value)
|
|
796
|
+
self._angle = value
|
|
797
|
+
|
|
798
|
+
@property # type: ignore[no-redef]
|
|
799
|
+
def flip(self) -> Optional[bool]:
|
|
800
|
+
"""getter of flip"""
|
|
801
|
+
return self._flip
|
|
802
|
+
|
|
803
|
+
@flip.setter
|
|
804
|
+
def flip(self, value: Optional[bool]) -> None:
|
|
805
|
+
"""setter of flip"""
|
|
806
|
+
if isinstance(value, property) or value is None:
|
|
807
|
+
self._flip = None
|
|
808
|
+
return
|
|
809
|
+
|
|
810
|
+
TextValidator.validate_flip(value)
|
|
811
|
+
self._flip = value
|
|
812
|
+
|
|
813
|
+
@property # type: ignore[no-redef]
|
|
814
|
+
def xy_shift(self) -> Optional[Tuple[float, float]]:
|
|
815
|
+
"""getter of xy_shift"""
|
|
816
|
+
return self._xy_shift
|
|
817
|
+
|
|
818
|
+
@xy_shift.setter
|
|
819
|
+
def xy_shift(self, value: Optional[float]) -> None:
|
|
820
|
+
"""setter of xy_shift"""
|
|
821
|
+
if isinstance(value, property) or value is None:
|
|
822
|
+
self._xy_shift = None
|
|
823
|
+
return
|
|
824
|
+
|
|
825
|
+
CoordinateValidator.validate_xy(value)
|
|
826
|
+
self._xy_shift = value
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
class TextStyleDefault:
|
|
830
|
+
alpha: Final[float] = None
|
|
831
|
+
color: Final[Tuple[int, int, int]] = Colors.Black
|
|
832
|
+
size: Final[float] = 16
|
|
833
|
+
halign: Final[str] = "center"
|
|
834
|
+
valign: Final[str] = "center"
|
|
835
|
+
font: Final[Font] = Font.SANSSERIF_REGULAR
|
|
836
|
+
bgalpha: Final[None] = None
|
|
837
|
+
bgfcolor: Final[None] = None
|
|
838
|
+
# they will be applied if one of them is not None
|
|
839
|
+
bglcolor: Final[Tuple[int, int, int]] = Colors.Black
|
|
840
|
+
bglstyle: Final[str] = "solid"
|
|
841
|
+
bglwidth: Final[float] = 1.0
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
@dataclasses.dataclass
|
|
845
|
+
class TextStyle:
|
|
846
|
+
"""drawlib text style dataclass.
|
|
847
|
+
|
|
848
|
+
Instead of providing lots of style parameters to drawing text
|
|
849
|
+
functions ``text()`` etc,
|
|
850
|
+
user set text style to text this way.
|
|
851
|
+
|
|
852
|
+
1. Provide text style settings to ``TextStyle``.
|
|
853
|
+
2. Provide the style instance to functions which uses text style.
|
|
854
|
+
3. Text style is applied to drawn text.
|
|
855
|
+
|
|
856
|
+
It is easy for managing text styles and applying them to lots of texts.
|
|
857
|
+
|
|
858
|
+
"""
|
|
859
|
+
|
|
860
|
+
alpha: Optional[float] = None
|
|
861
|
+
color: Union[Tuple[int, int, int], Tuple[int, int, int, float], None] = None
|
|
862
|
+
size: Union[float, str, None] = None
|
|
863
|
+
halign: Optional[Literal["left", "center", "right"]] = None
|
|
864
|
+
valign: Optional[Literal["bottom", "center", "top"]] = None
|
|
865
|
+
font: Union[
|
|
866
|
+
Font,
|
|
867
|
+
FontArabic,
|
|
868
|
+
FontBase,
|
|
869
|
+
FontSerif,
|
|
870
|
+
FontSanSerif,
|
|
871
|
+
FontChinese,
|
|
872
|
+
FontJapanese,
|
|
873
|
+
FontKorean,
|
|
874
|
+
FontMonoSpace,
|
|
875
|
+
FontRoboto,
|
|
876
|
+
FontSourceCode,
|
|
877
|
+
FontFile,
|
|
878
|
+
None,
|
|
879
|
+
] = None
|
|
880
|
+
|
|
881
|
+
# background
|
|
882
|
+
bgalpha: Optional[float] = None
|
|
883
|
+
bglcolor: Union[Tuple[int, int, int], Tuple[int, int, int, float], None] = None
|
|
884
|
+
bglstyle: Optional[Literal["solid", "dashed", "dotted", "dashdot"]] = None
|
|
885
|
+
bglwidth: Optional[float] = None
|
|
886
|
+
bgfcolor: Union[Tuple[int, int, int], Tuple[int, int, int, float], None] = None
|
|
887
|
+
|
|
888
|
+
@property # type: ignore[no-redef]
|
|
889
|
+
def halign(self) -> Optional[str]:
|
|
890
|
+
"""getter of halign"""
|
|
891
|
+
return self._halign
|
|
892
|
+
|
|
893
|
+
@halign.setter
|
|
894
|
+
def halign(self, value: Optional[Literal["left", "center", "right"]]) -> None:
|
|
895
|
+
"""setter of halign"""
|
|
896
|
+
if isinstance(value, property) or value is None:
|
|
897
|
+
self._halign = None
|
|
898
|
+
return
|
|
899
|
+
|
|
900
|
+
AlignValidator.validate_halign(value)
|
|
901
|
+
self._halign = value
|
|
902
|
+
|
|
903
|
+
@property # type: ignore[no-redef]
|
|
904
|
+
def valign(self) -> Optional[str]:
|
|
905
|
+
"""getter of valign"""
|
|
906
|
+
return self._valign
|
|
907
|
+
|
|
908
|
+
@valign.setter
|
|
909
|
+
def valign(self, value: Optional[Literal["bottom", "center", "top"]]) -> None:
|
|
910
|
+
"""setter of valign"""
|
|
911
|
+
if isinstance(value, property) or value is None:
|
|
912
|
+
self._valign = None
|
|
913
|
+
return
|
|
914
|
+
|
|
915
|
+
AlignValidator.validate_valign(value)
|
|
916
|
+
self._valign = value
|
|
917
|
+
|
|
918
|
+
@property # type: ignore[no-redef]
|
|
919
|
+
def color(self) -> Union[Tuple[int, int, int], Tuple[int, int, int, float], None]:
|
|
920
|
+
"""getter of color"""
|
|
921
|
+
return self._color
|
|
922
|
+
|
|
923
|
+
@color.setter
|
|
924
|
+
def color(self, value: Union[Tuple[int, int, int], Tuple[int, int, int, float], None]) -> None:
|
|
925
|
+
"""setter of color"""
|
|
926
|
+
if isinstance(value, property) or value is None:
|
|
927
|
+
self._color = None
|
|
928
|
+
return
|
|
929
|
+
|
|
930
|
+
ColorValidator.validate_color(value)
|
|
931
|
+
self._color = value
|
|
932
|
+
|
|
933
|
+
@property # type: ignore[no-redef]
|
|
934
|
+
def alpha(self) -> Optional[float]:
|
|
935
|
+
"""getter of alpha"""
|
|
936
|
+
return self._alpha
|
|
937
|
+
|
|
938
|
+
@alpha.setter
|
|
939
|
+
def alpha(self, value: Optional[float]) -> None:
|
|
940
|
+
"""setter of alpha"""
|
|
941
|
+
if isinstance(value, property) or value is None:
|
|
942
|
+
self._alpha = None
|
|
943
|
+
return
|
|
944
|
+
|
|
945
|
+
ColorValidator.validate_alpha(value)
|
|
946
|
+
self._alpha = value
|
|
947
|
+
|
|
948
|
+
@property # type: ignore[no-redef]
|
|
949
|
+
def size(self) -> Optional[float]:
|
|
950
|
+
"""getter of size"""
|
|
951
|
+
return self._size
|
|
952
|
+
|
|
953
|
+
@size.setter
|
|
954
|
+
def size(self, value: Optional[float]) -> None:
|
|
955
|
+
"""setter of size"""
|
|
956
|
+
if isinstance(value, property) or value is None:
|
|
957
|
+
self._size = None
|
|
958
|
+
return
|
|
959
|
+
|
|
960
|
+
TextValidator.validate_size(value)
|
|
961
|
+
self._size = value
|
|
962
|
+
|
|
963
|
+
@property # type: ignore[no-redef]
|
|
964
|
+
def font(self) -> Union[
|
|
965
|
+
Font,
|
|
966
|
+
FontArabic,
|
|
967
|
+
FontBase,
|
|
968
|
+
FontSerif,
|
|
969
|
+
FontSanSerif,
|
|
970
|
+
FontChinese,
|
|
971
|
+
FontJapanese,
|
|
972
|
+
FontKorean,
|
|
973
|
+
FontMonoSpace,
|
|
974
|
+
FontRoboto,
|
|
975
|
+
FontSourceCode,
|
|
976
|
+
FontFile,
|
|
977
|
+
None,
|
|
978
|
+
]:
|
|
979
|
+
"""getter of font"""
|
|
980
|
+
return self._font
|
|
981
|
+
|
|
982
|
+
@font.setter
|
|
983
|
+
def font(
|
|
984
|
+
self,
|
|
985
|
+
value: Union[
|
|
986
|
+
Font,
|
|
987
|
+
FontArabic,
|
|
988
|
+
FontBase,
|
|
989
|
+
FontSerif,
|
|
990
|
+
FontSanSerif,
|
|
991
|
+
FontChinese,
|
|
992
|
+
FontJapanese,
|
|
993
|
+
FontKorean,
|
|
994
|
+
FontMonoSpace,
|
|
995
|
+
FontRoboto,
|
|
996
|
+
FontSourceCode,
|
|
997
|
+
FontFile,
|
|
998
|
+
None,
|
|
999
|
+
],
|
|
1000
|
+
) -> None:
|
|
1001
|
+
"""setter of font"""
|
|
1002
|
+
if isinstance(value, property) or value is None:
|
|
1003
|
+
self._font = None
|
|
1004
|
+
return
|
|
1005
|
+
|
|
1006
|
+
TextValidator.validate_font(value)
|
|
1007
|
+
self._font = value
|
|
1008
|
+
|
|
1009
|
+
@property # type: ignore[no-redef]
|
|
1010
|
+
def bgalpha(self) -> Optional[float]:
|
|
1011
|
+
"""getter of bgalpha"""
|
|
1012
|
+
return self._bgalpha
|
|
1013
|
+
|
|
1014
|
+
@bgalpha.setter
|
|
1015
|
+
def bgalpha(self, value: Optional[float]) -> None:
|
|
1016
|
+
"""setter of bgalpha"""
|
|
1017
|
+
if isinstance(value, property) or value is None:
|
|
1018
|
+
self._bgalpha = None
|
|
1019
|
+
return
|
|
1020
|
+
|
|
1021
|
+
ColorValidator.validate_alpha(value)
|
|
1022
|
+
self._bgalpha = value
|
|
1023
|
+
|
|
1024
|
+
@property # type: ignore[no-redef]
|
|
1025
|
+
def bglwidth(self) -> Optional[float]:
|
|
1026
|
+
"""getter of bglwidth"""
|
|
1027
|
+
return self._bglwidth
|
|
1028
|
+
|
|
1029
|
+
@bglwidth.setter
|
|
1030
|
+
def bglwidth(self, value: Optional[float]) -> None:
|
|
1031
|
+
"""setter of bglwidth"""
|
|
1032
|
+
if isinstance(value, property) or value is None:
|
|
1033
|
+
self._bglwidth = None
|
|
1034
|
+
return
|
|
1035
|
+
|
|
1036
|
+
LineValidator.validate_width(value)
|
|
1037
|
+
self._bglwidth = value
|
|
1038
|
+
|
|
1039
|
+
@property # type: ignore[no-redef]
|
|
1040
|
+
def bglstyle(self) -> Optional[str]:
|
|
1041
|
+
"""getter of bglstyle"""
|
|
1042
|
+
return self._bglstyle
|
|
1043
|
+
|
|
1044
|
+
@bglstyle.setter
|
|
1045
|
+
def bglstyle(self, value: Optional[str]) -> None:
|
|
1046
|
+
"""setter of bglstyle"""
|
|
1047
|
+
if isinstance(value, property) or value is None:
|
|
1048
|
+
self._bglstyle = None
|
|
1049
|
+
return
|
|
1050
|
+
|
|
1051
|
+
LineValidator.validate_style(value)
|
|
1052
|
+
self._bglstyle = value
|
|
1053
|
+
|
|
1054
|
+
@property # type: ignore[no-redef]
|
|
1055
|
+
def bglcolor(self) -> Union[Tuple[int, int, int], Tuple[int, int, int, float], None]:
|
|
1056
|
+
"""getter of bglcolor"""
|
|
1057
|
+
return self._bglcolor
|
|
1058
|
+
|
|
1059
|
+
@bglcolor.setter
|
|
1060
|
+
def bglcolor(self, value: Union[Tuple[int, int, int], Tuple[int, int, int, float], None]) -> None:
|
|
1061
|
+
"""setter of bglcolor"""
|
|
1062
|
+
if isinstance(value, property) or value is None:
|
|
1063
|
+
self._bglcolor = None
|
|
1064
|
+
return
|
|
1065
|
+
|
|
1066
|
+
ColorValidator.validate_color(value)
|
|
1067
|
+
self._bglcolor = value
|
|
1068
|
+
|
|
1069
|
+
@property # type: ignore[no-redef]
|
|
1070
|
+
def bgfcolor(self) -> Union[Tuple[int, int, int], Tuple[int, int, int, float], None]:
|
|
1071
|
+
"""getter of bgfcolor"""
|
|
1072
|
+
return self._bgfcolor
|
|
1073
|
+
|
|
1074
|
+
@bgfcolor.setter
|
|
1075
|
+
def bgfcolor(self, value: Union[Tuple[int, int, int], Tuple[int, int, int, float], None]) -> None:
|
|
1076
|
+
"""setter of fcolor"""
|
|
1077
|
+
if isinstance(value, property) or value is None:
|
|
1078
|
+
self._bgfcolor = None
|
|
1079
|
+
return
|
|
1080
|
+
|
|
1081
|
+
ColorValidator.validate_color(value)
|
|
1082
|
+
self._bgfcolor = value
|