drawlib 0.1.4__tar.gz → 0.1.6__tar.gz
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-0.1.4 → drawlib-0.1.6}/PKG-INFO +1 -1
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/__init__.py +1 -1
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/apis.py +17 -11
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/command.py +2 -2
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/core/dimage.py +81 -78
- drawlib-0.1.6/drawlib/v0_1/private/core/fonts.py +837 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/core/model.py +53 -54
- drawlib-0.1.6/drawlib/v0_1/private/core/theme.py +413 -0
- drawlib-0.1.6/drawlib/v0_1/private/core/theme_officials.py +437 -0
- drawlib-0.1.6/drawlib/v0_1/private/core/theme_styles.py +1507 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/core/util.py +321 -275
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/core_canvas/base.py +41 -180
- drawlib-0.1.6/drawlib/v0_1/private/core_canvas/canvas.py +259 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/core_canvas/image.py +8 -15
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/core_canvas/line.py +9 -49
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/core_canvas/original_arrow.py +11 -23
- drawlib-0.1.6/drawlib/v0_1/private/core_canvas/original_polygon.py +418 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/core_canvas/patches.py +201 -211
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/core_canvas/text.py +13 -32
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/icons/phosphor.py +1538 -1549
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/icons/util.py +4 -25
- drawlib-0.1.6/drawlib/v0_1/private/smartarts/bubblespeech.py +104 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/smartarts/dsart.py +1 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/smartarts/sourcecode.py +1 -27
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/tools.py +4 -4
- drawlib-0.1.6/drawlib/v0_1/private/validators/__init__.py +8 -0
- drawlib-0.1.6/drawlib/v0_1/private/validators/args.py +225 -0
- drawlib-0.1.6/drawlib/v0_1/private/validators/color.py +51 -0
- drawlib-0.1.6/drawlib/v0_1/private/validators/coordinate.py +105 -0
- drawlib-0.1.6/drawlib/v0_1/private/validators/image.py +26 -0
- drawlib-0.1.6/drawlib/v0_1/private/validators/line.py +35 -0
- drawlib-0.1.6/drawlib/v0_1/private/validators/shape.py +42 -0
- drawlib-0.1.6/drawlib/v0_1/private/validators/smartarts.py +16 -0
- drawlib-0.1.6/drawlib/v0_1/private/validators/style.py +64 -0
- drawlib-0.1.6/drawlib/v0_1/private/validators/text.py +23 -0
- drawlib-0.1.6/drawlib/v0_1/private/validators/types.py +70 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/pyproject.toml +1 -1
- drawlib-0.1.4/drawlib/v0_1/private/arg_validator.py +0 -163
- drawlib-0.1.4/drawlib/v0_1/private/core/fonts.py +0 -324
- drawlib-0.1.4/drawlib/v0_1/private/core/model_validator.py +0 -175
- drawlib-0.1.4/drawlib/v0_1/private/core/theme.py +0 -1993
- drawlib-0.1.4/drawlib/v0_1/private/core_canvas/canvas.py +0 -88
- drawlib-0.1.4/drawlib/v0_1/private/core_canvas/original_polygon.py +0 -600
- {drawlib-0.1.4 → drawlib-0.1.6}/LICENSE.txt +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/README.md +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/.pylintrc +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/__main__.py +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/apis.py +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/assets/__init__.py +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/assets/v0_1/__init__.py +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/assets/v0_1/fonticons/__init__.py +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/assets/v0_1/fonts/__init__.py +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/__init__.py +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/__main__.py +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/__init__.py +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/core/__init__.py +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/core/colors.py +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/core_canvas/__init__.py +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/download.py +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/dutil.py +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/icons/__init__.py +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/logging.py +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/settings.py +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/smartarts/__init__.py +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/smartarts/cycle.py +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/smartarts/groups.py +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/smartarts/pyramid.py +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/smartarts/table.py +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/smartarts/tree.py +0 -0
- {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/util.py +0 -0
|
@@ -30,6 +30,7 @@ from drawlib.v0_1.private.core.colors import (
|
|
|
30
30
|
Colors,
|
|
31
31
|
Colors140,
|
|
32
32
|
)
|
|
33
|
+
|
|
33
34
|
from drawlib.v0_1.private.core.model import (
|
|
34
35
|
IconStyle,
|
|
35
36
|
ImageStyle,
|
|
@@ -39,9 +40,13 @@ from drawlib.v0_1.private.core.model import (
|
|
|
39
40
|
ShapeTextStyle,
|
|
40
41
|
TextStyle,
|
|
41
42
|
)
|
|
43
|
+
|
|
42
44
|
from drawlib.v0_1.private.core.fonts import (
|
|
45
|
+
FontFile,
|
|
46
|
+
# fonts
|
|
43
47
|
Font,
|
|
44
48
|
FontArabic,
|
|
49
|
+
FontBrahmic,
|
|
45
50
|
FontChinese,
|
|
46
51
|
FontJapanese,
|
|
47
52
|
FontKorean,
|
|
@@ -49,10 +54,10 @@ from drawlib.v0_1.private.core.fonts import (
|
|
|
49
54
|
FontRoboto,
|
|
50
55
|
FontSanSerif,
|
|
51
56
|
FontSerif,
|
|
52
|
-
FontThai,
|
|
53
57
|
FontSourceCode,
|
|
54
|
-
|
|
58
|
+
FontThai,
|
|
55
59
|
)
|
|
60
|
+
|
|
56
61
|
from drawlib.v0_1.private.core.dimage import (
|
|
57
62
|
Dimage,
|
|
58
63
|
)
|
|
@@ -62,16 +67,12 @@ from drawlib.v0_1.private.core.dimage import (
|
|
|
62
67
|
######################
|
|
63
68
|
|
|
64
69
|
from drawlib.v0_1.private.core_canvas.canvas import (
|
|
65
|
-
#
|
|
70
|
+
# base
|
|
66
71
|
clear,
|
|
67
72
|
config,
|
|
68
|
-
save,
|
|
69
73
|
shape,
|
|
70
74
|
# image
|
|
71
75
|
image,
|
|
72
|
-
# text
|
|
73
|
-
text,
|
|
74
|
-
text_vertical,
|
|
75
76
|
# line
|
|
76
77
|
line,
|
|
77
78
|
line_curved,
|
|
@@ -79,7 +80,7 @@ from drawlib.v0_1.private.core_canvas.canvas import (
|
|
|
79
80
|
line_bezier2,
|
|
80
81
|
lines,
|
|
81
82
|
lines_bezier,
|
|
82
|
-
# patches
|
|
83
|
+
# shape patches
|
|
83
84
|
arc,
|
|
84
85
|
circle,
|
|
85
86
|
ellipse,
|
|
@@ -89,20 +90,25 @@ from drawlib.v0_1.private.core_canvas.canvas import (
|
|
|
89
90
|
wedge,
|
|
90
91
|
donuts,
|
|
91
92
|
fan,
|
|
92
|
-
# original
|
|
93
|
+
# shape original
|
|
93
94
|
arrow,
|
|
94
95
|
rhombus,
|
|
95
96
|
parallelogram,
|
|
96
97
|
trapezoid,
|
|
97
98
|
triangle,
|
|
98
|
-
bubblespeech,
|
|
99
99
|
star,
|
|
100
100
|
chevron,
|
|
101
|
+
# text
|
|
102
|
+
text,
|
|
103
|
+
text_vertical,
|
|
104
|
+
# canvas
|
|
105
|
+
save,
|
|
101
106
|
)
|
|
102
107
|
|
|
103
108
|
from drawlib.v0_1.private.icons.util import (
|
|
104
109
|
icon,
|
|
105
110
|
)
|
|
111
|
+
|
|
106
112
|
from drawlib.v0_1.private.icons import (
|
|
107
113
|
phosphor as icon_phosphor,
|
|
108
114
|
)
|
|
@@ -112,7 +118,7 @@ from drawlib.v0_1.private.icons import (
|
|
|
112
118
|
#################
|
|
113
119
|
|
|
114
120
|
from drawlib.v0_1.private.tools import (
|
|
115
|
-
|
|
121
|
+
dexec,
|
|
116
122
|
)
|
|
117
123
|
from drawlib.v0_1.private import (
|
|
118
124
|
dutil,
|
|
@@ -23,7 +23,7 @@ import drawlib
|
|
|
23
23
|
import drawlib.v0_1
|
|
24
24
|
from drawlib.v0_1.private.logging import logger
|
|
25
25
|
from drawlib.v0_1.private.settings import dsettings
|
|
26
|
-
from drawlib.v0_1.private.tools import
|
|
26
|
+
from drawlib.v0_1.private.tools import dexec
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
def call() -> None:
|
|
@@ -66,7 +66,7 @@ def call() -> None:
|
|
|
66
66
|
abspath = os.path.abspath(path)
|
|
67
67
|
realpath = os.path.realpath(abspath)
|
|
68
68
|
logger.info(realpath)
|
|
69
|
-
|
|
69
|
+
dexec(realpath)
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
class DrawlibArgParser:
|
|
@@ -19,7 +19,7 @@ This module and its class ``Pimage`` achieves it.
|
|
|
19
19
|
from __future__ import annotations
|
|
20
20
|
|
|
21
21
|
import os
|
|
22
|
-
from typing import Union, Tuple, Dict, cast
|
|
22
|
+
from typing import Union, Tuple, Dict, List, cast
|
|
23
23
|
from PIL import (
|
|
24
24
|
Image,
|
|
25
25
|
ImageFilter,
|
|
@@ -32,6 +32,85 @@ from drawlib.v0_1.private.util import (
|
|
|
32
32
|
get_script_relative_path,
|
|
33
33
|
)
|
|
34
34
|
|
|
35
|
+
list_ = list
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class DimageCache:
|
|
39
|
+
|
|
40
|
+
def __init__(self):
|
|
41
|
+
self._cache: Dict[str, Dimage] = {}
|
|
42
|
+
|
|
43
|
+
def has(self, name: str) -> bool:
|
|
44
|
+
"""check whether having Pimage cache or not.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
name: cache name
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
bool: whether cache exist or not.
|
|
51
|
+
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
return name in self._cache
|
|
55
|
+
|
|
56
|
+
def set(self, name: str, image: Dimage) -> None:
|
|
57
|
+
"""Set **copied** Pimage cache with provided name key.
|
|
58
|
+
|
|
59
|
+
This method copies original object and set copied one.
|
|
60
|
+
It means you can modify original object after caching.
|
|
61
|
+
It doesn't modify cached object.
|
|
62
|
+
|
|
63
|
+
Args:
|
|
64
|
+
name: cache key.
|
|
65
|
+
style: Pimage object which you want to cache.
|
|
66
|
+
|
|
67
|
+
Returns:
|
|
68
|
+
None
|
|
69
|
+
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
self._cache[name] = image.copy()
|
|
73
|
+
|
|
74
|
+
def list(self) -> List[str]:
|
|
75
|
+
return list_(self._cache.keys())
|
|
76
|
+
|
|
77
|
+
def get(self, name: str) -> Dimage:
|
|
78
|
+
"""Get **copied** Pimage cache via name(key).
|
|
79
|
+
|
|
80
|
+
This method doesn't return original object.
|
|
81
|
+
But **copied** object.
|
|
82
|
+
So, you can modify returned Pimage object.
|
|
83
|
+
It doesn't harm original cached Pimage object.
|
|
84
|
+
|
|
85
|
+
Args:
|
|
86
|
+
name: cache key.
|
|
87
|
+
|
|
88
|
+
Returns:
|
|
89
|
+
Pimage: copy of original cached object.
|
|
90
|
+
|
|
91
|
+
"""
|
|
92
|
+
|
|
93
|
+
if not self.has(name):
|
|
94
|
+
raise ValueError(f'Dimage "{name}" is not cached.')
|
|
95
|
+
return self._cache[name].copy()
|
|
96
|
+
|
|
97
|
+
def delete(self, name: str) -> None:
|
|
98
|
+
"""Delete Pimage cache
|
|
99
|
+
|
|
100
|
+
Delete Pimage cache if exist.
|
|
101
|
+
If not exist, just ignore deletion request.
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
name: cache key.
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
None
|
|
108
|
+
|
|
109
|
+
"""
|
|
110
|
+
|
|
111
|
+
if self.has(name):
|
|
112
|
+
del self._cache[name]
|
|
113
|
+
|
|
35
114
|
|
|
36
115
|
class Dimage:
|
|
37
116
|
"""drawlib image class
|
|
@@ -43,7 +122,7 @@ class Dimage:
|
|
|
43
122
|
|
|
44
123
|
"""
|
|
45
124
|
|
|
46
|
-
|
|
125
|
+
cache = DimageCache()
|
|
47
126
|
|
|
48
127
|
@error_handler
|
|
49
128
|
def __init__(
|
|
@@ -432,79 +511,3 @@ class Dimage:
|
|
|
432
511
|
return Dimage(new_image)
|
|
433
512
|
|
|
434
513
|
raise NotImplementedError("Implement later")
|
|
435
|
-
|
|
436
|
-
#############
|
|
437
|
-
### Cache ###
|
|
438
|
-
#############
|
|
439
|
-
|
|
440
|
-
@classmethod
|
|
441
|
-
def cache_exist(cls, name: str) -> bool:
|
|
442
|
-
"""check whether having Pimage cache or not.
|
|
443
|
-
|
|
444
|
-
Args:
|
|
445
|
-
name: cache name
|
|
446
|
-
|
|
447
|
-
Returns:
|
|
448
|
-
bool: whether cache exist or not.
|
|
449
|
-
|
|
450
|
-
"""
|
|
451
|
-
|
|
452
|
-
return name in cls._cache
|
|
453
|
-
|
|
454
|
-
@classmethod
|
|
455
|
-
def cache_set(cls, name: str, image: Dimage) -> None:
|
|
456
|
-
"""Set **copied** Pimage cache with provided name key.
|
|
457
|
-
|
|
458
|
-
This method copies original object and set copied one.
|
|
459
|
-
It means you can modify original object after caching.
|
|
460
|
-
It doesn't modify cached object.
|
|
461
|
-
|
|
462
|
-
Args:
|
|
463
|
-
name: cache key.
|
|
464
|
-
style: Pimage object which you want to cache.
|
|
465
|
-
|
|
466
|
-
Returns:
|
|
467
|
-
None
|
|
468
|
-
|
|
469
|
-
"""
|
|
470
|
-
|
|
471
|
-
cls._cache[name] = image.copy()
|
|
472
|
-
|
|
473
|
-
@classmethod
|
|
474
|
-
def cache_get(cls, name: str) -> Dimage:
|
|
475
|
-
"""Get **copied** Pimage cache via name(key).
|
|
476
|
-
|
|
477
|
-
This method doesn't return original object.
|
|
478
|
-
But **copied** object.
|
|
479
|
-
So, you can modify returned Pimage object.
|
|
480
|
-
It doesn't harm original cached Pimage object.
|
|
481
|
-
|
|
482
|
-
Args:
|
|
483
|
-
name: cache key.
|
|
484
|
-
|
|
485
|
-
Returns:
|
|
486
|
-
Pimage: copy of original cached object.
|
|
487
|
-
|
|
488
|
-
"""
|
|
489
|
-
|
|
490
|
-
if not cls.cache_exist(name):
|
|
491
|
-
raise ValueError(f'Pimage "{name}" is not cached.')
|
|
492
|
-
return cls._cache[name].copy()
|
|
493
|
-
|
|
494
|
-
@classmethod
|
|
495
|
-
def cache_delete(cls, name: str) -> None:
|
|
496
|
-
"""Delete Pimage cache
|
|
497
|
-
|
|
498
|
-
Delete Pimage cache if exist.
|
|
499
|
-
If not exist, just ignore deletion request.
|
|
500
|
-
|
|
501
|
-
Args:
|
|
502
|
-
name: cache key.
|
|
503
|
-
|
|
504
|
-
Returns:
|
|
505
|
-
None
|
|
506
|
-
|
|
507
|
-
"""
|
|
508
|
-
|
|
509
|
-
if cls.cache_exist(name):
|
|
510
|
-
del cls._cache[name]
|