Coverage for /var/srv/projects/api.amasfac.comuna18.com/tmp/venv/lib/python3.9/site-packages/openpyxl/worksheet/views.py: 58%

83 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 ( 

4 Bool, 

5 Integer, 

6 String, 

7 Set, 

8 Float, 

9 Typed, 

10 NoneSet, 

11 Sequence, 

12) 

13from openpyxl.descriptors.excel import ExtensionList 

14from openpyxl.descriptors.serialisable import Serialisable 

15 

16 

17class Pane(Serialisable): 

18 xSplit = Float(allow_none=True) 

19 ySplit = Float(allow_none=True) 

20 topLeftCell = String(allow_none=True) 

21 activePane = Set(values=("bottomRight", "topRight", "bottomLeft", "topLeft")) 

22 state = Set(values=("split", "frozen", "frozenSplit")) 

23 

24 def __init__(self, 

25 xSplit=None, 

26 ySplit=None, 

27 topLeftCell=None, 

28 activePane="topLeft", 

29 state="split"): 

30 self.xSplit = xSplit 

31 self.ySplit = ySplit 

32 self.topLeftCell = topLeftCell 

33 self.activePane = activePane 

34 self.state = state 

35 

36 

37class Selection(Serialisable): 

38 pane = NoneSet(values=("bottomRight", "topRight", "bottomLeft", "topLeft")) 

39 activeCell = String(allow_none=True) 

40 activeCellId = Integer(allow_none=True) 

41 sqref = String(allow_none=True) 

42 

43 def __init__(self, 

44 pane=None, 

45 activeCell="A1", 

46 activeCellId=None, 

47 sqref="A1"): 

48 self.pane = pane 

49 self.activeCell = activeCell 

50 self.activeCellId = activeCellId 

51 self.sqref = sqref 

52 

53 

54class SheetView(Serialisable): 

55 

56 """Information about the visible portions of this sheet.""" 

57 

58 tagname = "sheetView" 

59 

60 windowProtection = Bool(allow_none=True) 

61 showFormulas = Bool(allow_none=True) 

62 showGridLines = Bool(allow_none=True) 

63 showRowColHeaders = Bool(allow_none=True) 

64 showZeros = Bool(allow_none=True) 

65 rightToLeft = Bool(allow_none=True) 

66 tabSelected = Bool(allow_none=True) 

67 showRuler = Bool(allow_none=True) 

68 showOutlineSymbols = Bool(allow_none=True) 

69 defaultGridColor = Bool(allow_none=True) 

70 showWhiteSpace = Bool(allow_none=True) 

71 view = NoneSet(values=("normal", "pageBreakPreview", "pageLayout")) 

72 topLeftCell = String(allow_none=True) 

73 colorId = Integer(allow_none=True) 

74 zoomScale = Integer(allow_none=True) 

75 zoomScaleNormal = Integer(allow_none=True) 

76 zoomScaleSheetLayoutView = Integer(allow_none=True) 

77 zoomScalePageLayoutView = Integer(allow_none=True) 

78 zoomToFit = Bool(allow_none=True) # Chart sheets only 

79 workbookViewId = Integer() 

80 selection = Sequence(expected_type=Selection) 

81 pane = Typed(expected_type=Pane, allow_none=True) 

82 

83 def __init__( 

84 self, 

85 windowProtection=None, 

86 showFormulas=None, 

87 showGridLines=None, 

88 showRowColHeaders=None, 

89 showZeros=None, 

90 rightToLeft=None, 

91 tabSelected=None, 

92 showRuler=None, 

93 showOutlineSymbols=None, 

94 defaultGridColor=None, 

95 showWhiteSpace=None, 

96 view=None, 

97 topLeftCell=None, 

98 colorId=None, 

99 zoomScale=None, 

100 zoomScaleNormal=None, 

101 zoomScaleSheetLayoutView=None, 

102 zoomScalePageLayoutView=None, 

103 zoomToFit=None, 

104 workbookViewId=0, 

105 selection=None, 

106 pane=None, 

107 ): 

108 self.windowProtection = windowProtection 

109 self.showFormulas = showFormulas 

110 self.showGridLines = showGridLines 

111 self.showRowColHeaders = showRowColHeaders 

112 self.showZeros = showZeros 

113 self.rightToLeft = rightToLeft 

114 self.tabSelected = tabSelected 

115 self.showRuler = showRuler 

116 self.showOutlineSymbols = showOutlineSymbols 

117 self.defaultGridColor = defaultGridColor 

118 self.showWhiteSpace = showWhiteSpace 

119 self.view = view 

120 self.topLeftCell = topLeftCell 

121 self.colorId = colorId 

122 self.zoomScale = zoomScale 

123 self.zoomScaleNormal = zoomScaleNormal 

124 self.zoomScaleSheetLayoutView = zoomScaleSheetLayoutView 

125 self.zoomScalePageLayoutView = zoomScalePageLayoutView 

126 self.zoomToFit = zoomToFit 

127 self.workbookViewId = workbookViewId 

128 self.pane = pane 

129 if selection is None: 

130 selection = (Selection(), ) 

131 self.selection = selection 

132 

133 

134class SheetViewList(Serialisable): 

135 

136 tagname = "sheetViews" 

137 

138 sheetView = Sequence(expected_type=SheetView, ) 

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

140 

141 __elements__ = ('sheetView',) 

142 

143 def __init__(self, 

144 sheetView=None, 

145 extLst=None, 

146 ): 

147 if sheetView is None: 

148 sheetView = [SheetView()] 

149 self.sheetView = sheetView