Coverage for /var/srv/projects/api.amasfac.comuna18.com/tmp/venv/lib/python3.9/site-packages/openpyxl/chart/_3d.py: 59%

59 statements  

« prev     ^ index     » next       coverage.py v6.4.4, created at 2023-07-17 14:22 -0600

1# Copyright (c) 2010-2022 openpyxl 

2 

3from openpyxl.descriptors import Typed, Alias 

4from openpyxl.descriptors.serialisable import Serialisable 

5from openpyxl.descriptors.nested import ( 

6 NestedBool, 

7 NestedInteger, 

8 NestedMinMax, 

9) 

10from openpyxl.descriptors.excel import ExtensionList 

11from .marker import PictureOptions 

12from .shapes import GraphicalProperties 

13 

14 

15class View3D(Serialisable): 

16 

17 tagname = "view3D" 

18 

19 rotX = NestedMinMax(min=-90, max=90, allow_none=True) 

20 x_rotation = Alias('rotX') 

21 hPercent = NestedMinMax(min=5, max=500, allow_none=True) 

22 height_percent = Alias('hPercent') 

23 rotY = NestedInteger(min=-90, max=90, allow_none=True) 

24 y_rotation = Alias('rotY') 

25 depthPercent = NestedInteger(allow_none=True) 

26 rAngAx = NestedBool(allow_none=True) 

27 right_angle_axes = Alias('rAngAx') 

28 perspective = NestedInteger(allow_none=True) 

29 extLst = Typed(expected_type=ExtensionList, allow_none=True) 

30 

31 __elements__ = ('rotX', 'hPercent', 'rotY', 'depthPercent', 'rAngAx', 

32 'perspective',) 

33 

34 def __init__(self, 

35 rotX=15, 

36 hPercent=None, 

37 rotY=20, 

38 depthPercent=None, 

39 rAngAx=True, 

40 perspective=None, 

41 extLst=None, 

42 ): 

43 self.rotX = rotX 

44 self.hPercent = hPercent 

45 self.rotY = rotY 

46 self.depthPercent = depthPercent 

47 self.rAngAx = rAngAx 

48 self.perspective = perspective 

49 

50 

51class Surface(Serialisable): 

52 

53 tagname = "surface" 

54 

55 thickness = NestedInteger(allow_none=True) 

56 spPr = Typed(expected_type=GraphicalProperties, allow_none=True) 

57 graphicalProperties = Alias('spPr') 

58 pictureOptions = Typed(expected_type=PictureOptions, allow_none=True) 

59 extLst = Typed(expected_type=ExtensionList, allow_none=True) 

60 

61 __elements__ = ('thickness', 'spPr', 'pictureOptions',) 

62 

63 def __init__(self, 

64 thickness=None, 

65 spPr=None, 

66 pictureOptions=None, 

67 extLst=None, 

68 ): 

69 self.thickness = thickness 

70 self.spPr = spPr 

71 self.pictureOptions = pictureOptions 

72 

73 

74class _3DBase(Serialisable): 

75 

76 """ 

77 Base class for 3D charts 

78 """ 

79 

80 tagname = "ChartBase" 

81 

82 view3D = Typed(expected_type=View3D, allow_none=True) 

83 floor = Typed(expected_type=Surface, allow_none=True) 

84 sideWall = Typed(expected_type=Surface, allow_none=True) 

85 backWall = Typed(expected_type=Surface, allow_none=True) 

86 

87 def __init__(self, 

88 view3D=None, 

89 floor=None, 

90 sideWall=None, 

91 backWall=None, 

92 ): 

93 if view3D is None: 

94 view3D = View3D() 

95 self.view3D = view3D 

96 if floor is None: 

97 floor = Surface() 

98 self.floor = floor 

99 if sideWall is None: 

100 sideWall = Surface() 

101 self.sideWall = sideWall 

102 if backWall is None: 

103 backWall = Surface() 

104 self.backWall = backWall 

105 super(_3DBase, self).__init__()