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
constants.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from PySide6 import QtCore, QtGui
|
|
2
|
+
|
|
3
|
+
PALETTE_MIME = "application/x-drawsvg-shape"
|
|
4
|
+
SHAPES = (
|
|
5
|
+
"Rectangle",
|
|
6
|
+
"Rounded Rectangle",
|
|
7
|
+
"Split Rounded Rectangle",
|
|
8
|
+
"Ellipse",
|
|
9
|
+
"Circle",
|
|
10
|
+
"Triangle",
|
|
11
|
+
"Diamond",
|
|
12
|
+
"Line",
|
|
13
|
+
"Arrow",
|
|
14
|
+
"Block Arrow",
|
|
15
|
+
"Curvy Right Bracket",
|
|
16
|
+
"Text",
|
|
17
|
+
"Folder Tree",
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
DEFAULTS = {
|
|
21
|
+
"Rectangle": (160.0, 100.0), # w, h
|
|
22
|
+
"Rounded Rectangle": (160.0, 100.0), # w, h
|
|
23
|
+
"Split Rounded Rectangle": (180.0, 120.0), # w, h
|
|
24
|
+
"Ellipse": (160.0, 100.0), # w, h
|
|
25
|
+
"Circle": (100.0, 100.0), # diameter, diameter
|
|
26
|
+
"Triangle": (160.0, 100.0), # w, h
|
|
27
|
+
"Diamond": (140.0, 140.0), # w, h
|
|
28
|
+
"Line": (150.0, 0.0), # length, (unused)
|
|
29
|
+
"Arrow": (150.0, 0.0), # length, (unused)
|
|
30
|
+
"Block Arrow": (200.0, 120.0), # w, h
|
|
31
|
+
"Curvy Right Bracket": (80.0, 160.0), # w, h
|
|
32
|
+
"Text": (100.0, 50.0), # placeholder bbox
|
|
33
|
+
"Folder Tree": (240.0, 200.0), # auto-sized, reference bbox
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
PEN_NORMAL = QtGui.QPen(QtGui.QColor("#000"), 2)
|
|
37
|
+
SELECTED_COLOR = QtGui.QColor("#16CCFA")
|
|
38
|
+
PEN_SELECTED = QtGui.QPen(SELECTED_COLOR, 1, QtCore.Qt.PenStyle.DashLine)
|
|
39
|
+
PEN_SELECTED.setCosmetic(True)
|
|
40
|
+
DEFAULT_FILL = QtGui.QBrush(QtCore.Qt.white)
|
|
41
|
+
DEFAULT_TEXT_COLOR = QtGui.QColor("#000")
|
|
42
|
+
DEFAULT_FONT_FAMILY = "Arial"
|
|
43
|
+
|
|
44
|
+
# Default dash patterns used when exporting/importing common pen styles.
|
|
45
|
+
PEN_STYLE_DASH_ARRAYS = {
|
|
46
|
+
QtCore.Qt.PenStyle.SolidLine: (),
|
|
47
|
+
QtCore.Qt.PenStyle.DashLine: (4.0, 4.0),
|
|
48
|
+
QtCore.Qt.PenStyle.DotLine: (1.0, 4.0),
|
|
49
|
+
}
|
|
@@ -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,28 @@
|
|
|
1
|
+
app_info.py,sha256=ivd6c8mHFlBWCEkrR0lWVu_GRU6f7U-cn5DZ3-ENB4U,1758
|
|
2
|
+
canvas_view.py,sha256=b8bZxpps0wwoBGvG9HzmriQXU52RQSRlVMAIVAPQkYU,100049
|
|
3
|
+
constants.py,sha256=ogc2FJsUCiqSIrHGceZrdMl6JHObom2GhKXi4A06UC4,1581
|
|
4
|
+
export_drawsvg.py,sha256=5WcuA0BNiXigG5FVeKAH-RS9pMR1-D2Ay0F937PWTQI,40550
|
|
5
|
+
import_drawsvg.py,sha256=V7G_WcH296mBC0MxAjMyvJ8OzRE5ZUHlNRlDmlXvxlw,37330
|
|
6
|
+
main.py,sha256=uSTXMvdG5mxYiMYf2i_8pyFkgvMMlJbkwa4mD-Ekqhg,563
|
|
7
|
+
main_window.py,sha256=ZWDIsC9aq69G7l6w3T89yUXQaFtQG3sc5iKRSEGoHTA,9652
|
|
8
|
+
palette.py,sha256=dOuxkjkLQ-ZytkdxqLOhvLGboIpfFipJXsP4SxHDCyM,21646
|
|
9
|
+
properties_panel.py,sha256=ZciepSv5Z27hk_1rWoBtq617qEmzyg-Oq2GaxC27kMY,53360
|
|
10
|
+
items/__init__.py,sha256=CdcCufphy0Jlf39oJMKPo7Xb4eSvr5GcuIlscvnbe1k,1472
|
|
11
|
+
items/base.py,sha256=kaOkNpd7GdDNErlQygoDXQghXoUtYXm_3fL25yTL5o8,22866
|
|
12
|
+
items/labels.py,sha256=yazc-Vap_esluc4dF9h0g1IZLlo3tbxia9jPL66ZlqA,9804
|
|
13
|
+
items/text.py,sha256=8BX-N4eMjips0D8bcWbVR08WgYeRlG2fwugk8UYbePU,12805
|
|
14
|
+
items/shapes/__init__.py,sha256=Yrb80BtgEiUYaeNlCCZw_6aHvciygvRy3588B1wPsZY,561
|
|
15
|
+
items/shapes/curves.py,sha256=w3vyndaGlqigAJ-_nmdheFoSEPQrhos_RL_X_Pwu2-c,5200
|
|
16
|
+
items/shapes/lines.py,sha256=pN8qiVPBjFTy0QTsGx4vbxFXqSmz3rIvVQKdGvYd58w,17664
|
|
17
|
+
items/shapes/polygons.py,sha256=eQ_r8lg5Nt2waIB3uKLeYGwB5alQOQUOS-o4GlLOiFk,13143
|
|
18
|
+
items/shapes/rects.py,sha256=g_hrkFfwzkIy0Z2YMXxp1O-WTrnKHIyuDmyHFklVY3s,11503
|
|
19
|
+
items/widgets/__init__.py,sha256=bC-cjDP_CEXpEA-Xlr7inAJ0YH4kcp9cSHXoVweDZGs,186
|
|
20
|
+
items/widgets/folder_tree.py,sha256=7yprT-51xU0Spgpz62zvSNPn2yYbvUvFH1hlK4-OJvQ,15043
|
|
21
|
+
ui/__init__.py,sha256=fc6wAQKooQXPHSfO9PdcD5FPriERDWUdvuJSmzHfhpQ,56
|
|
22
|
+
ui/main_window.ui,sha256=OmnMIUq4T1YjP1iVMGTUd-L8VKsCgLbCHIjx_PgbBXw,4346
|
|
23
|
+
ui/properties_panel.ui,sha256=v0zNct6PZBuFzhmYTPyx-toLAtJP2eFzRAUAVTsYHSA,35679
|
|
24
|
+
drawsvg_ui-0.4.0.dist-info/METADATA,sha256=g0hkiT0r6sI053gZ3JGjTxpg2GYvqTEQkrwxrNpTBxc,3921
|
|
25
|
+
drawsvg_ui-0.4.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
26
|
+
drawsvg_ui-0.4.0.dist-info/entry_points.txt,sha256=SUUEwp3n44haFICb66Jv9gO8_jabgTXOUqC-FUHnpk0,37
|
|
27
|
+
drawsvg_ui-0.4.0.dist-info/top_level.txt,sha256=gGj1MC4gg01_Ye4LlevrdAMIIfPJgOUi7PD1TCVE0sk,112
|
|
28
|
+
drawsvg_ui-0.4.0.dist-info/RECORD,,
|