svg-ultralight 0.39.0__tar.gz → 0.39.1__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 svg-ultralight might be problematic. Click here for more details.
- {svg_ultralight-0.39.0/src/svg_ultralight.egg-info → svg_ultralight-0.39.1}/PKG-INFO +1 -1
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/pyproject.toml +2 -2
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/bounding_boxes/supports_bounds.py +1 -1
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/bounding_boxes/type_bound_collection.py +1 -1
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/bounding_boxes/type_bound_element.py +1 -1
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/bounding_boxes/type_bounding_box.py +2 -12
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/bounding_boxes/type_padded_text.py +43 -4
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/transformations.py +10 -3
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1/src/svg_ultralight.egg-info}/PKG-INFO +1 -1
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/tests/test_bounding.py +3 -2
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/tests/test_queries.py +1 -1
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/.gitignore +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/.pre-commit-config.yaml +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/README.md +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/setup.cfg +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/__init__.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/animate.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/bounding_boxes/__init__.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/bounding_boxes/bound_helpers.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/constructors/__init__.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/constructors/new_element.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/image_ops.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/inkscape.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/layout.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/main.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/metadata.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/nsmap.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/py.typed +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/query.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/root_elements.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/string_conversion.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/strings/__init__.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/strings/svg_strings.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/unit_conversion.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight.egg-info/SOURCES.txt +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight.egg-info/dependency_links.txt +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight.egg-info/requires.txt +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight.egg-info/top_level.txt +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/tests/__init__.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/tests/conftest.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/tests/resources/arrow.svg +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/tests/test_inkscape.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/tests/test_layout.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/tests/test_matrices.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/tests/test_metadata.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/tests/test_new_element.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/tests/test_root_elements.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/tests/test_string_conversion.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/tests/test_svg_ultralight.py +0 -0
- {svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/tox.ini +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "svg-ultralight"
|
|
3
|
-
version = "0.39.
|
|
3
|
+
version = "0.39.1"
|
|
4
4
|
description = "a sensible way to create svg files with Python"
|
|
5
5
|
authors = [{ name = "Shay Hill", email = "shay_public@hotmail.com" }]
|
|
6
6
|
license = { text = "MIT" }
|
|
@@ -42,7 +42,7 @@ convention = "pep257"
|
|
|
42
42
|
|
|
43
43
|
[tool.commitizen]
|
|
44
44
|
name = "cz_conventional_commits"
|
|
45
|
-
version = "0.39.
|
|
45
|
+
version = "0.39.1"
|
|
46
46
|
tag_format = "$version"
|
|
47
47
|
version_files = ["pyproject.toml:^version"]
|
|
48
48
|
annotated_tag = true
|
|
@@ -59,21 +59,11 @@ class HasBoundingBox(SupportsBounds):
|
|
|
59
59
|
)
|
|
60
60
|
return c0, c1, c2, c3
|
|
61
61
|
|
|
62
|
-
def _scale_scale_by_uniform_scalar(self, scalar: float) -> None:
|
|
63
|
-
"""Scale the bounding box uniformly by a factor.
|
|
64
|
-
|
|
65
|
-
:param scale: scale factor
|
|
66
|
-
Unlike self.scale, this does not set the scale, but scales the scale. So if
|
|
67
|
-
the current scale is (2, 6), and you call this with a scalar of 2, the new
|
|
68
|
-
scale will be (4, 12).
|
|
69
|
-
"""
|
|
70
|
-
self.transform(scale=(scalar, scalar))
|
|
71
|
-
|
|
72
62
|
def transform(
|
|
73
63
|
self,
|
|
74
64
|
transformation: _Matrix | None = None,
|
|
75
65
|
*,
|
|
76
|
-
scale: tuple[float, float] | None = None,
|
|
66
|
+
scale: tuple[float, float] | float | None = None,
|
|
77
67
|
dx: float | None = None,
|
|
78
68
|
dy: float | None = None,
|
|
79
69
|
):
|
|
@@ -241,7 +231,7 @@ class HasBoundingBox(SupportsBounds):
|
|
|
241
231
|
"""
|
|
242
232
|
current_x = self.x
|
|
243
233
|
current_y = self.y
|
|
244
|
-
self.
|
|
234
|
+
self.transform(scale=value / self.width)
|
|
245
235
|
self.x = current_x
|
|
246
236
|
self.y = current_y
|
|
247
237
|
|
|
@@ -122,7 +122,6 @@ class PaddedText(BoundElement):
|
|
|
122
122
|
self.y,
|
|
123
123
|
self.width,
|
|
124
124
|
self.height,
|
|
125
|
-
self.unpadded_bbox.transformation,
|
|
126
125
|
)
|
|
127
126
|
|
|
128
127
|
@bbox.setter
|
|
@@ -139,7 +138,7 @@ class PaddedText(BoundElement):
|
|
|
139
138
|
self,
|
|
140
139
|
transformation: _Matrix | None = None,
|
|
141
140
|
*,
|
|
142
|
-
scale: tuple[float, float] | None = None,
|
|
141
|
+
scale: tuple[float, float] | float | None = None,
|
|
143
142
|
dx: float | None = None,
|
|
144
143
|
dy: float | None = None,
|
|
145
144
|
):
|
|
@@ -208,7 +207,12 @@ class PaddedText(BoundElement):
|
|
|
208
207
|
*and* y2) when scaling.
|
|
209
208
|
"""
|
|
210
209
|
y2 = self.y2
|
|
211
|
-
|
|
210
|
+
|
|
211
|
+
no_margins_old = self.unpadded_bbox.width
|
|
212
|
+
no_margins_new = value - self.lpad - self.rpad
|
|
213
|
+
scale = no_margins_new / no_margins_old
|
|
214
|
+
self.transform(scale=(scale, scale))
|
|
215
|
+
|
|
212
216
|
self.y2 = y2
|
|
213
217
|
|
|
214
218
|
@property
|
|
@@ -226,7 +230,10 @@ class PaddedText(BoundElement):
|
|
|
226
230
|
:param height: The new height of this line of text.
|
|
227
231
|
:effects: the text_element bounding box is scaled to height - tpad - bpad.
|
|
228
232
|
"""
|
|
229
|
-
|
|
233
|
+
y2 = self.y2
|
|
234
|
+
scale = value / self.height
|
|
235
|
+
self.transform(scale=(scale, scale))
|
|
236
|
+
self.y2 = y2
|
|
230
237
|
|
|
231
238
|
@property
|
|
232
239
|
def x(self) -> float:
|
|
@@ -244,6 +251,22 @@ class PaddedText(BoundElement):
|
|
|
244
251
|
"""
|
|
245
252
|
self.transform(dx=value + self.lpad - self.unpadded_bbox.x)
|
|
246
253
|
|
|
254
|
+
@property
|
|
255
|
+
def cx(self) -> float:
|
|
256
|
+
"""The horizontal center of this line of text.
|
|
257
|
+
|
|
258
|
+
:return: The horizontal center of this line of text.
|
|
259
|
+
"""
|
|
260
|
+
return self.x + self.width / 2
|
|
261
|
+
|
|
262
|
+
@cx.setter
|
|
263
|
+
def cx(self, value: float) -> None:
|
|
264
|
+
"""Set the horizontal center of this line of text.
|
|
265
|
+
|
|
266
|
+
:param value: The horizontal center of this line of text.
|
|
267
|
+
"""
|
|
268
|
+
self.x += value - self.cx
|
|
269
|
+
|
|
247
270
|
@property
|
|
248
271
|
def x2(self) -> float:
|
|
249
272
|
"""The right margin of this line of text.
|
|
@@ -276,6 +299,22 @@ class PaddedText(BoundElement):
|
|
|
276
299
|
"""
|
|
277
300
|
self.transform(dy=value + self.tpad - self.unpadded_bbox.y)
|
|
278
301
|
|
|
302
|
+
@property
|
|
303
|
+
def cy(self) -> float:
|
|
304
|
+
"""The horizontal center of this line of text.
|
|
305
|
+
|
|
306
|
+
:return: The horizontal center of this line of text.
|
|
307
|
+
"""
|
|
308
|
+
return self.y + self.height / 2
|
|
309
|
+
|
|
310
|
+
@cy.setter
|
|
311
|
+
def cy(self, value: float) -> None:
|
|
312
|
+
"""Set the horizontal center of this line of text.
|
|
313
|
+
|
|
314
|
+
:param value: The horizontal center of this line of text.
|
|
315
|
+
"""
|
|
316
|
+
self.y += value - self.cy
|
|
317
|
+
|
|
279
318
|
@property
|
|
280
319
|
def y2(self) -> float:
|
|
281
320
|
"""The bottom of this line of text.
|
|
@@ -105,7 +105,7 @@ def get_transform_matrix(elem: EtreeElement) -> _Matrix:
|
|
|
105
105
|
def new_transformation_matrix(
|
|
106
106
|
transformation: _Matrix | None = None,
|
|
107
107
|
*,
|
|
108
|
-
scale: tuple[float, float] | None = None,
|
|
108
|
+
scale: tuple[float, float] | float | None = None,
|
|
109
109
|
dx: float | None = None,
|
|
110
110
|
dy: float | None = None,
|
|
111
111
|
) -> _Matrix:
|
|
@@ -115,10 +115,17 @@ def new_transformation_matrix(
|
|
|
115
115
|
svg-style transformation matrix.
|
|
116
116
|
"""
|
|
117
117
|
transformation = transformation or (1, 0, 0, 1, 0, 0)
|
|
118
|
-
|
|
118
|
+
|
|
119
|
+
if isinstance(scale, float):
|
|
120
|
+
scale_x, scale_y = (scale, scale)
|
|
121
|
+
elif scale is None:
|
|
122
|
+
scale_x, scale_y = (1, 1)
|
|
123
|
+
else:
|
|
124
|
+
scale_x, scale_y = cast("tuple[float, float]", scale)
|
|
125
|
+
|
|
119
126
|
dx = dx or 0
|
|
120
127
|
dy = dy or 0
|
|
121
|
-
return mat_dot((
|
|
128
|
+
return mat_dot((scale_x, 0, 0, scale_y, dx, dy), transformation)
|
|
122
129
|
|
|
123
130
|
|
|
124
131
|
def transform_element(elem: EtreeElement, matrix: _Matrix) -> EtreeElement:
|
|
@@ -150,10 +150,11 @@ class TestPaddedText:
|
|
|
150
150
|
assert bound_element.x2 == 146.0
|
|
151
151
|
|
|
152
152
|
def test_height(self, bound_element: PaddedText):
|
|
153
|
+
y2 = bound_element.y2
|
|
153
154
|
assert bound_element.height == 204.0
|
|
154
155
|
bound_element.height = 250.0
|
|
155
|
-
assert math.isclose(bound_element.height,
|
|
156
|
-
assert bound_element.y2
|
|
156
|
+
assert math.isclose(bound_element.height, 250)
|
|
157
|
+
assert math.isclose(bound_element.y2, y2)
|
|
157
158
|
|
|
158
159
|
def test_aliases(self, bound_element: PaddedText):
|
|
159
160
|
assert bound_element.lmargin == bound_element.x
|
|
@@ -63,7 +63,7 @@ class TestBoundingBox:
|
|
|
63
63
|
bbox = BoundingBox(100, 200, 300, 400)
|
|
64
64
|
assert bbox.scale == (1.0, 1.0)
|
|
65
65
|
bbox.scale = (3.0, 3.0)
|
|
66
|
-
bbox.
|
|
66
|
+
bbox.transform(scale=(10.0, 10.0))
|
|
67
67
|
assert bbox.scale == (30.0, 30.0)
|
|
68
68
|
assert bbox.x == 3000
|
|
69
69
|
assert bbox.y == 6000
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/bounding_boxes/__init__.py
RENAMED
|
File without changes
|
{svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/bounding_boxes/bound_helpers.py
RENAMED
|
File without changes
|
|
File without changes
|
{svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight/constructors/new_element.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{svg_ultralight-0.39.0 → svg_ultralight-0.39.1}/src/svg_ultralight.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|