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.
Files changed (49) hide show
  1. {papyru-2.11.1.dev140/papyru.egg-info → papyru-2.11.1.dev147}/PKG-INFO +1 -1
  2. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/create_variant/edit_template/xml.py +33 -53
  3. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147/papyru.egg-info}/PKG-INFO +1 -1
  4. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/setup.py +1 -1
  5. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/LICENSE.txt +0 -0
  6. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/README.md +0 -0
  7. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/bin/generate_jsonschema.py +0 -0
  8. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/__init__.py +0 -0
  9. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/auth.py +0 -0
  10. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/context.py +0 -0
  11. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/create_variant/__init__.py +0 -0
  12. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/create_variant/component.py +0 -0
  13. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/create_variant/constants.py +0 -0
  14. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/create_variant/edit_template/__init__.py +0 -0
  15. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/create_variant/edit_template/ean.py +0 -0
  16. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/create_variant/edit_template/manufacturer_address.py +0 -0
  17. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/create_variant/edit_template/motive.py +0 -0
  18. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/create_variant/edit_template/render_text.py +0 -0
  19. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/create_variant/edit_template/title.py +0 -0
  20. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/create_variant/resi.py +0 -0
  21. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/logger.py +0 -0
  22. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/logger_stdout.py +0 -0
  23. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/logger_types.py +0 -0
  24. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/middleware.py +0 -0
  25. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/problem.py +0 -0
  26. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/profiler.py +0 -0
  27. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/resource.py +0 -0
  28. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/serializer.py +0 -0
  29. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/stack_context.py +0 -0
  30. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/static/__init__.py +0 -0
  31. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/static/apps.py +0 -0
  32. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/static/urls.py +0 -0
  33. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/static/views.py +0 -0
  34. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/utils.py +0 -0
  35. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/validation.py +0 -0
  36. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/varspool/__init__.py +0 -0
  37. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/varspool/assets/Job.json +0 -0
  38. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/varspool/assets/JobStatusHistory.json +0 -0
  39. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/varspool/command/__init__.py +0 -0
  40. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/varspool/command/config.py +0 -0
  41. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/varspool/command/types.py +0 -0
  42. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/varspool/serializers.py +0 -0
  43. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/varspool/types.py +0 -0
  44. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru/xml_helper.py +0 -0
  45. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru.egg-info/SOURCES.txt +0 -0
  46. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru.egg-info/dependency_links.txt +0 -0
  47. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru.egg-info/requires.txt +0 -0
  48. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/papyru.egg-info/top_level.txt +0 -0
  49. {papyru-2.11.1.dev140 → papyru-2.11.1.dev147}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: papyru
3
- Version: 2.11.1.dev140
3
+ Version: 2.11.1.dev147
4
4
  Summary: minimal REST library with OpenAPI-based validation for django
5
5
  Home-page: http://www.puzzleyou.net/
6
6
  Author: puzzleYOU GmbH
@@ -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
- if image_info.crop is not None:
90
- return _crop_image(doc, ph, image_info)
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
- image_dims = (float(image_info.width),
96
- float(image_info.height))
93
+ image_dims = (float(image_info.width),
94
+ float(image_info.height))
97
95
 
98
- 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))
99
100
 
100
- doc.set_attribute(ph.wrapper,
101
- 'viewBox',
102
- '%s %s %s %s' % viewbox)
101
+ doc.set_attribute(ph.wrapper,
102
+ 'viewBox',
103
+ '%s %s %s %s' % viewbox)
103
104
 
104
- has_xlink = doc.namespace('xlink') is not None
105
- doc.set_attribute(ph.placeholder,
106
- 'href', image_info.location,
107
- 'xlink' if has_xlink else None)
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
- doc.set_attribute(ph.placeholder, 'x', '0.0')
110
- doc.set_attribute(ph.placeholder, 'y', '0.0')
111
- doc.set_attribute(ph.placeholder, 'width', '%s' % image_dims[0])
112
- doc.set_attribute(ph.placeholder, 'height', '%s' % image_dims[1])
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
- _set_changed(doc, ph.placeholder)
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
- return doc
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: papyru
3
- Version: 2.11.1.dev140
3
+ Version: 2.11.1.dev147
4
4
  Summary: minimal REST library with OpenAPI-based validation for django
5
5
  Home-page: http://www.puzzleyou.net/
6
6
  Author: puzzleYOU GmbH
@@ -2,7 +2,7 @@ from setuptools import setup
2
2
 
3
3
  setup(
4
4
  name='papyru',
5
- version='2.11.1.dev140',
5
+ version='2.11.1.dev147',
6
6
  description=(
7
7
  'minimal REST library with OpenAPI-based validation for django'),
8
8
  author='puzzleYOU GmbH',
File without changes
File without changes