Module braille :: Class Region
[hide private]
[frames] | no frames]

Class Region

source code

object --+
         |
        Region

A region of braille to be displayed. Each portion of braille to be displayed is represented by a region. The region is responsible for retrieving its text and cursor position, translating it into braille cells and handling cursor routing requests relative to its braille cells. The BrailleBuffer containing this region will call update and expect that brailleCells and brailleCursorPos will be set appropriately. routeTo will be called to handle a cursor routing request.

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
update(self)
Update this region.
source code
 
routeTo(self, braillePos)
Handle a cursor routing request.
source code
 
nextLine(self)
Move to the next line if possible.
source code
 
previousLine(self, start=False)
Move to the previous line if possible.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

update(self)

source code 

Update this region. Subclasses should extend this to update rawText and cursorPos if necessary. The base class method handles translation of rawText into braille, placing the result in brailleCells. Typeform information from rawTextTypeforms is used, if any. rawToBraillePos and brailleToRawPos are updated according to the translation. brailleCursorPos is similarly updated based on cursorPos.

Postcondition: brailleCells and brailleCursorPos are updated and ready for rendering.

routeTo(self, braillePos)

source code 

Handle a cursor routing request. For example, this might activate an object or move the cursor to the requested position.

Parameters:
  • braillePos (int) - The routing position in brailleCells.

Note: If routing the cursor, brailleToRawPos can be used to translate braillePos into a position in rawText.

previousLine(self, start=False)

source code 

Move to the previous line if possible.

Parameters:
  • start (bool) - True to move to the start of the line, False to move to the end.