OEImageTableOptions

class OEImageTableOptions

This class represents the OEImageTableOptions class that encapsulates properties that determine how an image table is depicted.

The OEImageTableOptions class stores the following properties:

Property

Get method

Set method

Corresponding namespace / class / type

number of columns

NumColumns

integer greater than 0

number of rows

NumRows

integer greater than 1

width of columns

SetColumnWidths

vector of non zero integers

height of rows

SetRowHeights

vector of non zero integers

cell font size

SetBaseFontSize

positive non-zero integer

pen used around cells cells

GetCellBorderPen

SetCellBorderPen

OEPen

table cell color

GetCellColor

SetCellColor

OEColor

table cell font

GetCellFont

SetCellFont

OEFont

header

HasHeader

SetHeader

boolean

header color

GetHeaderColor

SetHeaderColor

OEColor

header font

GetHeaderFont

SetHeaderFont

OEFont

table margins

GetMargin

SetMargin / SetMargins

positive floating point number in the range of \([0.0, 25.0]\)

stub column

HasStubColumn

SetStubColumn

boolean

stub column color

GetStubColumnColor

SetStubColumnColor

OEColor

stub column font

GetStubColumnFont

SetStubColumnFont

OEFont

Constructors

OEImageTableOptions(rows: int, cols: int, style: int) -> OEImageTableOptions

Creates an OEImageTableOptions object with the given parameters.

rows

The total number of rows in the table including the header.

cols

The total number of columns in the table including the stub column.

style

This value has to be from the OEImageTableStyle namespace.

Note

By default, the columns and rows of a table are created with equal widths and heights. The relative width and height ratio of the columns and rows can be adjusted using the OEImageTableOptions.SetColumnWidths and OEImageTableOptions.SetRowHeights methods, respectively.

Example (Example of generating a 4 x 4 image table with header and ‘MediumBlue’ style)

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
../../_images/OEImageTableOptions_Default.png

Example of generating a 4 x 4 image table with header and ‘MediumBlue’ style

OEImageTableOptions(arg2: OEImageTableOptions) -> OEImageTableOptions

Copy constructor.

GetCellBorderPen

GetCellBorderPen() -> OEPen

Returns the pen that is used to mark the border of the cells in the table.

GetCellColor

GetCellColor(even: bool = True) -> OEColor

Returns the color used to highlight the ‘body’ cells in the table. A cell is considered to be part of the ‘body’ of the table if it is neither in the header nor in the stub column.

even

This parameter determines whether to return the color of the even or odd rows in the table.

GetCellFont

GetCellFont() -> OEFont

Returns the font used by the OEImageTable.DrawText method to draw text on the ‘body’ cells.

See also

GetHeaderColor

GetHeaderColor() -> OEColor

Returns the color used to highlight the ‘header’ cells in the table.

GetHeaderFont

GetHeaderFont() -> OEFont

Returns the font used by the OEImageTable.DrawText method to draw text on the ‘header’ cells.

GetMargin

GetMargin(margin: int) -> float

Returns the ratio of a specific margin of the table.

margin

This value has to be from the OEMargin namespace.

GetStubColumnColor

GetStubColumnColor() -> OEColor

Returns the color used to highlight the ‘stub column’ cells in the table.

GetStubColumnFont

GetStubColumnFont() -> OEFont

Returns the font used by the OEImageTable.DrawText method to draw text on the ‘stub column’ cells.

HasHeader

HasHeader() -> bool

Returns whether a table has a ‘header’ row. By default, a table is generated with a ‘header’ row.

HasStubColumn

HasStubColumn() -> bool

Returns whether the table has a ‘stub’ column. By default, a table is generated without a ‘stub’ column.

NumColumns

NumColumns() -> int

Returns the total number of columns in the table including the stub column.

NumRows

NumRows() -> int

Returns the total number of rows in the table including the header row.

SetBaseFontSize

SetBaseFontSize(fsize: int) -> None

Controls the font size in add table cells (including cells of header, stub column and body).

See also

The other properties of the used fonts can be controlled with the following methods:

SetCellBorderPen

SetCellBorderPen(p: OEPen) -> None

Sets the pen that is used to mark the border of the cells in the table.

Example (Example of using the SetCellBorderPen method)

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
pen = oedepict.OEPen(oechem.OEBlack, oechem.OEDarkBlue, oedepict.OEFill_Off, 2.0)
tableopts.SetCellBorderPen(pen)
../../_images/OEImageTableOptions_SetCellBorderPen.png

Example of using the SetCellBorderPen method

SetCellColor

SetCellColor(arg2: OEColor, even: bool = True) -> None

Sets the color used to highlight the ‘body’ cells in the table. A cell is considered to be part of the ‘body’ of the table if it is neither in the header nor in the stub column.

color

The color of the cells.

even

This parameter determines whether the color is applied to the even or to the odd rows of the table.

Example (Example of using the SetCellColor method)

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
evenrow = True
tableopts.SetCellColor(oechem.OELightGrey, not evenrow)
../../_images/OEImageTableOptions_SetCellColor.png

Example of using the SetCellColor method

SetCellFont

SetCellFont(arg2: OEFont) -> None

Sets the font used by the OEImageTable.DrawText method to draw text on the ‘body’ cells. A cell is considered to be part of the ‘body’ of the table if it is neither in the header nor in the stub column.

Example (Example of using the SetCellFont method)

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
font = oedepict.OEFont(oedepict.OEFontFamily_Default,
                       oedepict.OEFontStyle_Italic | oedepict.OEFontStyle_Bold,
                       8, oedepict.OEAlignment_Left, oechem.OEDarkRed)
tableopts.SetCellFont(font)
../../_images/OEImageTableOptions_SetCellFont.png

Example of using the SetCellFont method

SetColumnWidths

SetColumnWidths(arg2: OEUIntVector) -> bool

Sets the relative widths of the columns.

widths

The relative widths of the columns. The size of the vector has to be OEImageTableOptions.NumColumns().

Example (Example of using the SetColumnWidths method)

The following example show how to adjust the width ratio of the columns.

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
tableopts.SetColumnWidths([20, 10, 20, 10])
../../_images/OEImageTableOptions_SetColumnWidths.png

Example of using the SetColumnWidths method

SetHeader

SetHeader(has: bool) -> bool

Sets whether to have a ‘header’ row in the table.

Example (Example of using the SetHeader method)

By default, a table is generated with a header row on the top. The following example show how to remove the header.

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
tableopts.SetHeader(False)
../../_images/OEImageTableOptions_SetHeader.png

Example of using the SetHeader method

SetHeaderColor

SetHeaderColor(arg2: OEColor) -> None

Sets the color used to highlight the ‘header’ cells in the table.

Example (Example of using the SetHeaderColor method)

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
tableopts.SetHeaderColor(oechem.OELightGrey)
../../_images/OEImageTableOptions_SetHeaderColor.png

Example of using the SetHeaderColor method

SetHeaderFont

SetHeaderFont(arg2: OEFont) -> None

Sets the font used by the OEImageTable.DrawText method to draw text on the ‘header’ cells.

Example (Example of using the SetHeaderFont method)

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
font = oedepict.OEFont(oedepict.OEFontFamily_Default, oedepict.OEFontStyle_Default, 12,
                       oedepict.OEAlignment_Right, oechem.OEPinkTint)
tableopts.SetHeaderFont(font)
../../_images/OEImageTableOptions_SetHeaderFont.png

Example of using the SetHeaderFont method

SetMargin

SetMargin(margin: int, percent: float) -> bool

Sets the size of a specific margin of the table.

marginloc

This value has to be from the OEMargin namespace.

margin

This number is considered as a percentage of either the width or the height of image on which the table will be drawn and has to be in the range of \([0.0, 25.0]\). For example, 10.0% means, that the left and right margin are 10% of the total width of the image, and the top and bottom margins are 10% of the total height of the image.

Example (Example of using the SetMargin method)

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
tableopts.SetMargin(oedepict.OEMargin_Left, 10.0)
tableopts.SetMargin(oedepict.OEMargin_Right, 10.0)
../../_images/OEImageTableOptions_SetMargin.png

Example of using the SetMargin method

SetMargins

SetMargins(percent: float) -> bool

Sets the size of all margins of the table.

margin

This number is considered as a percentage of either the width or the height of image on which the table will be drawn and has to be in the range of \([0.0, 25.0]\). For example, 10.0% means, that the left and right margin are 10% of the total width of the image, and the top and bottom margins are 10% of the total height of the image.

Example (Example of using the SetMargins method)

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
tableopts.SetMargins(10.0)
../../_images/OEImageTableOptions_SetMargins.png

Example of using the SetMargins method

SetRowHeights

SetRowHeights(arg2: OEUIntVector) -> bool

Sets the relative heights of the rows.

heights

The relative heights of the rows. The size of the vector has to be OEImageTableOptions.NumRows().

Example (Example of using the SetRowHeights method)

The following example show how to adjust the height ratio of the rows.

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
tableopts.SetRowHeights([10, 20, 30, 40])
../../_images/OEImageTableOptions_SetRowHeights.png

Example of using the SetRowHeights method

SetStubColumn

SetStubColumn(has: bool) -> bool

Sets whether to have a ‘stub’ column in the table.

Example (Example of using the SetStubColumn method)

By default, a table is generated without a ‘stub’ column. The following example show how to add one on the left.

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
tableopts.SetStubColumn(True)
../../_images/OEImageTableOptions_SetStubColumn.png

Example of using the SetStubColumn method

SetStubColumnColor

SetStubColumnColor(arg2: OEColor) -> None

Sets the color used to highlight the ‘stub’ cells in the table.

Example (Example of using the SetStubColumnColor method)

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
tableopts.SetStubColumn(True)
tableopts.SetStubColumnColor(oechem.OELightGrey)
../../_images/OEImageTableOptions_SetStubColumnColor.png

Example of using the SetStubColumnColor method

SetStubColumnFont

SetStubColumnFont(arg2: OEFont) -> None

Sets the font used by the OEImageTable.DrawText method to draw text on the ‘stub column’ cells.

Example (Example of using the SetStubColumnFont method)

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
tableopts.SetStubColumn(True)
font = oedepict.OEFont(oedepict.OEFontFamily_Default, oedepict.OEFontStyle_Default, 12,
                       oedepict.OEAlignment_Right, oechem.OEPinkTint)
tableopts.SetStubColumnFont(font)
../../_images/OEImageTableOptions_SetStubColumnFont.png

Example of using the SetStubColumnFont method