Coverage for /var/srv/projects/api.amasfac.comuna18.com/tmp/venv/lib/python3.9/site-packages/openpyxl/drawing/connector.py: 73%

74 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.serialisable import Serialisable 

4from openpyxl.descriptors import ( 

5 Typed, 

6 Bool, 

7 Integer, 

8 String, 

9 Alias, 

10) 

11from openpyxl.descriptors.excel import ExtensionList as OfficeArtExtensionList 

12from openpyxl.chart.shapes import GraphicalProperties 

13from openpyxl.chart.text import RichText 

14 

15from .properties import ( 

16 NonVisualDrawingProps, 

17 NonVisualDrawingShapeProps, 

18) 

19from .geometry import ShapeStyle 

20 

21class Connection(Serialisable): 

22 

23 id = Integer() 

24 idx = Integer() 

25 

26 def __init__(self, 

27 id=None, 

28 idx=None, 

29 ): 

30 self.id = id 

31 self.idx = idx 

32 

33 

34class ConnectorLocking(Serialisable): 

35 

36 extLst = Typed(expected_type=OfficeArtExtensionList, allow_none=True) 

37 

38 def __init__(self, 

39 extLst=None, 

40 ): 

41 self.extLst = extLst 

42 

43 

44class NonVisualConnectorProperties(Serialisable): 

45 

46 cxnSpLocks = Typed(expected_type=ConnectorLocking, allow_none=True) 

47 stCxn = Typed(expected_type=Connection, allow_none=True) 

48 endCxn = Typed(expected_type=Connection, allow_none=True) 

49 extLst = Typed(expected_type=OfficeArtExtensionList, allow_none=True) 

50 

51 def __init__(self, 

52 cxnSpLocks=None, 

53 stCxn=None, 

54 endCxn=None, 

55 extLst=None, 

56 ): 

57 self.cxnSpLocks = cxnSpLocks 

58 self.stCxn = stCxn 

59 self.endCxn = endCxn 

60 self.extLst = extLst 

61 

62 

63class ConnectorNonVisual(Serialisable): 

64 

65 cNvPr = Typed(expected_type=NonVisualDrawingProps, ) 

66 cNvCxnSpPr = Typed(expected_type=NonVisualConnectorProperties, ) 

67 

68 __elements__ = ("cNvPr", "cNvCxnSpPr",) 

69 

70 def __init__(self, 

71 cNvPr=None, 

72 cNvCxnSpPr=None, 

73 ): 

74 self.cNvPr = cNvPr 

75 self.cNvCxnSpPr = cNvCxnSpPr 

76 

77 

78class ConnectorShape(Serialisable): 

79 

80 tagname = "cxnSp" 

81 

82 nvCxnSpPr = Typed(expected_type=ConnectorNonVisual) 

83 spPr = Typed(expected_type=GraphicalProperties) 

84 style = Typed(expected_type=ShapeStyle, allow_none=True) 

85 macro = String(allow_none=True) 

86 fPublished = Bool(allow_none=True) 

87 

88 def __init__(self, 

89 nvCxnSpPr=None, 

90 spPr=None, 

91 style=None, 

92 macro=None, 

93 fPublished=None, 

94 ): 

95 self.nvCxnSpPr = nvCxnSpPr 

96 self.spPr = spPr 

97 self.style = style 

98 self.macro = macro 

99 self.fPublished = fPublished 

100 

101 

102class ShapeMeta(Serialisable): 

103 

104 tagname = "nvSpPr" 

105 

106 cNvPr = Typed(expected_type=NonVisualDrawingProps) 

107 cNvSpPr = Typed(expected_type=NonVisualDrawingShapeProps) 

108 

109 def __init__(self, cNvPr=None, cNvSpPr=None): 

110 self.cNvPr = cNvPr 

111 self.cNvSpPr = cNvSpPr 

112 

113 

114class Shape(Serialisable): 

115 

116 macro = String(allow_none=True) 

117 textlink = String(allow_none=True) 

118 fPublished = Bool(allow_none=True) 

119 fLocksText = Bool(allow_none=True) 

120 nvSpPr = Typed(expected_type=ShapeMeta, allow_none=True) 

121 meta = Alias("nvSpPr") 

122 spPr = Typed(expected_type=GraphicalProperties) 

123 graphicalProperties = Alias("spPr") 

124 style = Typed(expected_type=ShapeStyle, allow_none=True) 

125 txBody = Typed(expected_type=RichText, allow_none=True) 

126 

127 def __init__(self, 

128 macro=None, 

129 textlink=None, 

130 fPublished=None, 

131 fLocksText=None, 

132 nvSpPr=None, 

133 spPr=None, 

134 style=None, 

135 txBody=None, 

136 ): 

137 self.macro = macro 

138 self.textlink = textlink 

139 self.fPublished = fPublished 

140 self.fLocksText = fLocksText 

141 self.nvSpPr = nvSpPr 

142 self.spPr = spPr 

143 self.style = style 

144 self.txBody = txBody