1+ from abc import ABC , abstractmethod
2+ from collections .abc import Sequence
3+ from dataclasses import dataclass
14from enum import Enum , Flag , IntEnum , IntFlag
2- from typing import Literal
5+ from typing import Final , Literal
36from typing_extensions import Self , TypeAlias
47
8+ from .drawing import DeviceCMYK , DeviceGray , DeviceRGB
59from .syntax import Name
610
11+ _Color : TypeAlias = str | int | Sequence [int ] | DeviceCMYK | DeviceGray | DeviceRGB
12+
713class SignatureFlag (IntEnum ):
814 SIGNATURES_EXIST = 1
915 APPEND_ONLY = 2
@@ -68,15 +74,6 @@ class MethodReturnValue(CoerciveIntFlag):
6874 LINES = 2
6975 HEIGHT = 4
7076
71- class TableBordersLayout (CoerciveEnum ):
72- ALL = "ALL"
73- NONE = "NONE"
74- INTERNAL = "INTERNAL"
75- MINIMAL = "MINIMAL"
76- HORIZONTAL_LINES = "HORIZONTAL_LINES"
77- NO_HORIZONTAL_LINES = "NO_HORIZONTAL_LINES"
78- SINGLE_TOP_LINE = "SINGLE_TOP_LINE"
79-
8077class CellBordersLayout (CoerciveIntFlag ):
8178 NONE = 0
8279 LEFT = 1
@@ -86,6 +83,90 @@ class CellBordersLayout(CoerciveIntFlag):
8683 ALL = 15
8784 INHERIT = 16
8885
86+ @dataclass
87+ class TableBorderStyle :
88+ thickness : float | None = None
89+ color : int | tuple [int , int , int ] | None = None
90+ dash : float | None = None
91+ gap : float = 0.0
92+ phase : float = 0.0
93+
94+ @staticmethod
95+ def from_bool (should_draw : TableBorderStyle | bool | None ) -> TableBorderStyle : ...
96+ @property
97+ def dash_dict (self ) -> dict [str , float | None ]: ...
98+ def changes_stroke (self , pdf ) -> bool : ...
99+ def should_render (self ) -> bool : ...
100+ def get_change_stroke_commands (self , scale : float ) -> list [str ]: ...
101+ @staticmethod
102+ def get_line_command (x1 : float , y1 : float , x2 : float , y2 : float ) -> list [str ]: ...
103+ def get_draw_commands (self , pdf , x1 : float , y1 : float , x2 : float , y2 : float ) -> list [str ]: ...
104+
105+ @dataclass
106+ class TableCellStyle :
107+ left : bool | TableBorderStyle = False
108+ bottom : bool | TableBorderStyle = False
109+ right : bool | TableBorderStyle = False
110+ top : bool | TableBorderStyle = False
111+
112+ @staticmethod
113+ def get_change_fill_color_command (color : _Color | None ) -> list [str ]: ...
114+ def get_draw_commands (
115+ self , pdf , x1 : float , y1 : float , x2 : float , y2 : float , fill_color : _Color | None = None
116+ ) -> list [str ]: ...
117+ def override_cell_border (self , cell_border : CellBordersLayout ) -> Self : ...
118+ def draw_cell_border (self , pdf , x1 : float , y1 : float , x2 : float , y2 : float , fill_color : _Color | None = None ) -> None : ...
119+
120+ class TableBordersLayout (ABC ):
121+ ALL : Final [TableBordersLayoutAll ]
122+ NONE : Final [TableBordersLayoutNone ]
123+ INTERNAL : Final [TableBordersLayoutInternal ]
124+ MINIMAL : Final [TableBordersLayoutMinimal ]
125+ HORIZONTAL_LINES : Final [TableBordersLayoutHorizontalLines ]
126+ NO_HORIZONTAL_LINES : Final [TableBordersLayoutNoHorizontalLines ]
127+ SINGLE_TOP_LINE : Final [TableBordersLayoutSingleTopLine ]
128+ @abstractmethod
129+ def cell_style_getter (
130+ self , row_idx : int , col_idx : int , col_pos : int , num_heading_rows : int , num_rows : int , num_col_idx : int , num_col_pos : int
131+ ) -> TableCellStyle : ...
132+ @classmethod
133+ def coerce (cls , value : Self | str ) -> Self : ...
134+
135+ class TableBordersLayoutAll (TableBordersLayout ):
136+ def cell_style_getter (
137+ self , row_idx : int , col_idx : int , col_pos : int , num_heading_rows : int , num_rows : int , num_col_idx : int , num_col_pos : int
138+ ) -> TableCellStyle : ...
139+
140+ class TableBordersLayoutNone (TableBordersLayout ):
141+ def cell_style_getter (
142+ self , row_idx : int , col_idx : int , col_pos : int , num_heading_rows : int , num_rows : int , num_col_idx : int , num_col_pos : int
143+ ) -> TableCellStyle : ...
144+
145+ class TableBordersLayoutInternal (TableBordersLayout ):
146+ def cell_style_getter (
147+ self , row_idx : int , col_idx : int , col_pos : int , num_heading_rows : int , num_rows : int , num_col_idx : int , num_col_pos : int
148+ ) -> TableCellStyle : ...
149+
150+ class TableBordersLayoutMinimal (TableBordersLayout ):
151+ def cell_style_getter (
152+ self , row_idx : int , col_idx : int , col_pos : int , num_heading_rows : int , num_rows : int , num_col_idx : int , num_col_pos : int
153+ ) -> TableCellStyle : ...
154+
155+ class TableBordersLayoutHorizontalLines (TableBordersLayout ):
156+ def cell_style_getter (
157+ self , row_idx : int , col_idx : int , col_pos : int , num_heading_rows : int , num_rows : int , num_col_idx : int , num_col_pos : int
158+ ) -> TableCellStyle : ...
159+
160+ class TableBordersLayoutNoHorizontalLines (TableBordersLayout ):
161+ def cell_style_getter (
162+ self , row_idx : int , col_idx : int , col_pos : int , num_heading_rows : int , num_rows : int , num_col_idx : int , num_col_pos : int
163+ ) -> TableCellStyle : ...
164+
165+ class TableBordersLayoutSingleTopLine (TableBordersLayout ):
166+ def cell_style_getter (
167+ self , row_idx : int , col_idx : int , col_pos : int , num_heading_rows : int , num_rows : int , num_col_idx : int , num_col_pos : int
168+ ) -> TableCellStyle : ...
169+
89170class TableCellFillMode (CoerciveEnum ):
90171 NONE = "NONE"
91172 ALL = "ALL"
0 commit comments