drawsvg-ui 0.4.0__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.
- app_info.py +61 -0
- canvas_view.py +2506 -0
- constants.py +49 -0
- drawsvg_ui-0.4.0.dist-info/METADATA +86 -0
- drawsvg_ui-0.4.0.dist-info/RECORD +28 -0
- drawsvg_ui-0.4.0.dist-info/WHEEL +5 -0
- drawsvg_ui-0.4.0.dist-info/entry_points.txt +2 -0
- drawsvg_ui-0.4.0.dist-info/top_level.txt +11 -0
- export_drawsvg.py +1700 -0
- import_drawsvg.py +807 -0
- items/__init__.py +66 -0
- items/base.py +606 -0
- items/labels.py +247 -0
- items/shapes/__init__.py +20 -0
- items/shapes/curves.py +139 -0
- items/shapes/lines.py +439 -0
- items/shapes/polygons.py +359 -0
- items/shapes/rects.py +310 -0
- items/text.py +331 -0
- items/widgets/__init__.py +5 -0
- items/widgets/folder_tree.py +415 -0
- main.py +23 -0
- main_window.py +254 -0
- palette.py +556 -0
- properties_panel.py +1406 -0
- ui/__init__.py +1 -0
- ui/main_window.ui +157 -0
- ui/properties_panel.ui +996 -0
app_info.py
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from importlib import metadata
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Optional
|
|
6
|
+
|
|
7
|
+
PACKAGE_NAME = "drawsvg-ui"
|
|
8
|
+
GITHUB_URL = "https://github.com/Taron686/UI_drawsvg"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def get_version() -> str:
|
|
12
|
+
"""
|
|
13
|
+
Resolve the application version from installed metadata when available.
|
|
14
|
+
Falls back to reading pyproject.toml so running from a checkout still shows a version.
|
|
15
|
+
"""
|
|
16
|
+
try:
|
|
17
|
+
return metadata.version(PACKAGE_NAME)
|
|
18
|
+
except metadata.PackageNotFoundError:
|
|
19
|
+
pass
|
|
20
|
+
|
|
21
|
+
version = _read_version_from_pyproject()
|
|
22
|
+
return version or "0.0.0"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _read_version_from_pyproject() -> Optional[str]:
|
|
26
|
+
"""Best-effort lookup of the version field in pyproject.toml when running from source."""
|
|
27
|
+
pyproject_path = Path(__file__).resolve().parent.parent / "pyproject.toml"
|
|
28
|
+
if not pyproject_path.is_file():
|
|
29
|
+
return None
|
|
30
|
+
|
|
31
|
+
try:
|
|
32
|
+
content = pyproject_path.read_text(encoding="utf-8")
|
|
33
|
+
except OSError:
|
|
34
|
+
return None
|
|
35
|
+
|
|
36
|
+
# Prefer tomllib when available (Python 3.11+ or backport)
|
|
37
|
+
try:
|
|
38
|
+
import tomllib # type: ignore
|
|
39
|
+
except ModuleNotFoundError:
|
|
40
|
+
tomllib = None
|
|
41
|
+
|
|
42
|
+
if tomllib is not None:
|
|
43
|
+
try:
|
|
44
|
+
data = tomllib.loads(content)
|
|
45
|
+
project = data.get("project", {})
|
|
46
|
+
version = project.get("version")
|
|
47
|
+
if version:
|
|
48
|
+
return str(version)
|
|
49
|
+
except Exception:
|
|
50
|
+
pass
|
|
51
|
+
|
|
52
|
+
for line in content.splitlines():
|
|
53
|
+
stripped = line.strip()
|
|
54
|
+
if not stripped.startswith("version"):
|
|
55
|
+
continue
|
|
56
|
+
_, _, remainder = stripped.partition("=")
|
|
57
|
+
candidate = remainder.strip().strip('"').strip("'")
|
|
58
|
+
if candidate:
|
|
59
|
+
return candidate
|
|
60
|
+
|
|
61
|
+
return None
|