mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
[enh] allow to add caption to table
This commit is contained in:
parent
250fc4d728
commit
c44191bc2c
1 changed files with 4 additions and 1 deletions
|
@ -65,10 +65,11 @@ console.format_exception = _format_exception
|
|||
|
||||
|
||||
class Table:
|
||||
def __init__(self, data, columns=None, title=None, row_function=None):
|
||||
def __init__(self, data, columns=None, title=None, row_function=None, caption=""):
|
||||
self.data = data
|
||||
self.columns = columns
|
||||
self.title = title
|
||||
self.caption = caption
|
||||
self.row_function = row_function
|
||||
|
||||
def __getitem__(self, key):
|
||||
|
@ -87,6 +88,8 @@ class Table:
|
|||
table_name = list(self.data.keys())[0]
|
||||
table.title = f"[bold]{self.title if self.title else table_name}[/]"
|
||||
table.title_style = Style(color="white", bgcolor=None)
|
||||
table.caption = "[dim]" + self.caption + "[/dim]"
|
||||
table.caption_style = Style(color="white", bgcolor=None)
|
||||
table.row_styles = ["none", "dim"]
|
||||
table.box = box.SIMPLE_HEAD
|
||||
table.border_style = "bright_yellow"
|
||||
|
|
Loading…
Add table
Reference in a new issue