A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://wxpython.org/Phoenix/docs/html/wx.grid.GridTableBase.html below:

wx.grid.GridTableBase — wxPython Phoenix 4.2.4a1 documentation

wx.grid.GridTableBase¶

The almost abstract base class for grid tables.

A grid table is responsible for storing the grid data and, indirectly, grid cell attributes. The data can be stored in the way most convenient for the application but has to be provided in string form to wx.grid.Grid. It is also possible to provide cells values in other formats if appropriate, e.g. as numbers.

This base class is not quite abstract as it implements a trivial strategy for storing the attributes by forwarding it to wx.grid.GridCellAttrProvider and also provides stubs for some other functions. However it does have a number of pure virtual methods which must be implemented in the derived classes.

Class Hierarchy¶

Inheritance diagram for class

GridTableBase

:

Known Subclasses¶

wx.grid.GridStringTable

Methods Summary¶ Properties Summary¶ Class API¶
class wx.grid.GridTableBase(Object)¶

Possible constructors:

The almost abstract base class for grid tables.


Methods¶
__init__(self)¶

Default constructor.

Return type:

None


AppendCols(self, numCols=1)¶

Exactly the same as AppendRows but for columns.

Parameters:

numCols (int)

Return type:

bool


AppendRows(self, numRows=1)¶

Append additional rows at the end of the table.

This method is provided in addition to InsertRows as some data models may only support appending rows to them but not inserting them at arbitrary locations. In such case you may implement this method only and leave InsertRows unimplemented.

Parameters:

numRows (int) – The number of rows to add.

Return type:

bool


CanGetValueAs(self, row, col, typeName)¶

Returns True if the value of the given cell can be accessed as if it were of the specified type.

By default the cells can only be accessed as strings. Note that a cell could be accessible in different ways, e.g. a numeric cell may return True for GRID_VALUE_NUMBER but also for GRID_VALUE_STRING indicating that the value can be coerced to a string form.

Parameters:
  • row (int)

  • col (int)

  • typeName (string)

Return type:

bool


CanHaveAttributes(self)¶

Returns True if this table supports attributes or False otherwise.

By default, the table automatically creates a wx.grid.GridCellAttrProvider when this function is called if it had no attribute provider before and returns True.

Return type:

bool


CanMeasureColUsingSameAttr(self, col)¶

Override to return True if the same attribute can be used for measuring all cells in the given column.

This function is provided for optimization purposes: it returns False by default, but can be overridden to return True when all the cells in the same grid column use sensibly the same attribute, i.e. they use the same renderer (either explicitly, or implicitly, due to their type as returned by GetTypeName ) and the font of the same size.

Returning True from this function allows AutoSizeColumns() to skip looking up the attribute and the renderer for each individual cell, which results in very noticeable performance improvements for the grids with many rows.

Parameters:

col (int)

Return type:

bool

Added in version 4.1/wxWidgets-3.1.4.


CanSetValueAs(self, row, col, typeName)¶

Returns True if the value of the given cell can be set as if it were of the specified type.

Parameters:
  • row (int)

  • col (int)

  • typeName (string)

Return type:

bool


Clear(self)¶

Clear the table contents.

This method is used by wx.grid.Grid.ClearGrid .

Return type:

None


DeleteCols(self, pos=0, numCols=1)¶

Exactly the same as DeleteRows but for columns.

Parameters:
  • pos (int)

  • numCols (int)

Return type:

bool


DeleteRows(self, pos=0, numRows=1)¶

Delete rows from the table.

Parameters:
  • pos (int) – The first row to delete.

  • numRows (int) – The number of rows to delete.

Return type:

bool


GetAttr(self, row, col, kind)¶

Return the attribute for the given cell.

By default this function is simply forwarded to wx.grid.GridCellAttrProvider.GetAttr but it may be overridden to handle attributes directly in the table.

Prefer to use GetAttrPtr to avoid the need to call DecRef() on the returned pointer manually.

Parameters:
  • row (int)

  • col (int)

  • kind (GridCellAttr.wxAttrKind)

Return type:

wx.grid.GridCellAttr


GetAttrProvider(self)¶

Returns the attribute provider currently being used.

This function may return None if the attribute provider hasn’t been either associated with this table by SetAttrProvider nor created on demand by any other methods.

Return type:

wx.grid.GridCellAttrProvider


GetAttrPtr(self, row, col, kind)¶

Return the attribute for the given cell.

This method is identical to GetAttr , but returns a smart pointer, which frees the caller from the need to call DecRef() manually.

Parameters:
  • row (int)

  • col (int)

  • kind (GridCellAttr.wxAttrKind)

Return type:

wx.grid.GridCellAttrPtr

Added in version 4.1/wxWidgets-3.1.4.


GetColLabelValue(self, col)¶

Return the label of the specified column.

Parameters:

col (int)

Return type:

str


GetColsCount(self)¶

Return the number of columns in the table.

This method is not virtual and is only provided as a convenience for the derived classes which can’t call GetNumberCols without a const_cast from their methods.

Return type:

int


GetCornerLabelValue(self)¶

Return the label of the grid’s corner.

Return type:

str

Added in version 4.1/wxWidgets-3.1.2.


GetNumberCols(self)¶

Must be overridden to return the number of columns in the table.

For backwards compatibility reasons, this method is not const. Use GetColsCount instead of it in methods of derived table classes,

Return type:

int


GetNumberRows(self)¶

Must be overridden to return the number of rows in the table.

For backwards compatibility reasons, this method is not const. Use GetRowsCount instead of it in methods of derived table classes.

Return type:

int


GetRowLabelValue(self, row)¶

Return the label of the specified row.

Parameters:

row (int)

Return type:

str


GetRowsCount(self)¶

Return the number of rows in the table.

This method is not virtual and is only provided as a convenience for the derived classes which can’t call GetNumberRows without a const_cast from their methods.

Return type:

int


GetTypeName(self, row, col)¶

Returns the type of the value in the given cell.

By default all cells are strings and this method returns GRID_VALUE_STRING .

Parameters:
  • row (int)

  • col (int)

Return type:

str


GetValue(self, row, col)¶

Must be overridden to implement accessing the table values as text.

Parameters:
  • row (int)

  • col (int)

Return type:

Any


GetValueAsBool(self, row, col)¶

Returns the value of the given cell as a boolean.

This should only be called if CanGetValueAs returns True when called with GRID_VALUE_BOOL argument. Default implementation always return False.

Parameters:
  • row (int)

  • col (int)

Return type:

bool


GetValueAsDouble(self, row, col)¶

Returns the value of the given cell as a double.

This should only be called if CanGetValueAs returns True when called with GRID_VALUE_FLOAT argument. Default implementation always return 0.0.

Parameters:
  • row (int)

  • col (int)

Return type:

float


GetValueAsLong(self, row, col)¶

Returns the value of the given cell as a long.

This should only be called if CanGetValueAs returns True when called with GRID_VALUE_NUMBER argument. Default implementation always return 0.

Parameters:
  • row (int)

  • col (int)

Return type:

int


GetView(self)¶

Returns the last grid passed to SetView .

Return type:

wx.grid.Grid


InsertCols(self, pos=0, numCols=1)¶

Exactly the same as InsertRows but for columns.

Parameters:
  • pos (int)

  • numCols (int)

Return type:

bool


InsertRows(self, pos=0, numRows=1)¶

Insert additional rows into the table.

Parameters:
  • pos (int) – The position of the first new row.

  • numRows (int) – The number of rows to insert.

Return type:

bool


IsEmpty(self, coords)¶

Same as IsEmptyCell but taking wx.grid.GridCellCoords.

Notice that this method is not virtual, only IsEmptyCell should be overridden.

Parameters:

coords (wx.grid.GridCellCoords)

Return type:

bool


IsEmptyCell(self, row, col)¶

May be overridden to implement testing for empty cells.

This method is used by the grid to test if the given cell is not used and so whether a neighbouring cell may overflow into it. By default it only returns True if the value of the given cell, as returned by GetValue , is empty.

Parameters:
  • row (int)

  • col (int)

Return type:

bool


SetAttr(self, attr, row, col)¶

Set attribute of the specified cell.

By default this function is simply forwarded to wx.grid.GridCellAttrProvider.SetAttr .

The table takes ownership of attr, i.e. will call DecRef() on it.

Parameters:
Return type:

None


SetAttrProvider(self, attrProvider)¶

Associate this attributes provider with the table.

The table takes ownership of attrProvider pointer and will delete it when it doesn’t need it any more. The pointer can be None, however this won’t disable attributes management in the table but will just result in a default attributes being recreated the next time any of the other functions in this section is called. To completely disable the attributes support, should this be needed, you need to override CanHaveAttributes to return False.

Parameters:

attrProvider (wx.grid.GridCellAttrProvider)

Return type:

None


SetColAttr(self, attr, col)¶

Set attribute of the specified column.

By default this function is simply forwarded to wx.grid.GridCellAttrProvider.SetColAttr .

The table takes ownership of attr, i.e. will call DecRef() on it.

Parameters:
Return type:

None


SetColLabelValue(self, col, label)¶

Exactly the same as SetRowLabelValue but for columns.

Parameters:
  • col (int)

  • label (string)

Return type:

None


SetCornerLabelValue(self)¶

Set the given label for the grid’s corner.

The default version does nothing, i.e. the label is not stored. You must override this method in your derived class if you wish wx.grid.Grid.GetCornerLabelValue to work.

Parameters:

`` (string)

Return type:

None

Added in version 4.1/wxWidgets-3.1.2.


SetRowAttr(self, attr, row)¶

Set attribute of the specified row.

By default this function is simply forwarded to wx.grid.GridCellAttrProvider.SetRowAttr .

The table takes ownership of attr, i.e. will call DecRef() on it.

Parameters:
Return type:

None


SetRowLabelValue(self, row, label)¶

Set the given label for the specified row.

The default version does nothing, i.e. the label is not stored. You must override this method in your derived class if you wish wx.grid.Grid.SetRowLabelValue to work.

Parameters:
  • row (int)

  • label (string)

Return type:

None


SetValue(self, row, col, value)¶

Must be overridden to implement setting the table values as text.

Parameters:
  • row (int)

  • col (int)

  • value (string)

Return type:

None


SetValueAsBool(self, row, col, value)¶

Sets the value of the given cell as a boolean.

This should only be called if CanSetValueAs returns True when called with GRID_VALUE_BOOL argument. Default implementation doesn’t do anything.

Parameters:
  • row (int)

  • col (int)

  • value (bool)

Return type:

None


SetValueAsDouble(self, row, col, value)¶

Sets the value of the given cell as a double.

This should only be called if CanSetValueAs returns True when called with GRID_VALUE_FLOAT argument. Default implementation doesn’t do anything.

Parameters:
  • row (int)

  • col (int)

  • value (float)

Return type:

None


SetValueAsLong(self, row, col, value)¶

Sets the value of the given cell as a long.

This should only be called if CanSetValueAs returns True when called with GRID_VALUE_NUMBER argument. Default implementation doesn’t do anything.

Parameters:
  • row (int)

  • col (int)

  • value (long)

Return type:

None


SetView(self, grid)¶

Called by the grid when the table is associated with it.

The default implementation stores the pointer and returns it from its GetView and so only makes sense if the table cannot be associated with more than one grid at a time.

Parameters:

grid (wx.grid.Grid)

Return type:

None


Properties¶
AttrProvider¶

See GetAttrProvider and SetAttrProvider


ColsCount¶

See GetColsCount


CornerLabelValue¶

See GetCornerLabelValue and SetCornerLabelValue


NumberCols¶

See GetNumberCols


NumberRows¶

See GetNumberRows


RowsCount¶

See GetRowsCount


View¶

See GetView and SetView


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4