class documentation

class _WriteHead:

View In Hierarchy

The _WriteHead keeps track of internal indices counting in 2 dimensions

  • Composed to Grid.wh property.
  • The _WriteHead property max_x value is determined at instantiation time.
  • When calling the gage method, the write head is skiped to the next free cell, which might be in the next row.
Method __init__ Example
Instance Variable grid Grid object
Instance Variable y int y coordinate, init 0
Instance Variable x int x coordinate, init 0
Instance Variable max_x Max x-index number including far left or right expansions
Instance Variable expand_left_index Index of left expander, -1 if unset
Instance Variable expand_right_index Index of right expander, -1 if unset
Instance Variable content_range 2-Tuple with left most and right most column indices wrapping the content
Method measures Determine the current values for expand_left_index, expand_right_index, content_range, and max_x
Method is_in_content_range Is a given index number within the content range ?
Method gage Skip to the next free cell and set the y and x properties
def __init__(self, grid=None):

Example

grid.wh = _WriteHead()
grid.wh.measures()
grid.wh.gage()
if grid.wh.is_in_content_range(2) : pass
Parametersgridrequired Grid object
grid =
Grid object
y =
int y coordinate, init 0
(type: int)
x =
int x coordinate, init 0
(type: int)
max_x =
Max x-index number including far left or right expansions
expand_left_index =
Index of left expander, -1 if unset
expand_right_index =
Index of right expander, -1 if unset
(type: int)
content_range =
2-Tuple with left most and right most column indices wrapping the content
def measures(self):
Determine the current values for expand_left_index, expand_right_index, content_range, and max_x
def is_in_content_range(self, i=None):
Is a given index number within the content range ?
Parametersirequired int index number
Returnsboolean (type: bool)
def gage(self):

Skip to the next free cell and set the y and x properties

Skip to next cell if the current cell is occupied, or is an expander, or gap, or part of a span.
This is called recursively and sets the y and x properties.
API Documentation for gtgrid, generated by pydoctor 21.2.2 at 2021-06-12 11:12:41.