Coverage for /var/srv/projects/api.amasfac.comuna18.com/tmp/venv/lib/python3.9/site-packages/openpyxl/drawing/effect.py: 76%
209 statements
« prev ^ index » next coverage.py v6.4.4, created at 2023-07-17 14:22 -0600
« prev ^ index » next coverage.py v6.4.4, created at 2023-07-17 14:22 -0600
1# Copyright (c) 2010-2022 openpyxl
3from openpyxl.descriptors.serialisable import Serialisable
4from openpyxl.descriptors import (
5 Typed,
6 String,
7 Set,
8 Bool,
9 Integer,
10 NoneSet,
11 Float,
12)
15from .colors import ColorChoice
18class TintEffect(Serialisable):
20 tagname = "tint"
22 hue = Integer()
23 amt = Integer()
25 def __init__(self,
26 hue=0,
27 amt=0,
28 ):
29 self.hue = hue
30 self.amt = amt
33class LuminanceEffect(Serialisable):
35 tagname = "lum"
37 bright = Integer() #Pct ?
38 contrast = Integer() #Pct#
40 def __init__(self,
41 bright=0,
42 contrast=0,
43 ):
44 self.bright = bright
45 self.contrast = contrast
48class HSLEffect(Serialisable):
50 hue = Integer()
51 sat = Integer()
52 lum = Integer()
54 def __init__(self,
55 hue=None,
56 sat=None,
57 lum=None,
58 ):
59 self.hue = hue
60 self.sat = sat
61 self.lum = lum
64class GrayscaleEffect(Serialisable):
66 tagname = "grayscl"
69class FillOverlayEffect(Serialisable):
71 blend = Set(values=(['over', 'mult', 'screen', 'darken', 'lighten']))
73 def __init__(self,
74 blend=None,
75 ):
76 self.blend = blend
79class DuotoneEffect(Serialisable):
81 pass
83class ColorReplaceEffect(Serialisable):
85 pass
87class Color(Serialisable):
89 pass
91class ColorChangeEffect(Serialisable):
93 useA = Bool(allow_none=True)
94 clrFrom = Typed(expected_type=Color, )
95 clrTo = Typed(expected_type=Color, )
97 def __init__(self,
98 useA=None,
99 clrFrom=None,
100 clrTo=None,
101 ):
102 self.useA = useA
103 self.clrFrom = clrFrom
104 self.clrTo = clrTo
107class BlurEffect(Serialisable):
109 rad = Float()
110 grow = Bool(allow_none=True)
112 def __init__(self,
113 rad=None,
114 grow=None,
115 ):
116 self.rad = rad
117 self.grow = grow
120class BiLevelEffect(Serialisable):
122 thresh = Integer()
124 def __init__(self,
125 thresh=None,
126 ):
127 self.thresh = thresh
130class AlphaReplaceEffect(Serialisable):
132 a = Integer()
134 def __init__(self,
135 a=None,
136 ):
137 self.a = a
140class AlphaModulateFixedEffect(Serialisable):
142 amt = Integer()
144 def __init__(self,
145 amt=None,
146 ):
147 self.amt = amt
150class EffectContainer(Serialisable):
152 type = Set(values=(['sib', 'tree']))
153 name = String(allow_none=True)
155 def __init__(self,
156 type=None,
157 name=None,
158 ):
159 self.type = type
160 self.name = name
163class AlphaModulateEffect(Serialisable):
165 cont = Typed(expected_type=EffectContainer, )
167 def __init__(self,
168 cont=None,
169 ):
170 self.cont = cont
173class AlphaInverseEffect(Serialisable):
175 pass
177class AlphaFloorEffect(Serialisable):
179 pass
181class AlphaCeilingEffect(Serialisable):
183 pass
185class AlphaBiLevelEffect(Serialisable):
187 thresh = Integer()
189 def __init__(self,
190 thresh=None,
191 ):
192 self.thresh = thresh
195class GlowEffect(ColorChoice):
197 rad = Float()
198 # uses element group EG_ColorChoice
199 scrgbClr = ColorChoice.scrgbClr
200 srgbClr = ColorChoice.srgbClr
201 hslClr = ColorChoice.hslClr
202 sysClr = ColorChoice.sysClr
203 schemeClr = ColorChoice.schemeClr
204 prstClr = ColorChoice.prstClr
206 __elements__ = ('scrgbClr', 'srgbClr', 'hslClr', 'sysClr', 'schemeClr', 'prstClr')
208 def __init__(self,
209 rad=None,
210 **kw
211 ):
212 self.rad = rad
213 super(GlowEffect, self).__init__(**kw)
216class InnerShadowEffect(ColorChoice):
218 blurRad = Float()
219 dist = Float()
220 dir = Integer()
221 # uses element group EG_ColorChoice
222 scrgbClr = ColorChoice.scrgbClr
223 srgbClr = ColorChoice.srgbClr
224 hslClr = ColorChoice.hslClr
225 sysClr = ColorChoice.sysClr
226 schemeClr = ColorChoice.schemeClr
227 prstClr = ColorChoice.prstClr
229 __elements__ = ('scrgbClr', 'srgbClr', 'hslClr', 'sysClr', 'schemeClr', 'prstClr')
231 def __init__(self,
232 blurRad=None,
233 dist=None,
234 dir=None,
235 **kw
236 ):
237 self.blurRad = blurRad
238 self.dist = dist
239 self.dir = dir
240 super(InnerShadowEffect, self).__init__(**kw)
243class OuterShadow(ColorChoice):
245 tagname = "outerShdw"
247 blurRad = Float(allow_none=True)
248 dist = Float(allow_none=True)
249 dir = Integer(allow_none=True)
250 sx = Integer(allow_none=True)
251 sy = Integer(allow_none=True)
252 kx = Integer(allow_none=True)
253 ky = Integer(allow_none=True)
254 algn = Set(values=['tl', 't', 'tr', 'l', 'ctr', 'r', 'bl', 'b', 'br'])
255 rotWithShape = Bool(allow_none=True)
256 # uses element group EG_ColorChoice
257 scrgbClr = ColorChoice.scrgbClr
258 srgbClr = ColorChoice.srgbClr
259 hslClr = ColorChoice.hslClr
260 sysClr = ColorChoice.sysClr
261 schemeClr = ColorChoice.schemeClr
262 prstClr = ColorChoice.prstClr
264 __elements__ = ('scrgbClr', 'srgbClr', 'hslClr', 'sysClr', 'schemeClr', 'prstClr')
266 def __init__(self,
267 blurRad=None,
268 dist=None,
269 dir=None,
270 sx=None,
271 sy=None,
272 kx=None,
273 ky=None,
274 algn=None,
275 rotWithShape=None,
276 **kw
277 ):
278 self.blurRad = blurRad
279 self.dist = dist
280 self.dir = dir
281 self.sx = sx
282 self.sy = sy
283 self.kx = kx
284 self.ky = ky
285 self.algn = algn
286 self.rotWithShape = rotWithShape
287 super(OuterShadow, self).__init__(**kw)
290class PresetShadowEffect(ColorChoice):
292 prst = Set(values=(['shdw1', 'shdw2', 'shdw3', 'shdw4', 'shdw5', 'shdw6',
293 'shdw7', 'shdw8', 'shdw9', 'shdw10', 'shdw11', 'shdw12', 'shdw13',
294 'shdw14', 'shdw15', 'shdw16', 'shdw17', 'shdw18', 'shdw19', 'shdw20']))
295 dist = Float()
296 dir = Integer()
297 # uses element group EG_ColorChoice
298 scrgbClr = ColorChoice.scrgbClr
299 srgbClr = ColorChoice.srgbClr
300 hslClr = ColorChoice.hslClr
301 sysClr = ColorChoice.sysClr
302 schemeClr = ColorChoice.schemeClr
303 prstClr = ColorChoice.prstClr
305 __elements__ = ('scrgbClr', 'srgbClr', 'hslClr', 'sysClr', 'schemeClr', 'prstClr')
307 def __init__(self,
308 prst=None,
309 dist=None,
310 dir=None,
311 **kw
312 ):
313 self.prst = prst
314 self.dist = dist
315 self.dir = dir
316 super(PresetShadowEffect, self).__init__(**kw)
319class ReflectionEffect(Serialisable):
321 blurRad = Float()
322 stA = Integer()
323 stPos = Integer()
324 endA = Integer()
325 endPos = Integer()
326 dist = Float()
327 dir = Integer()
328 fadeDir = Integer()
329 sx = Integer()
330 sy = Integer()
331 kx = Integer()
332 ky = Integer()
333 algn = Set(values=(['tl', 't', 'tr', 'l', 'ctr', 'r', 'bl', 'b', 'br']))
334 rotWithShape = Bool(allow_none=True)
336 def __init__(self,
337 blurRad=None,
338 stA=None,
339 stPos=None,
340 endA=None,
341 endPos=None,
342 dist=None,
343 dir=None,
344 fadeDir=None,
345 sx=None,
346 sy=None,
347 kx=None,
348 ky=None,
349 algn=None,
350 rotWithShape=None,
351 ):
352 self.blurRad = blurRad
353 self.stA = stA
354 self.stPos = stPos
355 self.endA = endA
356 self.endPos = endPos
357 self.dist = dist
358 self.dir = dir
359 self.fadeDir = fadeDir
360 self.sx = sx
361 self.sy = sy
362 self.kx = kx
363 self.ky = ky
364 self.algn = algn
365 self.rotWithShape = rotWithShape
368class SoftEdgesEffect(Serialisable):
370 rad = Float()
372 def __init__(self,
373 rad=None,
374 ):
375 self.rad = rad
378class EffectList(Serialisable):
380 blur = Typed(expected_type=BlurEffect, allow_none=True)
381 fillOverlay = Typed(expected_type=FillOverlayEffect, allow_none=True)
382 glow = Typed(expected_type=GlowEffect, allow_none=True)
383 innerShdw = Typed(expected_type=InnerShadowEffect, allow_none=True)
384 outerShdw = Typed(expected_type=OuterShadow, allow_none=True)
385 prstShdw = Typed(expected_type=PresetShadowEffect, allow_none=True)
386 reflection = Typed(expected_type=ReflectionEffect, allow_none=True)
387 softEdge = Typed(expected_type=SoftEdgesEffect, allow_none=True)
389 __elements__ = ('blur', 'fillOverlay', 'glow', 'innerShdw', 'outerShdw',
390 'prstShdw', 'reflection', 'softEdge')
392 def __init__(self,
393 blur=None,
394 fillOverlay=None,
395 glow=None,
396 innerShdw=None,
397 outerShdw=None,
398 prstShdw=None,
399 reflection=None,
400 softEdge=None,
401 ):
402 self.blur = blur
403 self.fillOverlay = fillOverlay
404 self.glow = glow
405 self.innerShdw = innerShdw
406 self.outerShdw = outerShdw
407 self.prstShdw = prstShdw
408 self.reflection = reflection
409 self.softEdge = softEdge