papyru 2.11.1.dev140__tar.gz → 2.11.1.dev147__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.1.dev140/papyru.egg-info → papyru-2.11.1.dev147}/PKG-INFO +1 -1
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/create_variant/edit_template/xml.py +33 -53
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147/papyru.egg-info}/PKG-INFO +1 -1
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/setup.py +1 -1
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/LICENSE.txt +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/README.md +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/bin/generate_jsonschema.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/__init__.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/auth.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/context.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/create_variant/__init__.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/create_variant/component.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/create_variant/constants.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/create_variant/edit_template/__init__.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/create_variant/edit_template/ean.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/create_variant/edit_template/manufacturer_address.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/create_variant/edit_template/motive.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/create_variant/edit_template/render_text.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/create_variant/edit_template/title.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/create_variant/resi.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/logger.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/logger_stdout.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/logger_types.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/middleware.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/problem.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/profiler.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/resource.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/serializer.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/stack_context.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/static/__init__.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/static/apps.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/static/urls.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/static/views.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/utils.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/validation.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/varspool/__init__.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/varspool/assets/Job.json +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/varspool/assets/JobStatusHistory.json +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/varspool/command/__init__.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/varspool/command/config.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/varspool/command/types.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/varspool/serializers.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/varspool/types.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/xml_helper.py +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru.egg-info/SOURCES.txt +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru.egg-info/dependency_links.txt +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru.egg-info/requires.txt +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru.egg-info/top_level.txt +0 -0
- {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/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
|
|
@@ -23,7 +24,7 @@ class ImageInfo:
|
|
|
23
24
|
location: str
|
|
24
25
|
width: int
|
|
25
26
|
height: int
|
|
26
|
-
crop: ImageCrop = None
|
|
27
|
+
crop: Optional[ImageCrop] = None
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
def find_placeholder(doc: XMLHelper,
|
|
@@ -86,34 +87,44 @@ def fit_image(doc: XMLHelper,
|
|
|
86
87
|
if ph is None:
|
|
87
88
|
return doc
|
|
88
89
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
else:
|
|
92
|
-
wrapper_dims = (float(doc.get_attribute(ph.wrapper, 'width')),
|
|
93
|
-
float(doc.get_attribute(ph.wrapper, 'height')))
|
|
90
|
+
wrapper_dims = (float(doc.get_attribute(ph.wrapper, 'width')),
|
|
91
|
+
float(doc.get_attribute(ph.wrapper, 'height')))
|
|
94
92
|
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
image_dims = (float(image_info.width),
|
|
94
|
+
float(image_info.height))
|
|
97
95
|
|
|
98
|
-
|
|
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))
|
|
99
100
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
doc.set_attribute(ph.wrapper,
|
|
102
|
+
'viewBox',
|
|
103
|
+
'%s %s %s %s' % viewbox)
|
|
103
104
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
has_xlink = doc.namespace('xlink') is not None
|
|
106
|
+
doc.set_attribute(ph.placeholder,
|
|
107
|
+
'href', image_info.location,
|
|
108
|
+
'xlink' if has_xlink else None)
|
|
108
109
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
doc.set_attribute(ph.placeholder, 'x', '0.0')
|
|
111
|
+
doc.set_attribute(ph.placeholder, 'y', '0.0')
|
|
112
|
+
doc.set_attribute(ph.placeholder, 'width', '%s' % image_dims[0])
|
|
113
|
+
doc.set_attribute(ph.placeholder, 'height', '%s' % image_dims[1])
|
|
113
114
|
|
|
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')
|
|
115
124
|
|
|
116
|
-
|
|
125
|
+
_set_changed(doc, ph.placeholder)
|
|
126
|
+
|
|
127
|
+
return doc
|
|
117
128
|
|
|
118
129
|
|
|
119
130
|
def _set_changed(document: XMLHelper, element: Element):
|
|
@@ -136,34 +147,3 @@ def _fit_dimensions(container_dims: (float, float),
|
|
|
136
147
|
else:
|
|
137
148
|
w = element_dims[1] * aspect_container
|
|
138
149
|
return ((e_w - w) / 2, 0.0, w, e_h)
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
def _crop_image(doc: XMLHelper, ph: PlaceholderInfo,
|
|
142
|
-
image_info: ImageInfo) -> XMLHelper:
|
|
143
|
-
crop = image_info.crop
|
|
144
|
-
|
|
145
|
-
doc.set_attribute(ph.wrapper, 'viewBox',
|
|
146
|
-
'%s %s %s %s' % (crop.x, crop.y,
|
|
147
|
-
crop.width, crop.height))
|
|
148
|
-
|
|
149
|
-
has_xlink = doc.namespace('xlink') is not None
|
|
150
|
-
doc.set_attribute(ph.placeholder,
|
|
151
|
-
'href', image_info.location,
|
|
152
|
-
'xlink' if has_xlink else None)
|
|
153
|
-
|
|
154
|
-
doc.set_attribute(ph.placeholder, 'x', '0.0')
|
|
155
|
-
doc.set_attribute(ph.placeholder, 'y', '0.0')
|
|
156
|
-
doc.set_attribute(ph.placeholder, 'width', '%s' % image_info.width)
|
|
157
|
-
doc.set_attribute(ph.placeholder, 'height', '%s' % image_info.height)
|
|
158
|
-
|
|
159
|
-
doc.set_attribute(ph.placeholder, 'bbox',
|
|
160
|
-
'{"x": %s, "y": %s, "width": %s, "height": %s}'
|
|
161
|
-
% (crop.x, crop.y,
|
|
162
|
-
crop.width, crop.height), 'pap')
|
|
163
|
-
doc.set_attribute(ph.placeholder, 'img-dimensions',
|
|
164
|
-
'{"width": %s, "height": %s}'
|
|
165
|
-
% (image_info.width, image_info.height), 'pap')
|
|
166
|
-
|
|
167
|
-
_set_changed(doc, ph.placeholder)
|
|
168
|
-
|
|
169
|
-
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
|
{papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/create_variant/edit_template/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/create_variant/edit_template/render_text.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
|