class documentation

class _Cells:

View In Hierarchy

Class _Cells aggregates _Cell objects in a simple list

Composed to Grid.cells property.
It serves methods for handling aggregated _Cell objects and to apply them
to the resulting layout. Note that coordinates are saved within _Cell objects.
Method __init__ Example
Instance Variable grid Grid object
Method get Get accessor for _list of _Cell objects
Method add Add (or aggregate) a _Cell object to the _list
Method get_cell Return the _Cell object from coordinate (y,x)
Method get_last Return the last inserted _Cell object
Method has_taken Check if a _Cell object exists at coordinate (y, x)
Method get_current_max_y Get the maximum y-coordinate value out of all aggregated _Cell objects
Method apply_to_layout Add all _Cell.item objects to the resulting QGridLayout
Instance Variable _list Aggregated list of _Cell objects
def __init__(self, grid=None):

Example

grid.cells = _Cells()
Parametersgridrequired Grid object
grid =
Grid object
_list =
Aggregated list of _Cell objects
(type: list)
def get(self):

Get accessor for _list of _Cell objects

for cell in grid.cells.get():
    print("y,x :", cell.y, cell.x)
Returnsself._list (type: list)
def add(self, cell=None):

Add (or aggregate) a _Cell object to the _list

grid.cells.add( _Cell(...) )
Parameterscellrequired _Cell object
def get_cell(self, y=-1, x=-1):

Return the _Cell object from coordinate (y,x)

cell = grid.cells.get_cell( 0,1 )
print("y,x :", cell.y, cell.x)

Raise exception if not found.

Parametersyint >= 0
xint >= 0
Returns_Cell object (type: object)
def get_last(self):

Return the last inserted _Cell object

cell = grid.cells.get_last()
Returns_Cell object (type: object)
def has_taken(self, y=-1, x=-1):

Check if a _Cell object exists at coordinate (y, x)

if grid.cells.has_taken( 0,1 ) : pass
Parametersyint
xint
Returnsbool (type: bool)
def get_current_max_y(self):

Get the maximum y-coordinate value out of all aggregated _Cell objects

max_y = grid.cells.get_current_max_y()
Returnsint max y (type: int)
def apply_to_layout(self):

Add all _Cell.item objects to the resulting QGridLayout

grid.cells.apply_to_layout()
API Documentation for gtgrid, generated by pydoctor 21.2.2 at 2021-06-12 11:12:41.