widgetastic_patternfly4.table module

class widgetastic_patternfly4.table.BaseExpandableTable(*args, **kwargs)

Bases: object

The patternfly 4 expandable table has the following outline:

<table>
  <thead>
  <tbody>
    <tr>The row always on display.</tr>
    <tr>The "expandable" content viewed by clicking the arrow button</tr>
  </tbody>
  <tbody>
    <tr>Next row...</tr>
    <tr>Next row's expandable content...</tr>

Therefore, we modify the behavior of Table here to look for rows based on ‘tbody’ tags instead of ‘tr’ tags. We use a custom class, ExpandableTableRow, which treats the first <tr> tag as a normal table row (if you call row.read(), it will read the this row – also table column widgets will apply to this row, etc. etc.), but it will treat the second <tr> tag as a Text widget, or a parent for a custom defined View

COLUMN_AT_POSITION = './tr[1]/td[{0}]'
COLUMN_RESOLVER_PATH = '/tr[0]/td'
HEADERS = './thead/tr/th|./thead/tr/td'
ROWS = './tbody'
ROW_AT_INDEX = './tbody[{0}]'
ROW_RESOLVER_PATH = '/table/tbody'
ROW_TAG = 'tbody'
Row

alias of ExpandableTableRow

class widgetastic_patternfly4.table.BasePatternflyTable

Bases: object

Represents the Patternfly table.

https://www.patternfly.org/v4/documentation/react/components/table

HEADERS = './thead/tr/th|./tr/th|./thead/tr/td'
ROWS = './tbody/tr[./td]'
Row

alias of PatternflyTableRow

deselect_all(column=0)

Deselects all the rows.

header_row

This class handles instantiating and caching of the widgets on view.

It stores the class and the parameters it should be instantiated with. Once it is accessed from the instance of the class where it was defined on, it passes the instance to the widget class followed by args and then kwargs.

It also acts as a counter, so you can then order the widgets by their “creation” stamp.

select_all(column=0)

Selects all the rows.

sort_by(column, order)

Sets the sort order for the supplied column by name, and “ascending/descending”.

exception widgetastic_patternfly4.table.ColumnNotExpandable(column)

Bases: Exception

class widgetastic_patternfly4.table.CompoundExpandableRow(parent, index, logger=None)

Bases: widgetastic_patternfly4.table.PatternflyTableRow

Column

alias of ExpandableColumn

EXPANDABLE_COLUMNS = "./tr[1]/td[contains(@class, 'compound-expansion')]"
HEADER_IN_ROW = './tr[1]/th[1]'
TABLE_COLUMN_CLS

alias of ExpandableColumn

class widgetastic_patternfly4.table.CompoundExpandableTable(*args, **kwargs)

Bases: widgetastic_patternfly4.table.PatternflyTable

This widget is similar to the ExpandableTable, only that it can have any number of expandable rows, and the expandable column is not necessarily in the first position.

https://www.patternfly.org/v4/documentation/react/components/table#

COLUMN_AT_POSITION = './tr[1]/td[{0}]'
COLUMN_RESOLVER_PATH = '/tr[0]/td'
HEADERS = './thead/tr/th|./thead/tr/td'
ROWS = './tbody'
ROW_AT_INDEX = './tbody[{0}]'
ROW_RESOLVER_PATH = '/table/tbody'
ROW_TAG = 'tbody'
Row

alias of CompoundExpandableRow

class widgetastic_patternfly4.table.ExpandableColumn(parent, position, content_view=None, absolute_position=None, logger=None, use_index_as_parent=False)

Bases: widgetastic.widget.table.TableColumn

EXPAND_LOCATOR = './button'
collapse()

Collapses the table column.

expand()

Expands the table column.

is_expandable

To check to see if this column is expandable, check to see if a button is in it.

is_expanded
widget

Returns the associated widget if defined. If there is none defined, returns None.

class widgetastic_patternfly4.table.ExpandableTable(*args, **kwargs)

Bases: widgetastic_patternfly4.table.BaseExpandableTable, widgetastic_patternfly4.table.PatternflyTable

class widgetastic_patternfly4.table.ExpandableTableHeaderColumn(parent, position, absolute_position=None, logger=None)

Bases: widgetastic.widget.table.TableColumn

Used for special cases where a <th> appears as a column in ExpandableTable.

class widgetastic_patternfly4.table.ExpandableTableRow(parent, index, content_view=None, logger=None)

Bases: widgetastic_patternfly4.table.PatternflyTableRow

Represents a row in the table.

If subclassing and also changing the Column class, do not forget to set the Column to the new class.

Parameters:index – Position of the row in the table.
EXPANDABLE_CONTENT = './tr[2]'
HEADER_IN_ROW = './tr[1]/th[1]'
ROW = './tr[1]'
TABLE_COLUMN_CLS

alias of ExpandableTableHeaderColumn

collapse()

Collapses the table row.

expand()

Expands the table row.

is_displayed

Returns a boolean detailing if the Table Row is displayed.

is_expandable

Returns a boolean detailing if the table row is expandable.

is_expanded

Returns a boolean detailing if the table row has been expanded.

read()

Returns a text representation of the table row.

class widgetastic_patternfly4.table.HeaderColumn(parent, position, absolute_position=None, logger=None)

Bases: widgetastic.widget.table.TableColumn

Represents a cell in the header row.

is_sortable

Returns true of the column is sortable.

sort(order='ascending')

Sorts the column according to the supplied “ascending” or “descending”.

sorting_order

Returns current sorting order as a string.

class widgetastic_patternfly4.table.HeaderRow(parent, logger=None)

Bases: widgetastic.widget.table.TableRow

Column

alias of HeaderColumn

read()

Returns the values of the headers of the HeaderRow object.

class widgetastic_patternfly4.table.PatternflyTable(parent, locator, column_widgets=None, assoc_column=None, rows_ignore_top=None, rows_ignore_bottom=None, top_ignore_fill=False, bottom_ignore_fill=False, logger=None)

Bases: widgetastic_patternfly4.table.BasePatternflyTable, widgetastic.widget.table.Table

class widgetastic_patternfly4.table.PatternflyTableRow(parent, index, logger=None)

Bases: widgetastic.widget.table.TableRow

Extends TableRow to support having a ‘th’ tag within the row

HEADER_IN_ROW = './th[1]'
TABLE_COLUMN_CLS

alias of widgetastic.widget.table.TableColumn

has_row_header

Returns a boolean detailing if the Table Row has a header.

exception widgetastic_patternfly4.table.RowNotExpandable(row)

Bases: Exception