123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410 |
- from __future__ import absolute_import
- # Copyright (c) 2010-2019 openpyxl
- from openpyxl.descriptors.serialisable import Serialisable
- from openpyxl.descriptors import (
- Typed,
- String,
- Set,
- Bool,
- Integer,
- NoneSet,
- Float,
- )
- from .colors import ColorChoice
- class TintEffect(Serialisable):
- tagname = "tint"
- hue = Integer()
- amt = Integer()
- def __init__(self,
- hue=0,
- amt=0,
- ):
- self.hue = hue
- self.amt = amt
- class LuminanceEffect(Serialisable):
- tagname = "lum"
- bright = Integer() #Pct ?
- contrast = Integer() #Pct#
- def __init__(self,
- bright=0,
- contrast=0,
- ):
- self.bright = bright
- self.contrast = contrast
- class HSLEffect(Serialisable):
- hue = Integer()
- sat = Integer()
- lum = Integer()
- def __init__(self,
- hue=None,
- sat=None,
- lum=None,
- ):
- self.hue = hue
- self.sat = sat
- self.lum = lum
- class GrayscaleEffect(Serialisable):
- tagname = "grayscl"
- class FillOverlayEffect(Serialisable):
- blend = Set(values=(['over', 'mult', 'screen', 'darken', 'lighten']))
- def __init__(self,
- blend=None,
- ):
- self.blend = blend
- class DuotoneEffect(Serialisable):
- pass
- class ColorReplaceEffect(Serialisable):
- pass
- class Color(Serialisable):
- pass
- class ColorChangeEffect(Serialisable):
- useA = Bool(allow_none=True)
- clrFrom = Typed(expected_type=Color, )
- clrTo = Typed(expected_type=Color, )
- def __init__(self,
- useA=None,
- clrFrom=None,
- clrTo=None,
- ):
- self.useA = useA
- self.clrFrom = clrFrom
- self.clrTo = clrTo
- class BlurEffect(Serialisable):
- rad = Float()
- grow = Bool(allow_none=True)
- def __init__(self,
- rad=None,
- grow=None,
- ):
- self.rad = rad
- self.grow = grow
- class BiLevelEffect(Serialisable):
- thresh = Integer()
- def __init__(self,
- thresh=None,
- ):
- self.thresh = thresh
- class AlphaReplaceEffect(Serialisable):
- a = Integer()
- def __init__(self,
- a=None,
- ):
- self.a = a
- class AlphaModulateFixedEffect(Serialisable):
- amt = Integer()
- def __init__(self,
- amt=None,
- ):
- self.amt = amt
- class EffectContainer(Serialisable):
- type = Set(values=(['sib', 'tree']))
- name = String(allow_none=True)
- def __init__(self,
- type=None,
- name=None,
- ):
- self.type = type
- self.name = name
- class AlphaModulateEffect(Serialisable):
- cont = Typed(expected_type=EffectContainer, )
- def __init__(self,
- cont=None,
- ):
- self.cont = cont
- class AlphaInverseEffect(Serialisable):
- pass
- class AlphaFloorEffect(Serialisable):
- pass
- class AlphaCeilingEffect(Serialisable):
- pass
- class AlphaBiLevelEffect(Serialisable):
- thresh = Integer()
- def __init__(self,
- thresh=None,
- ):
- self.thresh = thresh
- class GlowEffect(ColorChoice):
- rad = Float()
- # uses element group EG_ColorChoice
- scrgbClr = ColorChoice.scrgbClr
- srgbClr = ColorChoice.srgbClr
- hslClr = ColorChoice.hslClr
- sysClr = ColorChoice.sysClr
- schemeClr = ColorChoice.schemeClr
- prstClr = ColorChoice.prstClr
- __elements__ = ('scrgbClr', 'srgbClr', 'hslClr', 'sysClr', 'schemeClr', 'prstClr')
- def __init__(self,
- rad=None,
- **kw
- ):
- self.rad = rad
- super(GlowEffect, self).__init__(**kw)
- class InnerShadowEffect(ColorChoice):
- blurRad = Float()
- dist = Float()
- dir = Integer()
- # uses element group EG_ColorChoice
- scrgbClr = ColorChoice.scrgbClr
- srgbClr = ColorChoice.srgbClr
- hslClr = ColorChoice.hslClr
- sysClr = ColorChoice.sysClr
- schemeClr = ColorChoice.schemeClr
- prstClr = ColorChoice.prstClr
- __elements__ = ('scrgbClr', 'srgbClr', 'hslClr', 'sysClr', 'schemeClr', 'prstClr')
- def __init__(self,
- blurRad=None,
- dist=None,
- dir=None,
- **kw
- ):
- self.blurRad = blurRad
- self.dist = dist
- self.dir = dir
- super(InnerShadowEffect, self).__init__(**kw)
- class OuterShadow(ColorChoice):
- tagname = "outerShdw"
- blurRad = Float(allow_none=True)
- dist = Float(allow_none=True)
- dir = Integer(allow_none=True)
- sx = Integer(allow_none=True)
- sy = Integer(allow_none=True)
- kx = Integer(allow_none=True)
- ky = Integer(allow_none=True)
- algn = Set(values=['tl', 't', 'tr', 'l', 'ctr', 'r', 'bl', 'b', 'br'])
- rotWithShape = Bool(allow_none=True)
- # uses element group EG_ColorChoice
- scrgbClr = ColorChoice.scrgbClr
- srgbClr = ColorChoice.srgbClr
- hslClr = ColorChoice.hslClr
- sysClr = ColorChoice.sysClr
- schemeClr = ColorChoice.schemeClr
- prstClr = ColorChoice.prstClr
- __elements__ = ('scrgbClr', 'srgbClr', 'hslClr', 'sysClr', 'schemeClr', 'prstClr')
- def __init__(self,
- blurRad=None,
- dist=None,
- dir=None,
- sx=None,
- sy=None,
- kx=None,
- ky=None,
- algn=None,
- rotWithShape=None,
- **kw
- ):
- self.blurRad = blurRad
- self.dist = dist
- self.dir = dir
- self.sx = sx
- self.sy = sy
- self.kx = kx
- self.ky = ky
- self.algn = algn
- self.rotWithShape = rotWithShape
- super(OuterShadow, self).__init__(**kw)
- class PresetShadowEffect(ColorChoice):
- prst = Set(values=(['shdw1', 'shdw2', 'shdw3', 'shdw4', 'shdw5', 'shdw6',
- 'shdw7', 'shdw8', 'shdw9', 'shdw10', 'shdw11', 'shdw12', 'shdw13',
- 'shdw14', 'shdw15', 'shdw16', 'shdw17', 'shdw18', 'shdw19', 'shdw20']))
- dist = Float()
- dir = Integer()
- # uses element group EG_ColorChoice
- scrgbClr = ColorChoice.scrgbClr
- srgbClr = ColorChoice.srgbClr
- hslClr = ColorChoice.hslClr
- sysClr = ColorChoice.sysClr
- schemeClr = ColorChoice.schemeClr
- prstClr = ColorChoice.prstClr
- __elements__ = ('scrgbClr', 'srgbClr', 'hslClr', 'sysClr', 'schemeClr', 'prstClr')
- def __init__(self,
- prst=None,
- dist=None,
- dir=None,
- **kw
- ):
- self.prst = prst
- self.dist = dist
- self.dir = dir
- super(PresetShadowEffect, self).__init__(**kw)
- class ReflectionEffect(Serialisable):
- blurRad = Float()
- stA = Integer()
- stPos = Integer()
- endA = Integer()
- endPos = Integer()
- dist = Float()
- dir = Integer()
- fadeDir = Integer()
- sx = Integer()
- sy = Integer()
- kx = Integer()
- ky = Integer()
- algn = Set(values=(['tl', 't', 'tr', 'l', 'ctr', 'r', 'bl', 'b', 'br']))
- rotWithShape = Bool(allow_none=True)
- def __init__(self,
- blurRad=None,
- stA=None,
- stPos=None,
- endA=None,
- endPos=None,
- dist=None,
- dir=None,
- fadeDir=None,
- sx=None,
- sy=None,
- kx=None,
- ky=None,
- algn=None,
- rotWithShape=None,
- ):
- self.blurRad = blurRad
- self.stA = stA
- self.stPos = stPos
- self.endA = endA
- self.endPos = endPos
- self.dist = dist
- self.dir = dir
- self.fadeDir = fadeDir
- self.sx = sx
- self.sy = sy
- self.kx = kx
- self.ky = ky
- self.algn = algn
- self.rotWithShape = rotWithShape
- class SoftEdgesEffect(Serialisable):
- rad = Float()
- def __init__(self,
- rad=None,
- ):
- self.rad = rad
- class EffectList(Serialisable):
- blur = Typed(expected_type=BlurEffect, allow_none=True)
- fillOverlay = Typed(expected_type=FillOverlayEffect, allow_none=True)
- glow = Typed(expected_type=GlowEffect, allow_none=True)
- innerShdw = Typed(expected_type=InnerShadowEffect, allow_none=True)
- outerShdw = Typed(expected_type=OuterShadow, allow_none=True)
- prstShdw = Typed(expected_type=PresetShadowEffect, allow_none=True)
- reflection = Typed(expected_type=ReflectionEffect, allow_none=True)
- softEdge = Typed(expected_type=SoftEdgesEffect, allow_none=True)
- __elements__ = ('blur', 'fillOverlay', 'glow', 'innerShdw', 'outerShdw',
- 'prstShdw', 'reflection', 'softEdge')
- def __init__(self,
- blur=None,
- fillOverlay=None,
- glow=None,
- innerShdw=None,
- outerShdw=None,
- prstShdw=None,
- reflection=None,
- softEdge=None,
- ):
- self.blur = blur
- self.fillOverlay = fillOverlay
- self.glow = glow
- self.innerShdw = innerShdw
- self.outerShdw = outerShdw
- self.prstShdw = prstShdw
- self.reflection = reflection
- self.softEdge = softEdge
|