drawlib 0.1.33.dev2__tar.gz → 0.1.35__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.33.dev2 → drawlib-0.1.35}/PKG-INFO +1 -1
- drawlib-0.1.35/drawlib/__init__.py +87 -0
- drawlib-0.1.35/drawlib/__init__.pyi +17 -0
- drawlib-0.1.35/drawlib/__main__.pyi +11 -0
- drawlib-0.1.35/drawlib/apis.pyi +7 -0
- drawlib-0.1.35/drawlib/assets/__init__.pyi +5 -0
- drawlib-0.1.35/drawlib/assets/v0_1/__init__.pyi +5 -0
- drawlib-0.1.35/drawlib/v0_1/__init__.pyi +10 -0
- drawlib-0.1.35/drawlib/v0_1/apis.pyi +5 -0
- drawlib-0.1.35/drawlib/v0_1/private/__init__.pyi +5 -0
- drawlib-0.1.35/drawlib/v0_1/private/command.pyi +165 -0
- drawlib-0.1.35/drawlib/v0_1/private/core/__init__.pyi +5 -0
- drawlib-0.1.35/drawlib/v0_1/private/core/colors.pyi +226 -0
- drawlib-0.1.35/drawlib/v0_1/private/core/dimage.pyi +364 -0
- drawlib-0.1.35/drawlib/v0_1/private/core/fonts.pyi +249 -0
- drawlib-0.1.35/drawlib/v0_1/private/core/model.pyi +1049 -0
- drawlib-0.1.35/drawlib/v0_1/private/core/model_system_default.pyi +11 -0
- drawlib-0.1.35/drawlib/v0_1/private/core/theme.pyi +214 -0
- drawlib-0.1.35/drawlib/v0_1/private/core/theme_officials.pyi +93 -0
- drawlib-0.1.35/drawlib/v0_1/private/core/theme_style_caches.pyi +4122 -0
- drawlib-0.1.35/drawlib/v0_1/private/core/util.pyi +365 -0
- drawlib-0.1.35/drawlib/v0_1/private/core_canvas/base.pyi +200 -0
- drawlib-0.1.35/drawlib/v0_1/private/core_canvas/canvas.pyi +86 -0
- drawlib-0.1.35/drawlib/v0_1/private/core_canvas/image.pyi +59 -0
- drawlib-0.1.35/drawlib/v0_1/private/core_canvas/line.pyi +151 -0
- drawlib-0.1.35/drawlib/v0_1/private/core_canvas/original_arrow.pyi +49 -0
- drawlib-0.1.35/drawlib/v0_1/private/core_canvas/original_polygon.pyi +159 -0
- drawlib-0.1.35/drawlib/v0_1/private/core_canvas/patches.pyi +176 -0
- drawlib-0.1.35/drawlib/v0_1/private/core_canvas/text.pyi +57 -0
- drawlib-0.1.35/drawlib/v0_1/private/download.pyi +38 -0
- drawlib-0.1.35/drawlib/v0_1/private/dutil/__init__.pyi +5 -0
- drawlib-0.1.35/drawlib/v0_1/private/dutil/dutil_canvas.pyi +22 -0
- drawlib-0.1.35/drawlib/v0_1/private/dutil/dutil_color.pyi +71 -0
- drawlib-0.1.35/drawlib/v0_1/private/dutil/dutil_script.pyi +5 -0
- drawlib-0.1.35/drawlib/v0_1/private/dutil/settings.pyi +134 -0
- drawlib-0.1.35/drawlib/v0_1/private/icons/__init__.pyi +5 -0
- drawlib-0.1.35/drawlib/v0_1/private/icons/phosphor.pyi +21429 -0
- drawlib-0.1.35/drawlib/v0_1/private/icons/util.pyi +31 -0
- drawlib-0.1.35/drawlib/v0_1/private/logging.pyi +8 -0
- drawlib-0.1.35/drawlib/v0_1/private/smartarts/__init__.pyi +5 -0
- drawlib-0.1.35/drawlib/v0_1/private/smartarts/bubblespeech.pyi +32 -0
- drawlib-0.1.35/drawlib/v0_1/private/smartarts/dsart.pyi +5 -0
- drawlib-0.1.35/drawlib/v0_1/private/smartarts/sourcecode.pyi +87 -0
- drawlib-0.1.35/drawlib/v0_1/private/util.pyi +149 -0
- drawlib-0.1.35/drawlib/v0_1/private/validators/args.pyi +75 -0
- drawlib-0.1.35/drawlib/v0_1/private/validators/color.pyi +33 -0
- drawlib-0.1.35/drawlib/v0_1/private/validators/coordinate.pyi +103 -0
- drawlib-0.1.35/drawlib/v0_1/private/validators/icon.pyi +20 -0
- drawlib-0.1.35/drawlib/v0_1/private/validators/image.pyi +21 -0
- drawlib-0.1.35/drawlib/v0_1/private/validators/line.pyi +43 -0
- drawlib-0.1.35/drawlib/v0_1/private/validators/shape.pyi +43 -0
- drawlib-0.1.35/drawlib/v0_1/private/validators/smartarts.pyi +17 -0
- drawlib-0.1.35/drawlib/v0_1/private/validators/style.pyi +79 -0
- drawlib-0.1.35/drawlib/v0_1/private/validators/text.pyi +21 -0
- drawlib-0.1.35/drawlib/v0_1/private/validators/types.pyi +88 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/pyproject.toml +8 -2
- drawlib-0.1.33.dev2/drawlib/__init__.py +0 -29
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/LICENSE.txt +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/__main__.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/apis.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/assets/__init__.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/assets/v0_1/__init__.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/assets/v0_1/fonticons/__init__.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/assets/v0_1/fonts/__init__.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/__init__.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/__main__.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/apis.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/__init__.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/command.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/core/__init__.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/core/colors.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/core/dimage.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/core/fonts.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/core/model.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/core/model_system_default.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/core/theme.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/core/theme_officials.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/core/theme_style_caches.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/core/util.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/core_canvas/__init__.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/core_canvas/base.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/core_canvas/canvas.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/core_canvas/image.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/core_canvas/line.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/core_canvas/original_arrow.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/core_canvas/original_polygon.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/core_canvas/patches.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/core_canvas/text.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/download.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/dutil/__init__.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/dutil/dutil_canvas.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/dutil/dutil_color.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/dutil/dutil_script.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/dutil/settings.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/icons/__init__.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/icons/phosphor.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/icons/util.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/logging.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/smartarts/__init__.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/smartarts/bubblespeech.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/smartarts/dsart.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/smartarts/sourcecode.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/util.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/validators/__init__.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/validators/args.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/validators/color.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/validators/coordinate.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/validators/icon.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/validators/image.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/validators/line.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/validators/shape.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/validators/smartarts.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/validators/style.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/validators/text.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/drawlib/v0_1/private/validators/types.py +0 -0
- {drawlib-0.1.33.dev2 → drawlib-0.1.35}/pypi.md +0 -0
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
"""Root package."""
|
|
11
|
+
|
|
12
|
+
import re
|
|
13
|
+
import sys
|
|
14
|
+
from typing import Final, List
|
|
15
|
+
|
|
16
|
+
# please update here when you release new version
|
|
17
|
+
LIB_VERSION = "0.1.35"
|
|
18
|
+
|
|
19
|
+
# please list active main committers (1+ commits per month)
|
|
20
|
+
AUTHORS: Final[List[str]] = [
|
|
21
|
+
"Yuichi Ito <yuichi@yuichi.com>",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
# please change accordingly
|
|
25
|
+
LIB_NAME: Final[str] = "drawlib"
|
|
26
|
+
DESCRIPTION: Final[str] = "Python drawing library. Illustration as Code."
|
|
27
|
+
HOMEPAGE: Final[str] = "https://www.drawlib.com"
|
|
28
|
+
REPOSITORY: Final[str] = "https://github.com/yuichi110/drawlib"
|
|
29
|
+
README: Final[str] = "pypi.md"
|
|
30
|
+
|
|
31
|
+
__version__: Final[str] = LIB_VERSION
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _check_version_syntax() -> None: # noqa: C901
|
|
35
|
+
parts = tuple(int(part) if part.isdigit() else part for part in LIB_VERSION.split("."))
|
|
36
|
+
|
|
37
|
+
if not isinstance(parts[0], int):
|
|
38
|
+
raise ValueError(f"Major version must be int. But {LIB_VERSION}")
|
|
39
|
+
|
|
40
|
+
if not isinstance(parts[1], int):
|
|
41
|
+
raise ValueError(f"Minor version must be int. But {LIB_VERSION}")
|
|
42
|
+
|
|
43
|
+
if not isinstance(parts[0], int):
|
|
44
|
+
raise ValueError(f"Patch version must be int. But {LIB_VERSION}")
|
|
45
|
+
|
|
46
|
+
if len(parts) == 3:
|
|
47
|
+
return
|
|
48
|
+
|
|
49
|
+
if len(parts) != 4:
|
|
50
|
+
raise ValueError(
|
|
51
|
+
f'Version syntax is "major.minor.patch" or "major.minor.patch.pre-release". But {LIB_VERSION}',
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
pre_version = parts[3]
|
|
55
|
+
if not isinstance(pre_version, str):
|
|
56
|
+
raise ValueError(f"Pre-release version can't be int. But {LIB_VERSION}")
|
|
57
|
+
|
|
58
|
+
def get_dev_value(text: str) -> int:
|
|
59
|
+
matches = re.findall(r"dev(\d+)", text)
|
|
60
|
+
values = [int(match) for match in matches]
|
|
61
|
+
if not values:
|
|
62
|
+
return -1
|
|
63
|
+
return values[0]
|
|
64
|
+
|
|
65
|
+
def get_rc_value(text: str) -> int:
|
|
66
|
+
matches = re.findall(r"rc(\d+)", text)
|
|
67
|
+
values = [int(match) for match in matches]
|
|
68
|
+
if not values:
|
|
69
|
+
return -1
|
|
70
|
+
return values[0]
|
|
71
|
+
|
|
72
|
+
if get_dev_value(pre_version) >= 1:
|
|
73
|
+
return
|
|
74
|
+
|
|
75
|
+
if get_rc_value(pre_version) >= 1:
|
|
76
|
+
return
|
|
77
|
+
|
|
78
|
+
raise ValueError(f"Pre-release version must be dev<n> or rc<n>. But {LIB_VERSION}")
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
try:
|
|
82
|
+
_check_version_syntax()
|
|
83
|
+
except ValueError as e:
|
|
84
|
+
print(f"System Error. Version syntax has problem. {str(e)}")
|
|
85
|
+
print("Please check drawlib.__init__.py")
|
|
86
|
+
print("Abort.")
|
|
87
|
+
sys.exit(1)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This type stub file was generated by pyright.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import re
|
|
6
|
+
import sys
|
|
7
|
+
from typing import Final, List
|
|
8
|
+
|
|
9
|
+
"""Root package."""
|
|
10
|
+
LIB_VERSION = ...
|
|
11
|
+
AUTHORS: Final[List[str]] = ...
|
|
12
|
+
LIB_NAME: Final[str] = ...
|
|
13
|
+
DESCRIPTION: Final[str] = ...
|
|
14
|
+
HOMEPAGE: Final[str] = ...
|
|
15
|
+
REPOSITORY: Final[str] = ...
|
|
16
|
+
README: Final[str] = ...
|
|
17
|
+
__version__: Final[str] = ...
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This type stub file was generated by pyright.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import List, Literal
|
|
6
|
+
from drawlib.v0_1.private.util import error_handler
|
|
7
|
+
|
|
8
|
+
"""Implementation of drawlib command."""
|
|
9
|
+
def call() -> None:
|
|
10
|
+
"""Handle drawlib command execution.
|
|
11
|
+
|
|
12
|
+
This function serves as the entry point for executing drawlib commands.
|
|
13
|
+
It parses command-line arguments, processes options like showing version info
|
|
14
|
+
or purging font cache, sets logging levels, retrieves target files and directories,
|
|
15
|
+
and executes each target file using the DrawlibExecuter.
|
|
16
|
+
|
|
17
|
+
Raises:
|
|
18
|
+
ValueError: If an invalid logging mode is specified.
|
|
19
|
+
"""
|
|
20
|
+
...
|
|
21
|
+
|
|
22
|
+
class DrawlibArgParser:
|
|
23
|
+
"""Command-line argument parser for drawlib.
|
|
24
|
+
|
|
25
|
+
Parses command-line options related to drawlib execution, such as target files,
|
|
26
|
+
version display, font cache purging, logging modes, and execution modes.
|
|
27
|
+
"""
|
|
28
|
+
def __init__(self) -> None:
|
|
29
|
+
"""
|
|
30
|
+
Initializes a DrawlibArgParser instance.
|
|
31
|
+
|
|
32
|
+
In this method, an ArgumentParser instance is created to define command line options
|
|
33
|
+
for drawlib execution related parameters such as target files, version display, font cache purging,
|
|
34
|
+
logging modes, and execution modes.
|
|
35
|
+
|
|
36
|
+
Returns:
|
|
37
|
+
None
|
|
38
|
+
"""
|
|
39
|
+
...
|
|
40
|
+
|
|
41
|
+
def parse(self) -> None:
|
|
42
|
+
"""Parse command line options.
|
|
43
|
+
|
|
44
|
+
Parses command line options using the ArgumentParser instance.
|
|
45
|
+
It separates special options from main positional arguments and stores them internally.
|
|
46
|
+
|
|
47
|
+
This method must be called before calling any other methods that retrieve parsed options.
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
None
|
|
51
|
+
"""
|
|
52
|
+
...
|
|
53
|
+
|
|
54
|
+
def is_show_version(self) -> bool:
|
|
55
|
+
"""Check if the version option is specified.
|
|
56
|
+
|
|
57
|
+
Checks whether the command line options include `-v` or `--version`.
|
|
58
|
+
If either option is present, it returns True; otherwise, False.
|
|
59
|
+
|
|
60
|
+
Returns:
|
|
61
|
+
bool: True if version option is specified, False otherwise.
|
|
62
|
+
|
|
63
|
+
"""
|
|
64
|
+
...
|
|
65
|
+
|
|
66
|
+
def is_purge_font_cache(self) -> bool:
|
|
67
|
+
"""Check if the purge font cache option is specified.
|
|
68
|
+
|
|
69
|
+
Checks whether the command line options include `--purge_font_cache`.
|
|
70
|
+
If the option is present, it returns True; otherwise, False.
|
|
71
|
+
|
|
72
|
+
Returns:
|
|
73
|
+
bool: True if purge font cache option is specified, False otherwise.
|
|
74
|
+
|
|
75
|
+
"""
|
|
76
|
+
...
|
|
77
|
+
|
|
78
|
+
def get_logging_mode(self) -> Literal["quiet", "normal", "verbose", "developer"]:
|
|
79
|
+
"""Retrieve the logging mode based on command line options.
|
|
80
|
+
|
|
81
|
+
Checks the command line options for logging-related flags:
|
|
82
|
+
- `--quiet`: Returns "quiet" logging mode.
|
|
83
|
+
- `--verbose` or `--debug`: Returns "verbose" logging mode.
|
|
84
|
+
- `--developer`: Returns "developer" logging mode.
|
|
85
|
+
|
|
86
|
+
Raises:
|
|
87
|
+
ValueError: If conflicting logging options are specified.
|
|
88
|
+
|
|
89
|
+
Returns:
|
|
90
|
+
Literal["quiet", "normal", "verbose", "developer"]: Logging mode.
|
|
91
|
+
"""
|
|
92
|
+
...
|
|
93
|
+
|
|
94
|
+
def get_exec_mode(self) -> Literal["none", "auto_clear", "auto_initialize"]:
|
|
95
|
+
"""Retrieve the execution mode based on command line options.
|
|
96
|
+
|
|
97
|
+
Checks the command line options for execution mode flags:
|
|
98
|
+
- `--disable_auto_clear`: Returns "none" execution mode.
|
|
99
|
+
- `--enable_auto_initialize`: Returns "auto_initialize" execution mode.
|
|
100
|
+
|
|
101
|
+
Returns:
|
|
102
|
+
Literal["none", "auto_clear", "auto_initialize"]: Execution mode.
|
|
103
|
+
"""
|
|
104
|
+
...
|
|
105
|
+
|
|
106
|
+
def get_target_files(self) -> List[str]:
|
|
107
|
+
"""Retrieve positional arguments representing target files and directories.
|
|
108
|
+
|
|
109
|
+
Retrieves the positional arguments passed to the drawlib command,
|
|
110
|
+
which are intended as target files or directories for execution.
|
|
111
|
+
|
|
112
|
+
Returns:
|
|
113
|
+
List[str]: List of positional arguments (files and directories).
|
|
114
|
+
"""
|
|
115
|
+
...
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
class DrawlibExecuter:
|
|
120
|
+
"""Executor for running Python files or directories containing drawing code.
|
|
121
|
+
|
|
122
|
+
Executes Python files specified as targets or recursively runs all Python files
|
|
123
|
+
within a specified directory. Handles logging, module loading, and error handling.
|
|
124
|
+
"""
|
|
125
|
+
def __init__(self, mode: Literal["none", "auto_clear", "auto_initialize"]) -> None:
|
|
126
|
+
"""Initializes a DrawlibExecuter instance with the specified mode.
|
|
127
|
+
|
|
128
|
+
Args:
|
|
129
|
+
mode (Literal["none", "auto_clear", "auto_initialize"]):
|
|
130
|
+
The execution mode for handling Python file execution:
|
|
131
|
+
- "none": Executes Python files without clearing canvas between executions.
|
|
132
|
+
- "auto_clear": Automatically clears the canvas between executing each Python file.
|
|
133
|
+
- "auto_initialize": Automatically initializes theme/canvas/image_cache per execution.
|
|
134
|
+
|
|
135
|
+
Raises ValueError if mode is not one of ["none", "auto_clear", "auto_initialize"].
|
|
136
|
+
|
|
137
|
+
Raises:
|
|
138
|
+
ValueError: If mode is not one of ["none", "auto_clear", "auto_initialize"].
|
|
139
|
+
"""
|
|
140
|
+
...
|
|
141
|
+
|
|
142
|
+
@error_handler
|
|
143
|
+
def execute(self, file_or_directory: str) -> None:
|
|
144
|
+
"""Execute the specified Python file or all Python files in the specified directory.
|
|
145
|
+
|
|
146
|
+
Executes the Python file specified by `file_or_directory` or recursively executes all Python files
|
|
147
|
+
found within the specified directory. Each Python file is executed only once.
|
|
148
|
+
|
|
149
|
+
For directories, strongly recommend setting `auto_clear=True` to avoid shared canvas state
|
|
150
|
+
between different Python files.
|
|
151
|
+
|
|
152
|
+
Args:
|
|
153
|
+
file_or_directory (str): Path to the Python file or directory containing Python files to execute.
|
|
154
|
+
|
|
155
|
+
Returns:
|
|
156
|
+
None
|
|
157
|
+
|
|
158
|
+
Raises:
|
|
159
|
+
ValueError: If the specified path `file_or_directory` does not exist.
|
|
160
|
+
|
|
161
|
+
"""
|
|
162
|
+
...
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This type stub file was generated by pyright.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import Final, Tuple
|
|
6
|
+
|
|
7
|
+
"""Color definition module."""
|
|
8
|
+
class ColorsBase:
|
|
9
|
+
"""Base class for color-related classes, providing common attributes."""
|
|
10
|
+
Transparent: Final[Tuple[int, int, int, float]] = ...
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Colors(ColorsBase):
|
|
14
|
+
"""Class representing the 16 basic web colors along with a transparent color."""
|
|
15
|
+
Aqua: Final[Tuple[int, int, int]] = ...
|
|
16
|
+
Black: Final[Tuple[int, int, int]] = ...
|
|
17
|
+
Blue: Final[Tuple[int, int, int]] = ...
|
|
18
|
+
Fuchsia: Final[Tuple[int, int, int]] = ...
|
|
19
|
+
Gray: Final[Tuple[int, int, int]] = ...
|
|
20
|
+
Green: Final[Tuple[int, int, int]] = ...
|
|
21
|
+
Lime: Final[Tuple[int, int, int]] = ...
|
|
22
|
+
Maroon: Final[Tuple[int, int, int]] = ...
|
|
23
|
+
Navy: Final[Tuple[int, int, int]] = ...
|
|
24
|
+
Olive: Final[Tuple[int, int, int]] = ...
|
|
25
|
+
Purple: Final[Tuple[int, int, int]] = ...
|
|
26
|
+
Red: Final[Tuple[int, int, int]] = ...
|
|
27
|
+
Silver: Final[Tuple[int, int, int]] = ...
|
|
28
|
+
Teal: Final[Tuple[int, int, int]] = ...
|
|
29
|
+
White: Final[Tuple[int, int, int]] = ...
|
|
30
|
+
Yellow: Final[Tuple[int, int, int]] = ...
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class Colors140(ColorsBase):
|
|
34
|
+
"""Class representing the 140 basic web colors(CSS Color Module Level3) along with a transparent color."""
|
|
35
|
+
AliceBlue: Final[Tuple[int, int, int]] = ...
|
|
36
|
+
AntiqueWhite: Final[Tuple[int, int, int]] = ...
|
|
37
|
+
Aqua: Final[Tuple[int, int, int]] = ...
|
|
38
|
+
Aquamarine: Final[Tuple[int, int, int]] = ...
|
|
39
|
+
Azure: Final[Tuple[int, int, int]] = ...
|
|
40
|
+
Beige: Final[Tuple[int, int, int]] = ...
|
|
41
|
+
Bisque: Final[Tuple[int, int, int]] = ...
|
|
42
|
+
Black: Final[Tuple[int, int, int]] = ...
|
|
43
|
+
BlanchedAlmond: Final[Tuple[int, int, int]] = ...
|
|
44
|
+
Blue: Final[Tuple[int, int, int]] = ...
|
|
45
|
+
BlueViolet: Final[Tuple[int, int, int]] = ...
|
|
46
|
+
Brown: Final[Tuple[int, int, int]] = ...
|
|
47
|
+
BurlyWood: Final[Tuple[int, int, int]] = ...
|
|
48
|
+
CadetBlue: Final[Tuple[int, int, int]] = ...
|
|
49
|
+
Chartreuse: Final[Tuple[int, int, int]] = ...
|
|
50
|
+
Chocolate: Final[Tuple[int, int, int]] = ...
|
|
51
|
+
Coral: Final[Tuple[int, int, int]] = ...
|
|
52
|
+
CornflowerBlue: Final[Tuple[int, int, int]] = ...
|
|
53
|
+
Cornsilk: Final[Tuple[int, int, int]] = ...
|
|
54
|
+
Crimson: Final[Tuple[int, int, int]] = ...
|
|
55
|
+
Cyan: Final[Tuple[int, int, int]] = ...
|
|
56
|
+
DarkBlue: Final[Tuple[int, int, int]] = ...
|
|
57
|
+
DarkCyan: Final[Tuple[int, int, int]] = ...
|
|
58
|
+
DarkGoldenRod: Final[Tuple[int, int, int]] = ...
|
|
59
|
+
DarkGray: Final[Tuple[int, int, int]] = ...
|
|
60
|
+
DarkGreen: Final[Tuple[int, int, int]] = ...
|
|
61
|
+
DarkKhaki: Final[Tuple[int, int, int]] = ...
|
|
62
|
+
DarkMagenta: Final[Tuple[int, int, int]] = ...
|
|
63
|
+
DarkOliveGreen: Final[Tuple[int, int, int]] = ...
|
|
64
|
+
DarkOrange: Final[Tuple[int, int, int]] = ...
|
|
65
|
+
DarkOrchid: Final[Tuple[int, int, int]] = ...
|
|
66
|
+
DarkRed: Final[Tuple[int, int, int]] = ...
|
|
67
|
+
DarkSalmon: Final[Tuple[int, int, int]] = ...
|
|
68
|
+
DarkSeaGreen: Final[Tuple[int, int, int]] = ...
|
|
69
|
+
DarkSlateBlue: Final[Tuple[int, int, int]] = ...
|
|
70
|
+
DarkSlateGray: Final[Tuple[int, int, int]] = ...
|
|
71
|
+
DarkTurquoise: Final[Tuple[int, int, int]] = ...
|
|
72
|
+
DarkViolet: Final[Tuple[int, int, int]] = ...
|
|
73
|
+
DeepPink: Final[Tuple[int, int, int]] = ...
|
|
74
|
+
DeepSkyBlue: Final[Tuple[int, int, int]] = ...
|
|
75
|
+
DimGray: Final[Tuple[int, int, int]] = ...
|
|
76
|
+
DodgerBlue: Final[Tuple[int, int, int]] = ...
|
|
77
|
+
FireBrick: Final[Tuple[int, int, int]] = ...
|
|
78
|
+
FloralWhite: Final[Tuple[int, int, int]] = ...
|
|
79
|
+
ForestGreen: Final[Tuple[int, int, int]] = ...
|
|
80
|
+
Fuchsia: Final[Tuple[int, int, int]] = ...
|
|
81
|
+
Gainsboro: Final[Tuple[int, int, int]] = ...
|
|
82
|
+
GhostWhite: Final[Tuple[int, int, int]] = ...
|
|
83
|
+
Gold: Final[Tuple[int, int, int]] = ...
|
|
84
|
+
GoldenRod: Final[Tuple[int, int, int]] = ...
|
|
85
|
+
Gray: Final[Tuple[int, int, int]] = ...
|
|
86
|
+
Green: Final[Tuple[int, int, int]] = ...
|
|
87
|
+
GreenYellow: Final[Tuple[int, int, int]] = ...
|
|
88
|
+
HoneyDew: Final[Tuple[int, int, int]] = ...
|
|
89
|
+
HotPink: Final[Tuple[int, int, int]] = ...
|
|
90
|
+
IndianRed: Final[Tuple[int, int, int]] = ...
|
|
91
|
+
Indigo: Final[Tuple[int, int, int]] = ...
|
|
92
|
+
Ivory: Final[Tuple[int, int, int]] = ...
|
|
93
|
+
Khaki: Final[Tuple[int, int, int]] = ...
|
|
94
|
+
Lavender: Final[Tuple[int, int, int]] = ...
|
|
95
|
+
LavenderBlush: Final[Tuple[int, int, int]] = ...
|
|
96
|
+
LawnGreen: Final[Tuple[int, int, int]] = ...
|
|
97
|
+
LemonChiffon: Final[Tuple[int, int, int]] = ...
|
|
98
|
+
LightBlue: Final[Tuple[int, int, int]] = ...
|
|
99
|
+
LightCoral: Final[Tuple[int, int, int]] = ...
|
|
100
|
+
LightCyan: Final[Tuple[int, int, int]] = ...
|
|
101
|
+
LightGoldenRodYellow: Final[Tuple[int, int, int]] = ...
|
|
102
|
+
LightGray: Final[Tuple[int, int, int]] = ...
|
|
103
|
+
LightGreen: Final[Tuple[int, int, int]] = ...
|
|
104
|
+
LightPink: Final[Tuple[int, int, int]] = ...
|
|
105
|
+
LightSalmon: Final[Tuple[int, int, int]] = ...
|
|
106
|
+
LightSeaGreen: Final[Tuple[int, int, int]] = ...
|
|
107
|
+
LightSkyBlue: Final[Tuple[int, int, int]] = ...
|
|
108
|
+
LightSlateGray: Final[Tuple[int, int, int]] = ...
|
|
109
|
+
LightSteelBlue: Final[Tuple[int, int, int]] = ...
|
|
110
|
+
LightYellow: Final[Tuple[int, int, int]] = ...
|
|
111
|
+
Lime: Final[Tuple[int, int, int]] = ...
|
|
112
|
+
LimeGreen: Final[Tuple[int, int, int]] = ...
|
|
113
|
+
Linen: Final[Tuple[int, int, int]] = ...
|
|
114
|
+
Magenta: Final[Tuple[int, int, int]] = ...
|
|
115
|
+
Maroon: Final[Tuple[int, int, int]] = ...
|
|
116
|
+
MediumAquaMarine: Final[Tuple[int, int, int]] = ...
|
|
117
|
+
MediumBlue: Final[Tuple[int, int, int]] = ...
|
|
118
|
+
MediumOrchid: Final[Tuple[int, int, int]] = ...
|
|
119
|
+
MediumPurple: Final[Tuple[int, int, int]] = ...
|
|
120
|
+
MediumSeaGreen: Final[Tuple[int, int, int]] = ...
|
|
121
|
+
MediumSlateBlue: Final[Tuple[int, int, int]] = ...
|
|
122
|
+
MediumSpringGreen: Final[Tuple[int, int, int]] = ...
|
|
123
|
+
MediumTurquoise: Final[Tuple[int, int, int]] = ...
|
|
124
|
+
MediumVioletRed: Final[Tuple[int, int, int]] = ...
|
|
125
|
+
MidnightBlue: Final[Tuple[int, int, int]] = ...
|
|
126
|
+
MintCream: Final[Tuple[int, int, int]] = ...
|
|
127
|
+
MistyRose: Final[Tuple[int, int, int]] = ...
|
|
128
|
+
Moccasin: Final[Tuple[int, int, int]] = ...
|
|
129
|
+
NavajoWhite: Final[Tuple[int, int, int]] = ...
|
|
130
|
+
Navy: Final[Tuple[int, int, int]] = ...
|
|
131
|
+
OldLace: Final[Tuple[int, int, int]] = ...
|
|
132
|
+
Olive: Final[Tuple[int, int, int]] = ...
|
|
133
|
+
OliveDrab: Final[Tuple[int, int, int]] = ...
|
|
134
|
+
Orange: Final[Tuple[int, int, int]] = ...
|
|
135
|
+
OrangeRed: Final[Tuple[int, int, int]] = ...
|
|
136
|
+
Orchid: Final[Tuple[int, int, int]] = ...
|
|
137
|
+
PaleGoldenRod: Final[Tuple[int, int, int]] = ...
|
|
138
|
+
PaleGreen: Final[Tuple[int, int, int]] = ...
|
|
139
|
+
PaleTurquoise: Final[Tuple[int, int, int]] = ...
|
|
140
|
+
PaleVioletRed: Final[Tuple[int, int, int]] = ...
|
|
141
|
+
PapayaWhip: Final[Tuple[int, int, int]] = ...
|
|
142
|
+
PeachPuff: Final[Tuple[int, int, int]] = ...
|
|
143
|
+
Peru: Final[Tuple[int, int, int]] = ...
|
|
144
|
+
Pink: Final[Tuple[int, int, int]] = ...
|
|
145
|
+
Plum: Final[Tuple[int, int, int]] = ...
|
|
146
|
+
PowderBlue: Final[Tuple[int, int, int]] = ...
|
|
147
|
+
Purple: Final[Tuple[int, int, int]] = ...
|
|
148
|
+
RebeccaPurple: Final[Tuple[int, int, int]] = ...
|
|
149
|
+
Red: Final[Tuple[int, int, int]] = ...
|
|
150
|
+
RosyBrown: Final[Tuple[int, int, int]] = ...
|
|
151
|
+
RoyalBlue: Final[Tuple[int, int, int]] = ...
|
|
152
|
+
SaddleBrown: Final[Tuple[int, int, int]] = ...
|
|
153
|
+
Salmon: Final[Tuple[int, int, int]] = ...
|
|
154
|
+
SandyBrown: Final[Tuple[int, int, int]] = ...
|
|
155
|
+
SeaGreen: Final[Tuple[int, int, int]] = ...
|
|
156
|
+
SeaShell: Final[Tuple[int, int, int]] = ...
|
|
157
|
+
Sienna: Final[Tuple[int, int, int]] = ...
|
|
158
|
+
Silver: Final[Tuple[int, int, int]] = ...
|
|
159
|
+
SkyBlue: Final[Tuple[int, int, int]] = ...
|
|
160
|
+
SlateBlue: Final[Tuple[int, int, int]] = ...
|
|
161
|
+
SlateGray: Final[Tuple[int, int, int]] = ...
|
|
162
|
+
Snow: Final[Tuple[int, int, int]] = ...
|
|
163
|
+
SpringGreen: Final[Tuple[int, int, int]] = ...
|
|
164
|
+
SteelBlue: Final[Tuple[int, int, int]] = ...
|
|
165
|
+
Tan: Final[Tuple[int, int, int]] = ...
|
|
166
|
+
Teal: Final[Tuple[int, int, int]] = ...
|
|
167
|
+
Thistle: Final[Tuple[int, int, int]] = ...
|
|
168
|
+
Tomato: Final[Tuple[int, int, int]] = ...
|
|
169
|
+
Turquoise: Final[Tuple[int, int, int]] = ...
|
|
170
|
+
Violet: Final[Tuple[int, int, int]] = ...
|
|
171
|
+
Wheat: Final[Tuple[int, int, int]] = ...
|
|
172
|
+
White: Final[Tuple[int, int, int]] = ...
|
|
173
|
+
WhiteSmoke: Final[Tuple[int, int, int]] = ...
|
|
174
|
+
Yellow: Final[Tuple[int, int, int]] = ...
|
|
175
|
+
YellowGreen: Final[Tuple[int, int, int]] = ...
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
class ColorsThemeEssentials(ColorsBase):
|
|
179
|
+
"""Class representing essential theme colors along with a transparent color."""
|
|
180
|
+
Red: Final[Tuple[int, int, int]] = ...
|
|
181
|
+
LightRed: Final[Tuple[int, int, int]] = ...
|
|
182
|
+
Green: Final[Tuple[int, int, int]] = ...
|
|
183
|
+
LightGreen: Final[Tuple[int, int, int]] = ...
|
|
184
|
+
Blue: Final[Tuple[int, int, int]] = ...
|
|
185
|
+
LightBlue: Final[Tuple[int, int, int]] = ...
|
|
186
|
+
Yellow: Final[Tuple[int, int, int]] = ...
|
|
187
|
+
Purple: Final[Tuple[int, int, int]] = ...
|
|
188
|
+
Orange: Final[Tuple[int, int, int]] = ...
|
|
189
|
+
Navy: Final[Tuple[int, int, int]] = ...
|
|
190
|
+
Pink: Final[Tuple[int, int, int]] = ...
|
|
191
|
+
Charcoal: Final[Tuple[int, int, int]] = ...
|
|
192
|
+
Graphite: Final[Tuple[int, int, int]] = ...
|
|
193
|
+
Gray: Final[Tuple[int, int, int]] = ...
|
|
194
|
+
Silver: Final[Tuple[int, int, int]] = ...
|
|
195
|
+
Snow: Final[Tuple[int, int, int]] = ...
|
|
196
|
+
Teal: Final[Tuple[int, int, int]] = ...
|
|
197
|
+
Olive: Final[Tuple[int, int, int]] = ...
|
|
198
|
+
Brown: Final[Tuple[int, int, int]] = ...
|
|
199
|
+
Black: Final[Tuple[int, int, int]] = ...
|
|
200
|
+
White: Final[Tuple[int, int, int]] = ...
|
|
201
|
+
Aqua: Final[Tuple[int, int, int]] = ...
|
|
202
|
+
GreenYellow: Final[Tuple[int, int, int]] = ...
|
|
203
|
+
Ivory: Final[Tuple[int, int, int]] = ...
|
|
204
|
+
Steel: Final[Tuple[int, int, int]] = ...
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
class ColorsThemeDefault(ColorsBase):
|
|
208
|
+
"""Class representing default theme colors along with a transparent color."""
|
|
209
|
+
Red: Final[Tuple[int, int, int]] = ...
|
|
210
|
+
Green: Final[Tuple[int, int, int]] = ...
|
|
211
|
+
Blue: Final[Tuple[int, int, int]] = ...
|
|
212
|
+
Black: Final[Tuple[int, int, int]] = ...
|
|
213
|
+
White: Final[Tuple[int, int, int]] = ...
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
class ColorsThemeMonochrome(ColorsBase):
|
|
217
|
+
"""Class representing monochrome theme colors along with a transparent color."""
|
|
218
|
+
Black: Final[Tuple[int, int, int]] = ...
|
|
219
|
+
Charcoal: Final[Tuple[int, int, int]] = ...
|
|
220
|
+
Graphite: Final[Tuple[int, int, int]] = ...
|
|
221
|
+
Gray: Final[Tuple[int, int, int]] = ...
|
|
222
|
+
Silver: Final[Tuple[int, int, int]] = ...
|
|
223
|
+
Snow: Final[Tuple[int, int, int]] = ...
|
|
224
|
+
White: Final[Tuple[int, int, int]] = ...
|
|
225
|
+
|
|
226
|
+
|