papyru 2.11.1.dev114__tar.gz → 2.11.1.dev133__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.dev114/papyru.egg-info → papyru-2.11.1.dev133}/PKG-INFO +1 -1
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/create_variant/edit_template/ean.py +0 -2
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/create_variant/edit_template/xml.py +70 -18
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133/papyru.egg-info}/PKG-INFO +1 -1
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/setup.py +1 -1
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/LICENSE.txt +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/README.md +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/bin/generate_jsonschema.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/__init__.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/auth.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/context.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/create_variant/__init__.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/create_variant/component.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/create_variant/constants.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/create_variant/edit_template/__init__.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/create_variant/edit_template/manufacturer_address.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/create_variant/edit_template/motive.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/create_variant/edit_template/render_text.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/create_variant/edit_template/title.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/create_variant/resi.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/logger.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/logger_stdout.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/logger_types.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/middleware.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/problem.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/profiler.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/resource.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/serializer.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/stack_context.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/static/__init__.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/static/apps.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/static/urls.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/static/views.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/utils.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/validation.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/varspool/__init__.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/varspool/assets/Job.json +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/varspool/assets/JobStatusHistory.json +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/varspool/command/__init__.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/varspool/command/config.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/varspool/command/types.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/varspool/serializers.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/varspool/types.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru/xml_helper.py +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru.egg-info/SOURCES.txt +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru.egg-info/dependency_links.txt +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru.egg-info/requires.txt +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/papyru.egg-info/top_level.txt +0 -0
- {papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/setup.cfg +0 -0
|
@@ -10,11 +10,25 @@ class PlaceholderInfo:
|
|
|
10
10
|
placeholder: Element
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
@dataclass(frozen=True)
|
|
14
|
+
class Placement:
|
|
15
|
+
container_width: float
|
|
16
|
+
container_height: float
|
|
17
|
+
container_x: float
|
|
18
|
+
container_y: float
|
|
19
|
+
placement_x: float
|
|
20
|
+
placement_y: float
|
|
21
|
+
scale_x: float
|
|
22
|
+
scale_y: float
|
|
23
|
+
rotation: float
|
|
24
|
+
|
|
25
|
+
|
|
13
26
|
@dataclass(frozen=True)
|
|
14
27
|
class ImageInfo:
|
|
15
28
|
location: str
|
|
16
29
|
width: int
|
|
17
30
|
height: int
|
|
31
|
+
placement: Placement = None
|
|
18
32
|
|
|
19
33
|
|
|
20
34
|
def find_placeholder(doc: XMLHelper,
|
|
@@ -77,31 +91,34 @@ def fit_image(doc: XMLHelper,
|
|
|
77
91
|
if ph is None:
|
|
78
92
|
return doc
|
|
79
93
|
|
|
80
|
-
|
|
81
|
-
|
|
94
|
+
if image_info.placement is not None:
|
|
95
|
+
return _place_custom_image(doc, ph, image_info)
|
|
96
|
+
else:
|
|
97
|
+
wrapper_dims = (float(doc.get_attribute(ph.wrapper, 'width')),
|
|
98
|
+
float(doc.get_attribute(ph.wrapper, 'height')))
|
|
82
99
|
|
|
83
|
-
|
|
84
|
-
|
|
100
|
+
image_dims = (float(image_info.width),
|
|
101
|
+
float(image_info.height))
|
|
85
102
|
|
|
86
|
-
|
|
103
|
+
viewbox = _fit_dimensions(wrapper_dims, image_dims)
|
|
87
104
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
105
|
+
doc.set_attribute(ph.wrapper,
|
|
106
|
+
'viewBox',
|
|
107
|
+
'%s %s %s %s' % viewbox)
|
|
91
108
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
109
|
+
has_xlink = doc.namespace('xlink') is not None
|
|
110
|
+
doc.set_attribute(ph.placeholder,
|
|
111
|
+
'href', image_info.location,
|
|
112
|
+
'xlink' if has_xlink else None)
|
|
96
113
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
114
|
+
doc.set_attribute(ph.placeholder, 'x', '0.0')
|
|
115
|
+
doc.set_attribute(ph.placeholder, 'y', '0.0')
|
|
116
|
+
doc.set_attribute(ph.placeholder, 'width', '%s' % image_dims[0])
|
|
117
|
+
doc.set_attribute(ph.placeholder, 'height', '%s' % image_dims[1])
|
|
101
118
|
|
|
102
|
-
|
|
119
|
+
_set_changed(doc, ph.placeholder)
|
|
103
120
|
|
|
104
|
-
|
|
121
|
+
return doc
|
|
105
122
|
|
|
106
123
|
|
|
107
124
|
def _set_changed(document: XMLHelper, element: Element):
|
|
@@ -124,3 +141,38 @@ def _fit_dimensions(container_dims: (float, float),
|
|
|
124
141
|
else:
|
|
125
142
|
w = element_dims[1] * aspect_container
|
|
126
143
|
return ((e_w - w) / 2, 0.0, w, e_h)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def _place_custom_image(doc: XMLHelper, ph: PlaceholderInfo,
|
|
147
|
+
image_info: ImageInfo):
|
|
148
|
+
placement = image_info.placement
|
|
149
|
+
|
|
150
|
+
doc.set_attribute(ph.wrapper, 'viewBox',
|
|
151
|
+
'0 0 %s %s' % (placement.container_width,
|
|
152
|
+
placement.container_height))
|
|
153
|
+
|
|
154
|
+
img_width = image_info.width * placement.scale_x
|
|
155
|
+
img_height = image_info.height * placement.scale_y
|
|
156
|
+
x = placement.placement_x - placement.container_x
|
|
157
|
+
y = placement.placement_y - placement.container_y
|
|
158
|
+
|
|
159
|
+
has_xlink = doc.namespace('xlink') is not None
|
|
160
|
+
doc.set_attribute(ph.placeholder,
|
|
161
|
+
'href', image_info.location,
|
|
162
|
+
'xlink' if has_xlink else None)
|
|
163
|
+
|
|
164
|
+
doc.set_attribute(ph.placeholder, 'x', '%s' % x)
|
|
165
|
+
doc.set_attribute(ph.placeholder, 'y', '%s' % y)
|
|
166
|
+
doc.set_attribute(ph.placeholder, 'width', '%s' % img_width)
|
|
167
|
+
doc.set_attribute(ph.placeholder, 'height', '%s' % img_height)
|
|
168
|
+
|
|
169
|
+
if placement.rotation:
|
|
170
|
+
doc.set_attribute(ph.placeholder, 'transform',
|
|
171
|
+
'rotate(%s %s %s)' % (
|
|
172
|
+
placement.rotation,
|
|
173
|
+
x + img_width / 2,
|
|
174
|
+
y + img_height / 2))
|
|
175
|
+
|
|
176
|
+
_set_changed(doc, ph.placeholder)
|
|
177
|
+
|
|
178
|
+
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.dev114 → papyru-2.11.1.dev133}/papyru/create_variant/edit_template/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{papyru-2.11.1.dev114 → papyru-2.11.1.dev133}/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
|