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.

Files changed (70) hide show
  1. {drawlib-0.1.4 → drawlib-0.1.6}/PKG-INFO +1 -1
  2. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/__init__.py +1 -1
  3. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/apis.py +17 -11
  4. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/command.py +2 -2
  5. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/core/dimage.py +81 -78
  6. drawlib-0.1.6/drawlib/v0_1/private/core/fonts.py +837 -0
  7. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/core/model.py +53 -54
  8. drawlib-0.1.6/drawlib/v0_1/private/core/theme.py +413 -0
  9. drawlib-0.1.6/drawlib/v0_1/private/core/theme_officials.py +437 -0
  10. drawlib-0.1.6/drawlib/v0_1/private/core/theme_styles.py +1507 -0
  11. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/core/util.py +321 -275
  12. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/core_canvas/base.py +41 -180
  13. drawlib-0.1.6/drawlib/v0_1/private/core_canvas/canvas.py +259 -0
  14. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/core_canvas/image.py +8 -15
  15. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/core_canvas/line.py +9 -49
  16. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/core_canvas/original_arrow.py +11 -23
  17. drawlib-0.1.6/drawlib/v0_1/private/core_canvas/original_polygon.py +418 -0
  18. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/core_canvas/patches.py +201 -211
  19. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/core_canvas/text.py +13 -32
  20. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/icons/phosphor.py +1538 -1549
  21. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/icons/util.py +4 -25
  22. drawlib-0.1.6/drawlib/v0_1/private/smartarts/bubblespeech.py +104 -0
  23. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/smartarts/dsart.py +1 -0
  24. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/smartarts/sourcecode.py +1 -27
  25. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/tools.py +4 -4
  26. drawlib-0.1.6/drawlib/v0_1/private/validators/__init__.py +8 -0
  27. drawlib-0.1.6/drawlib/v0_1/private/validators/args.py +225 -0
  28. drawlib-0.1.6/drawlib/v0_1/private/validators/color.py +51 -0
  29. drawlib-0.1.6/drawlib/v0_1/private/validators/coordinate.py +105 -0
  30. drawlib-0.1.6/drawlib/v0_1/private/validators/image.py +26 -0
  31. drawlib-0.1.6/drawlib/v0_1/private/validators/line.py +35 -0
  32. drawlib-0.1.6/drawlib/v0_1/private/validators/shape.py +42 -0
  33. drawlib-0.1.6/drawlib/v0_1/private/validators/smartarts.py +16 -0
  34. drawlib-0.1.6/drawlib/v0_1/private/validators/style.py +64 -0
  35. drawlib-0.1.6/drawlib/v0_1/private/validators/text.py +23 -0
  36. drawlib-0.1.6/drawlib/v0_1/private/validators/types.py +70 -0
  37. {drawlib-0.1.4 → drawlib-0.1.6}/pyproject.toml +1 -1
  38. drawlib-0.1.4/drawlib/v0_1/private/arg_validator.py +0 -163
  39. drawlib-0.1.4/drawlib/v0_1/private/core/fonts.py +0 -324
  40. drawlib-0.1.4/drawlib/v0_1/private/core/model_validator.py +0 -175
  41. drawlib-0.1.4/drawlib/v0_1/private/core/theme.py +0 -1993
  42. drawlib-0.1.4/drawlib/v0_1/private/core_canvas/canvas.py +0 -88
  43. drawlib-0.1.4/drawlib/v0_1/private/core_canvas/original_polygon.py +0 -600
  44. {drawlib-0.1.4 → drawlib-0.1.6}/LICENSE.txt +0 -0
  45. {drawlib-0.1.4 → drawlib-0.1.6}/README.md +0 -0
  46. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/.pylintrc +0 -0
  47. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/__main__.py +0 -0
  48. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/apis.py +0 -0
  49. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/assets/__init__.py +0 -0
  50. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/assets/v0_1/__init__.py +0 -0
  51. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/assets/v0_1/fonticons/__init__.py +0 -0
  52. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/assets/v0_1/fonts/__init__.py +0 -0
  53. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/__init__.py +0 -0
  54. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/__main__.py +0 -0
  55. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/__init__.py +0 -0
  56. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/core/__init__.py +0 -0
  57. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/core/colors.py +0 -0
  58. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/core_canvas/__init__.py +0 -0
  59. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/download.py +0 -0
  60. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/dutil.py +0 -0
  61. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/icons/__init__.py +0 -0
  62. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/logging.py +0 -0
  63. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/settings.py +0 -0
  64. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/smartarts/__init__.py +0 -0
  65. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/smartarts/cycle.py +0 -0
  66. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/smartarts/groups.py +0 -0
  67. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/smartarts/pyramid.py +0 -0
  68. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/smartarts/table.py +0 -0
  69. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/smartarts/tree.py +0 -0
  70. {drawlib-0.1.4 → drawlib-0.1.6}/drawlib/v0_1/private/util.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: drawlib
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: Python drawing library. Illustration as Code.
5
5
  Home-page: https://www.drawlib.com
6
6
  Author: Yuichi Ito
@@ -24,7 +24,7 @@ subpackages contains latest and old implementations.
24
24
  from typing import Final
25
25
 
26
26
  # please update here when you release new version
27
- VERSION = "0.1.4"
27
+ VERSION = "0.1.6"
28
28
 
29
29
  # might not be changed
30
30
  LIB_NAME: Final[str] = "drawlib"
@@ -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
- FontFile,
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
- # basics
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
- dload,
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 dload
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
- dload(realpath)
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
- _cache: Dict[str, Dimage] = {}
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]