drawsvg-ui 0.4.0__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.
- drawsvg_ui-0.4.0/PKG-INFO +86 -0
- drawsvg_ui-0.4.0/README.md +73 -0
- drawsvg_ui-0.4.0/pyproject.toml +53 -0
- drawsvg_ui-0.4.0/setup.cfg +4 -0
- drawsvg_ui-0.4.0/src/app_info.py +61 -0
- drawsvg_ui-0.4.0/src/canvas_view.py +2506 -0
- drawsvg_ui-0.4.0/src/constants.py +49 -0
- drawsvg_ui-0.4.0/src/drawsvg_ui.egg-info/PKG-INFO +86 -0
- drawsvg_ui-0.4.0/src/drawsvg_ui.egg-info/SOURCES.txt +31 -0
- drawsvg_ui-0.4.0/src/drawsvg_ui.egg-info/dependency_links.txt +1 -0
- drawsvg_ui-0.4.0/src/drawsvg_ui.egg-info/entry_points.txt +2 -0
- drawsvg_ui-0.4.0/src/drawsvg_ui.egg-info/requires.txt +5 -0
- drawsvg_ui-0.4.0/src/drawsvg_ui.egg-info/top_level.txt +11 -0
- drawsvg_ui-0.4.0/src/export_drawsvg.py +1700 -0
- drawsvg_ui-0.4.0/src/import_drawsvg.py +807 -0
- drawsvg_ui-0.4.0/src/items/__init__.py +66 -0
- drawsvg_ui-0.4.0/src/items/base.py +606 -0
- drawsvg_ui-0.4.0/src/items/labels.py +247 -0
- drawsvg_ui-0.4.0/src/items/shapes/__init__.py +20 -0
- drawsvg_ui-0.4.0/src/items/shapes/curves.py +139 -0
- drawsvg_ui-0.4.0/src/items/shapes/lines.py +439 -0
- drawsvg_ui-0.4.0/src/items/shapes/polygons.py +359 -0
- drawsvg_ui-0.4.0/src/items/shapes/rects.py +310 -0
- drawsvg_ui-0.4.0/src/items/text.py +331 -0
- drawsvg_ui-0.4.0/src/items/widgets/__init__.py +5 -0
- drawsvg_ui-0.4.0/src/items/widgets/folder_tree.py +415 -0
- drawsvg_ui-0.4.0/src/main.py +23 -0
- drawsvg_ui-0.4.0/src/main_window.py +254 -0
- drawsvg_ui-0.4.0/src/palette.py +556 -0
- drawsvg_ui-0.4.0/src/properties_panel.py +1406 -0
- drawsvg_ui-0.4.0/src/ui/__init__.py +1 -0
- drawsvg_ui-0.4.0/src/ui/main_window.ui +157 -0
- drawsvg_ui-0.4.0/src/ui/properties_panel.ui +996 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: drawsvg-ui
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: GUI for creating drawsvg scenes with PySide6
|
|
5
|
+
Author: UI_drawsvg maintainers
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: drawsvg<3,>=2.4
|
|
9
|
+
Requires-Dist: PySide6<7,>=6.9.2
|
|
10
|
+
Requires-Dist: PySide6-Addons<7,>=6.9.2
|
|
11
|
+
Requires-Dist: PySide6-Essentials<7,>=6.9.2
|
|
12
|
+
Requires-Dist: shiboken6<7,>=6.9.2
|
|
13
|
+
|
|
14
|
+
# DrawSVG UI
|
|
15
|
+
|
|
16
|
+
This repository provides a graphical user interface designed to make it easier to create files with the [drawsvg](https://pypi.org/project/drawsvg/) library.
|
|
17
|
+
Instead of writing raw Python code by hand, you can visually place, move, and edit shapes on a canvas, then export your work as a ready-to-use `drawsvg` file. The UI runs on PySide6 and comes with a property inspector, snapping/grid helpers and a set of ready-made shapes.
|
|
18
|
+
|
|
19
|
+
The goal of this project is to help users quickly prototype and generate `drawsvg` code through an intuitive drag-and-drop UI.
|
|
20
|
+
|
|
21
|
+
## Requirements
|
|
22
|
+
|
|
23
|
+
The application requires **Python 3.10**.
|
|
24
|
+
Dependencies include:
|
|
25
|
+
|
|
26
|
+
* **drawsvg**
|
|
27
|
+
* **PySide6**
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## Install via PyPI
|
|
31
|
+
You can install the packaged app and launch it via the generated executable script:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
python -m pip install --upgrade drawsvg-ui
|
|
35
|
+
drawsvg-ui # on Windows this is available as drawsvg-ui.exe
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## Install all via dependencies with:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
python -m pip install -r requirements.txt
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Running the Application
|
|
46
|
+
After installing the dependencies, start the application with:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
python src/main.py
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## UI Features
|
|
53
|
+
|
|
54
|
+
### Canvas and navigation
|
|
55
|
+
* A4 canvas with grid/subgrid preview; toggle visibility via `Edit → Show grid`.
|
|
56
|
+
* Snap-to-grid movement and resizing; hold `Alt` to place/drag/resize freely.
|
|
57
|
+
* Automatic extra A4 pages when objects cross page borders; empty pages are cleaned up again.
|
|
58
|
+
* Zoom with `Ctrl`/`Alt` + mouse wheel; pan with middle button or right-button drag (right click on empty space resets zoom).
|
|
59
|
+
* Rotation handle above the selection; snaps to 5° steps, hold `Alt` for smooth rotation with a live angle readout.
|
|
60
|
+
|
|
61
|
+
### Shape palette
|
|
62
|
+
* Drag shapes from the palette or click to drop them at the view center.
|
|
63
|
+
* Shapes: rectangle, rounded rectangle, split rounded rectangle (adjustable header), ellipse/circle, triangle, diamond, line, arrow, block arrow, curvy right bracket, text box, and a folder-tree placeholder.
|
|
64
|
+
|
|
65
|
+
### Editing and layout
|
|
66
|
+
* Rubber-band selection; add to selection with `Ctrl`/`Shift` click; duplicate selection with `Ctrl` + drag.
|
|
67
|
+
* Resize via handles; items snap while moving/resizing unless `Alt` is held.
|
|
68
|
+
* Align multiple items (left/center/right, top/middle/bottom, snap to grid) from the context menu.
|
|
69
|
+
* Group/ungroup selections (`Ctrl+G` / `Ctrl+Shift+G`) and change z-order (bring forward/back).
|
|
70
|
+
* Delete with the `Delete` key or clear everything via `Edit → Clear canvas`. Full undo/redo stack (`Ctrl+Z`, `Ctrl+Y` / `Ctrl+Shift+Z`).
|
|
71
|
+
|
|
72
|
+
### Styling, text, and labels
|
|
73
|
+
* Context menu or properties panel to edit fill/stroke color, opacity, stroke width, and line style (solid/dashed/dotted).
|
|
74
|
+
* Corner radius for rectangles; adjustable divider and separate top/bottom fills for split rounded rectangles.
|
|
75
|
+
* Arrowheads on lines/arrows with configurable width/height; block arrow head/shaft ratios; curvy bracket hook depth.
|
|
76
|
+
* Built-in labels for supported shapes: edit text inline or in the properties panel, set font family/size/color, and horizontal/vertical alignment.
|
|
77
|
+
* Text items support multi-line content, font and padding, alignment, and left-to-right or right-to-left direction.
|
|
78
|
+
|
|
79
|
+
### Properties panel
|
|
80
|
+
* Live inspector synced to the current selection: position, rotation, scale, z-value, size, stroke/fill, and shape-specific options.
|
|
81
|
+
* Dedicated text tab for labels/text content including font, color, padding, alignment, and direction controls.
|
|
82
|
+
|
|
83
|
+
### Import/Export
|
|
84
|
+
* Load or save scenes as ready-to-run `drawsvg` Python files via the `File` menu.
|
|
85
|
+
|
|
86
|
+
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# DrawSVG UI
|
|
2
|
+
|
|
3
|
+
This repository provides a graphical user interface designed to make it easier to create files with the [drawsvg](https://pypi.org/project/drawsvg/) library.
|
|
4
|
+
Instead of writing raw Python code by hand, you can visually place, move, and edit shapes on a canvas, then export your work as a ready-to-use `drawsvg` file. The UI runs on PySide6 and comes with a property inspector, snapping/grid helpers and a set of ready-made shapes.
|
|
5
|
+
|
|
6
|
+
The goal of this project is to help users quickly prototype and generate `drawsvg` code through an intuitive drag-and-drop UI.
|
|
7
|
+
|
|
8
|
+
## Requirements
|
|
9
|
+
|
|
10
|
+
The application requires **Python 3.10**.
|
|
11
|
+
Dependencies include:
|
|
12
|
+
|
|
13
|
+
* **drawsvg**
|
|
14
|
+
* **PySide6**
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Install via PyPI
|
|
18
|
+
You can install the packaged app and launch it via the generated executable script:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
python -m pip install --upgrade drawsvg-ui
|
|
22
|
+
drawsvg-ui # on Windows this is available as drawsvg-ui.exe
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## Install all via dependencies with:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
python -m pip install -r requirements.txt
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Running the Application
|
|
33
|
+
After installing the dependencies, start the application with:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
python src/main.py
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## UI Features
|
|
40
|
+
|
|
41
|
+
### Canvas and navigation
|
|
42
|
+
* A4 canvas with grid/subgrid preview; toggle visibility via `Edit → Show grid`.
|
|
43
|
+
* Snap-to-grid movement and resizing; hold `Alt` to place/drag/resize freely.
|
|
44
|
+
* Automatic extra A4 pages when objects cross page borders; empty pages are cleaned up again.
|
|
45
|
+
* Zoom with `Ctrl`/`Alt` + mouse wheel; pan with middle button or right-button drag (right click on empty space resets zoom).
|
|
46
|
+
* Rotation handle above the selection; snaps to 5° steps, hold `Alt` for smooth rotation with a live angle readout.
|
|
47
|
+
|
|
48
|
+
### Shape palette
|
|
49
|
+
* Drag shapes from the palette or click to drop them at the view center.
|
|
50
|
+
* Shapes: rectangle, rounded rectangle, split rounded rectangle (adjustable header), ellipse/circle, triangle, diamond, line, arrow, block arrow, curvy right bracket, text box, and a folder-tree placeholder.
|
|
51
|
+
|
|
52
|
+
### Editing and layout
|
|
53
|
+
* Rubber-band selection; add to selection with `Ctrl`/`Shift` click; duplicate selection with `Ctrl` + drag.
|
|
54
|
+
* Resize via handles; items snap while moving/resizing unless `Alt` is held.
|
|
55
|
+
* Align multiple items (left/center/right, top/middle/bottom, snap to grid) from the context menu.
|
|
56
|
+
* Group/ungroup selections (`Ctrl+G` / `Ctrl+Shift+G`) and change z-order (bring forward/back).
|
|
57
|
+
* Delete with the `Delete` key or clear everything via `Edit → Clear canvas`. Full undo/redo stack (`Ctrl+Z`, `Ctrl+Y` / `Ctrl+Shift+Z`).
|
|
58
|
+
|
|
59
|
+
### Styling, text, and labels
|
|
60
|
+
* Context menu or properties panel to edit fill/stroke color, opacity, stroke width, and line style (solid/dashed/dotted).
|
|
61
|
+
* Corner radius for rectangles; adjustable divider and separate top/bottom fills for split rounded rectangles.
|
|
62
|
+
* Arrowheads on lines/arrows with configurable width/height; block arrow head/shaft ratios; curvy bracket hook depth.
|
|
63
|
+
* Built-in labels for supported shapes: edit text inline or in the properties panel, set font family/size/color, and horizontal/vertical alignment.
|
|
64
|
+
* Text items support multi-line content, font and padding, alignment, and left-to-right or right-to-left direction.
|
|
65
|
+
|
|
66
|
+
### Properties panel
|
|
67
|
+
* Live inspector synced to the current selection: position, rotation, scale, z-value, size, stroke/fill, and shape-specific options.
|
|
68
|
+
* Dedicated text tab for labels/text content including font, color, padding, alignment, and direction controls.
|
|
69
|
+
|
|
70
|
+
### Import/Export
|
|
71
|
+
* Load or save scenes as ready-to-run `drawsvg` Python files via the `File` menu.
|
|
72
|
+
|
|
73
|
+
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=70", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "drawsvg-ui"
|
|
7
|
+
version = "0.4.0"
|
|
8
|
+
description = "GUI for creating drawsvg scenes with PySide6"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
authors = [{ name = "UI_drawsvg maintainers" }]
|
|
12
|
+
dependencies = [
|
|
13
|
+
"drawsvg>=2.4,<3",
|
|
14
|
+
"PySide6>=6.9.2,<7",
|
|
15
|
+
"PySide6-Addons>=6.9.2,<7",
|
|
16
|
+
"PySide6-Essentials>=6.9.2,<7",
|
|
17
|
+
"shiboken6>=6.9.2,<7",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[project.gui-scripts]
|
|
21
|
+
drawsvg-ui = "main:main"
|
|
22
|
+
|
|
23
|
+
[tool.setuptools]
|
|
24
|
+
package-dir = { "" = "src" }
|
|
25
|
+
include-package-data = true
|
|
26
|
+
py-modules = [
|
|
27
|
+
"app_info",
|
|
28
|
+
"canvas_view",
|
|
29
|
+
"constants",
|
|
30
|
+
"export_drawsvg",
|
|
31
|
+
"import_drawsvg",
|
|
32
|
+
"main",
|
|
33
|
+
"main_window",
|
|
34
|
+
"palette",
|
|
35
|
+
"properties_panel",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[tool.setuptools.packages.find]
|
|
39
|
+
where = ["src"]
|
|
40
|
+
include = ["items*", "ui*"]
|
|
41
|
+
|
|
42
|
+
[tool.setuptools.package-data]
|
|
43
|
+
ui = ["*.ui"]
|
|
44
|
+
|
|
45
|
+
[tool.bumpversion]
|
|
46
|
+
current_version = "0.4.0"
|
|
47
|
+
commit = true
|
|
48
|
+
tag = true
|
|
49
|
+
|
|
50
|
+
[[tool.bumpversion.files]]
|
|
51
|
+
filename = "pyproject.toml"
|
|
52
|
+
search = 'version = "{current_version}"'
|
|
53
|
+
replace = 'version = "{new_version}"'
|
|
@@ -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
|