papyru 2.11.2.dev128__tar.gz → 2.12.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.
- {papyru-2.11.2.dev128/papyru.egg-info → papyru-2.12.0}/PKG-INFO +1 -1
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/create_variant/edit_template/xml.py +26 -10
- {papyru-2.11.2.dev128 → papyru-2.12.0/papyru.egg-info}/PKG-INFO +1 -1
- {papyru-2.11.2.dev128 → papyru-2.12.0}/setup.py +1 -1
- {papyru-2.11.2.dev128 → papyru-2.12.0}/LICENSE.txt +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/README.md +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/bin/generate_jsonschema.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/__init__.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/auth.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/context.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/create_variant/__init__.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/create_variant/component.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/create_variant/constants.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/create_variant/edit_template/__init__.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/create_variant/edit_template/ean.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/create_variant/edit_template/manufacturer_address.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/create_variant/edit_template/motive.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/create_variant/edit_template/render_text.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/create_variant/edit_template/title.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/create_variant/resi.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/logger.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/logger_stdout.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/logger_types.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/middleware.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/problem.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/profiler.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/resource.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/serializer.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/stack_context.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/static/__init__.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/static/apps.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/static/urls.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/static/views.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/utils.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/validation.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/varspool/__init__.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/varspool/assets/Job.json +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/varspool/assets/JobStatusHistory.json +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/varspool/command/__init__.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/varspool/command/config.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/varspool/command/types.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/varspool/serializers.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/varspool/types.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/xml_helper.py +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru.egg-info/SOURCES.txt +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru.egg-info/dependency_links.txt +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru.egg-info/requires.txt +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/papyru.egg-info/top_level.txt +0 -0
- {papyru-2.11.2.dev128 → papyru-2.12.0}/setup.cfg +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
|
+
from typing import Optional
|
|
2
3
|
from xml.etree.ElementTree import Element, SubElement
|
|
3
4
|
|
|
4
5
|
from papyru import XMLHelper
|
|
@@ -10,14 +11,20 @@ class PlaceholderInfo:
|
|
|
10
11
|
placeholder: Element
|
|
11
12
|
|
|
12
13
|
|
|
14
|
+
@dataclass(frozen=True)
|
|
15
|
+
class ImageCrop:
|
|
16
|
+
x: float
|
|
17
|
+
y: float
|
|
18
|
+
width: float
|
|
19
|
+
height: float
|
|
20
|
+
|
|
21
|
+
|
|
13
22
|
@dataclass(frozen=True)
|
|
14
23
|
class ImageInfo:
|
|
15
24
|
location: str
|
|
16
25
|
width: int
|
|
17
26
|
height: int
|
|
18
|
-
|
|
19
|
-
y_pos: int = None
|
|
20
|
-
is_editable: bool = False
|
|
27
|
+
crop: Optional[ImageCrop] = None
|
|
21
28
|
|
|
22
29
|
|
|
23
30
|
def find_placeholder(doc: XMLHelper,
|
|
@@ -86,11 +93,10 @@ def fit_image(doc: XMLHelper,
|
|
|
86
93
|
image_dims = (float(image_info.width),
|
|
87
94
|
float(image_info.height))
|
|
88
95
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
viewbox = _fit_dimensions(wrapper_dims, image_dims)
|
|
96
|
+
viewbox = (_fit_dimensions(wrapper_dims, image_dims)
|
|
97
|
+
if image_info.crop is None else
|
|
98
|
+
(image_info.crop.x, image_info.crop.y,
|
|
99
|
+
image_info.crop.width, image_info.crop.height))
|
|
94
100
|
|
|
95
101
|
doc.set_attribute(ph.wrapper,
|
|
96
102
|
'viewBox',
|
|
@@ -101,11 +107,21 @@ def fit_image(doc: XMLHelper,
|
|
|
101
107
|
'href', image_info.location,
|
|
102
108
|
'xlink' if has_xlink else None)
|
|
103
109
|
|
|
104
|
-
doc.set_attribute(ph.placeholder, 'x', '
|
|
105
|
-
doc.set_attribute(ph.placeholder, 'y', '
|
|
110
|
+
doc.set_attribute(ph.placeholder, 'x', '0.0')
|
|
111
|
+
doc.set_attribute(ph.placeholder, 'y', '0.0')
|
|
106
112
|
doc.set_attribute(ph.placeholder, 'width', '%s' % image_dims[0])
|
|
107
113
|
doc.set_attribute(ph.placeholder, 'height', '%s' % image_dims[1])
|
|
108
114
|
|
|
115
|
+
if image_info.crop is not None:
|
|
116
|
+
doc.set_attribute(ph.placeholder, 'bbox',
|
|
117
|
+
'{"x": %s, "y": %s, "width": %s, "height": %s}'
|
|
118
|
+
% (image_info.crop.x, image_info.crop.y,
|
|
119
|
+
image_info.crop.width,
|
|
120
|
+
image_info.crop.height), 'pap')
|
|
121
|
+
doc.set_attribute(ph.placeholder, 'img-dimensions',
|
|
122
|
+
'{"width": %s, "height": %s}'
|
|
123
|
+
% (image_dims[0], image_dims[1]), 'pap')
|
|
124
|
+
|
|
109
125
|
_set_changed(doc, ph.placeholder)
|
|
110
126
|
|
|
111
127
|
return doc
|
|
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
|
{papyru-2.11.2.dev128 → papyru-2.12.0}/papyru/create_variant/edit_template/manufacturer_address.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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|