Package logilab :: Package common :: Module table :: Class TableStyleSheet

[frames] | no frames]

# Class TableStyleSheet

source code

    A simple Table stylesheet
    Rules are expressions where cells are defined by the row_index
    and col_index separated by an underscore ('_').
    For example, suppose you want to say that the (2,5) cell must be
    the sum of its two preceding cells in the row, you would create
    the following rule :
        2_5 = 2_3 + 2_4
    You can also use all the math.* operations you want. For example:
        2_5 = sqrt(2_3**2 + 2_4**2)

Instance Methods

__init__(self, rules=None) | source code

add_rule(self, rule) Adds a rule to the stylesheet rules... | source code

add_rowsum_rule(self, dest_cell, row_index, start_col, end_col) Creates and adds a rule to sum over the row at row_index from start_col to end_col. | source code

add_rowavg_rule(self, dest_cell, row_index, start_col, end_col) Creates and adds a rule to make the row average (from start_col to end_col) dest_cell is a tuple of two elements (x,y) of the destination cell No check is done for indexes ranges. | source code

add_colsum_rule(self, dest_cell, col_index, start_row, end_row) Creates and adds a rule to sum over the col at col_index from start_row to end_row. | source code

add_colavg_rule(self, dest_cell, col_index, start_row, end_row) Creates and adds a rule to make the col average (from start_row to end_row) dest_cell is a tuple of two elements (x,y) of the destination cell No check is done for indexes ranges. | source code

Method Details

### add_rule(self, rule)

source code

    Adds a rule to the stylesheet rules

### add_rowsum_rule(self, dest_cell, row_index, start_col, end_col)

source code

    Creates and adds a rule to sum over the row at row_index from
    start_col to end_col.
    dest_cell is a tuple of two elements (x,y) of the destination cell
    No check is done for indexes ranges.
    pre:
        start_col >= 0
        end_col > start_col

### add_rowavg_rule(self, dest_cell, row_index, start_col, end_col)

source code

    Creates and adds a rule to make the row average (from start_col
    to end_col)
    dest_cell is a tuple of two elements (x,y) of the destination cell
    No check is done for indexes ranges.
    pre:
        start_col >= 0
        end_col > start_col

### add_colsum_rule(self, dest_cell, col_index, start_row, end_row)

source code

    Creates and adds a rule to sum over the col at col_index from
    start_row to end_row.
    dest_cell is a tuple of two elements (x,y) of the destination cell
    No check is done for indexes ranges.
    pre:
        start_row >= 0
        end_row > start_row

### add_colavg_rule(self, dest_cell, col_index, start_row, end_row)

source code

    Creates and adds a rule to make the col average (from start_row
    to end_row)
    dest_cell is a tuple of two elements (x,y) of the destination cell
    No check is done for indexes ranges.
    pre:
        start_row >= 0
        end_row > start_row