From 0dfe1c9e2780469e3a4696e8fb3e6f717a7ebeb7 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 16 Sep 2022 11:09:35 +0200 Subject: Adding upstream version 3.1.0. Signed-off-by: Daniel Baumann --- docs/settings.rst | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 docs/settings.rst (limited to 'docs/settings.rst') diff --git a/docs/settings.rst b/docs/settings.rst new file mode 100644 index 0000000..c609d1f --- /dev/null +++ b/docs/settings.rst @@ -0,0 +1,79 @@ +.. _settings: + +======== +Settings +======== + +All tables (except :ref:`githubtable`) have the same settings to change the way the table is displayed. These attributes +are available after instantiation. + +.. py:attribute:: Table.table_data + + The actual table data to render. This must be a list (or tuple) of lists of strings. The outer list holds the rows + and the inner lists holds the cells (aka columns in that row). + + Example: + + .. code-block:: python + + table.table_data = [ + ['Name', 'Color', 'Type'], + ['Avocado', 'green', 'nut'], + ['Tomato', 'red', 'fruit'], + ['Lettuce', 'green', 'vegetable'], + ] + +.. py:attribute:: Table.title + + Optional title to show within the top border of the table. This is ignored if None or a blank string. + +.. py:attribute:: Table.inner_column_border + + Toggles the column dividers. Set to **False** to disable these vertically dividing borders. + +.. py:attribute:: Table.inner_footing_row_border + + Show a horizontal dividing border before the last row. If **True** this defines the last row as the table footer. + +.. py:attribute:: Table.inner_heading_row_border + + Show a horizontal dividing border after the first row. If **False** this removes the border so the first row is no + longer considered a header row. It'll look just like any other row. + +.. py:attribute:: Table.inner_row_border + + If **True** terminaltables will show dividing borders between every row. + +.. py:attribute:: Table.outer_border + + Toggles the four outer borders. If **False** the top, left, right, and bottom borders will not be shown. + +.. py:attribute:: Table.justify_columns + + Aligns text in entire columns. The keys in this dict are column integers (0 for the first column) and the values + are either 'left', 'right', or 'center'. Left is the default. + + Example: + + .. code-block:: pycon + + >>> table.justify_columns[0] = 'right' # Name column. + >>> table.justify_columns[1] = 'center' # Color column. + >>> print table.table + +---------+-------+-----------+ + | Name | Color | Type | + +---------+-------+-----------+ + | Avocado | green | nut | + | Tomato | red | fruit | + | Lettuce | green | vegetable | + +---------+-------+-----------+ + +.. py:attribute:: Table.padding_left + + Number of spaces to pad on the left side of every cell. Default is **1**. Padding adds spacing between the cell text + and the column border. + +.. py:attribute:: Table.padding_right + + Number of spaces to pad on the right side of every cell. Default is **1**. Padding adds spacing between the cell + text and the column border. -- cgit v1.2.3