Module BrlAPIDevice :: Class BrlAPIDevice
[hide private]
[frames] | no frames]

Class BrlAPIDevice

source code

AccessEngine.AEDevice.AEOutput.AEOutput --+    
                                          |    
                            Braille.Braille --+
                                              |
               AccessEngine.AEInput.AEInput --+
                                              |
                                             BrlAPIDevice

Braille output via Brlapi interface.

Nested Classes [hide private]
  STYLE
Overrides the base Braille.BrailleStyle class.
Instance Methods [hide private]
 
init(self)
Initializes the braille interface.
source code
 
postInit(self)
Called after the init method and after either AccessEngine.AEDevice.AEOutput.Base.AEOutput.loadStyles or AccessEngine.AEDevice.AEOutput.Base.AEOutput.createDistinctStyles.
source code
brlapi.Connection
getBrlConnection(self)
Returns the connection object to brltty
source code
 
_loadKeyCmdConstants(self)
Reads brlapi constants and puts them in this class
source code
 
_readInput(self, arg1, arg2) source code
boolean
_onKeyClick(self, key)
Handles a key click event by acting on the hardware key code in key.
source code
integer
getMaxActions(self)
Gets the maximum number of actions that can be in a Gesture on this input device.
source code
string
asString(self, gesture)
Gets a human readable representation of the given Gesture.
source code
 
addKeyCmd(self, codes)
Registers each KEY_CMD within codes.
source code
 
removeKeyCmd(self, codes)
Unregisters each KEY_CMD within codes.
source code
 
close(self)
Closes the braille device.
source code
 
sendString(self, text, style)
Adds the given text and associated style to command list.
source code
 
sendTalk(self, style=None)
Iterates through list of commands and builds output string including user selected ellipsis and caret.
source code
 
sendTruncate(self, left, right, style)
Sends indicators of whether text was truncated on either side of the current line or not.
source code
 
sendCaret(self, pos, style)
Sends the current caret position relative to the first cell (zero-offset) on the device.
source code
tuple
sendGetEllipsisSizes(self, style)
Returns: tuple containing length of left and right ellipsis
source code
integer
sendGetMissingCellCount(self)
Returns: integer containing missing cell count
source code
boolean
isActive(self)
Indicates whether the device has text waiting to be output.
source code
 
sendStop(self, style=None)
Stops braille output immediately.
source code

Inherited from Braille.Braille: getCapabilities, getProxy, parseString, send, sendFilename

Class Variables [hide private]
  USE_THREAD = False
  ROLE = 'output'
  EllipsisStyles = [(chr(brlapi.DOT4+ brlapi.DOT5+ brlapi.DOT6)+...
Instance Variables [hide private]
object brlconn
connection object to brlapi
integer caretpos
The one-based cell position of the caret.
list commands
List of output commands
object inputmngr
Input listener thread reference
integer last_style
The last style object seen
object writestruct
write structure for brlapi.write()
Method Details [hide private]

init(self)

source code 
Initializes the braille interface.
Raises:
  • AEOutput.InitError - When the device can not be initialized

postInit(self)

source code 
Called after the init method and after either AccessEngine.AEDevice.AEOutput.Base.AEOutput.loadStyles or AccessEngine.AEDevice.AEOutput.Base.AEOutput.createDistinctStyles. missingcellcnt is the number of missing (broken) cells defined by the user and stored in the Setting string "CellMask".
Raises:
  • Error.InitError - When a communication or state problem exists for the specific device

getBrlConnection(self)

source code 
Returns the connection object to brltty
Returns: brlapi.Connection
A brlapi connection object

_onKeyClick(self, key)

source code 
Handles a key click event by acting on the hardware key code in key.
Parameters:
  • key (brlapi.key) - a brlapi structure representing a key click event
Returns: boolean
successfully notified listeners

getMaxActions(self)

source code 
Gets the maximum number of actions that can be in a Gesture on this input device.
Returns: integer
Maximum number of actions per Gesture supported by this device

asString(self, gesture)

source code 
Gets a human readable representation of the given Gesture.
Parameters:
Returns: string
Text representation of the Gesture

addKeyCmd(self, codes)

source code 
Registers each KEY_CMD within codes.
Parameters:
  • codes (list) - list of lists of KEY_CMD* codes
Raises:
  • NotImplementedError - When this method is not overridden by a subclass

removeKeyCmd(self, codes)

source code 
Unregisters each KEY_CMD within codes.
Parameters:
  • codes (list) - list of lists of KEY_CMD* codes
Raises:
  • NotImplementedError - When this method is not overridden by a subclass

sendString(self, text, style)

source code 
Adds the given text and associated style to command list. Text will be output to the braille device in sendTalk.
Parameters:
  • text (string) - String to be output
  • style (integer) - Style with which this string should be output; None means no style change should be applied
Overrides: Braille.Braille.sendString

sendTalk(self, style=None)

source code 
Iterates through list of commands and builds output string including user selected ellipsis and caret.
Parameters:
Overrides: Braille.Braille.sendTalk

sendTruncate(self, left, right, style)

source code 
Sends indicators of whether text was truncated on either side of the current line or not. The style object is used by the device in deciding how the truncation should be presented.
Parameters:
  • left (boolean) - Was text truncated to the left?
  • right (boolean) - Was text truncated to the right?
  • style (AccessEngine.AEOutput.AEOutput.Style) - Style with which the truncation should be indicated
Raises:
  • NotImplementedError - When not overridden in a subclass
Overrides: Braille.Braille.sendTruncate

sendCaret(self, pos, style)

source code 
Sends the current caret position relative to the first cell (zero-offset) on the device. The style object is used by the device in deciding how the caret should be presented.
Parameters:
  • pos (string) - Zero-offset cell position of the caret, up to the device to change to one-offset if need be
  • style (AccessEngine.AEOutput.AEOutput.Style) - Style with which the caret should be indicated
Raises:
  • NotImplementedError - When not overridden in a subclass
Overrides: Braille.Braille.sendCaret

Note: braille displays are one-based. We will offset here.

sendGetEllipsisSizes(self, style)

source code 
Parameters:
Returns: tuple
tuple containing length of left and right ellipsis
Raises:
  • NotImplementedError - When not overridden in a subclass
Overrides: Braille.Braille.sendGetEllipsisSizes

sendGetMissingCellCount(self)

source code 
Returns: integer
integer containing missing cell count
Raises:
  • NotImplementedError - When not overridden in a subclass
Overrides: Braille.Braille.sendGetMissingCellCount

isActive(self)

source code 
Indicates whether the device has text waiting to be output.
Returns: boolean
True if the braille device has text to be output, False otherwise

sendStop(self, style=None)

source code 
Stops braille output immediately.
Parameters:
Overrides: Braille.Braille.sendStop

Class Variable Details [hide private]

EllipsisStyles

Value:
[(chr(brlapi.DOT4+ brlapi.DOT5+ brlapi.DOT6)+ chr(brlapi.DOT1+ brlapi.\
DOT2+ brlapi.DOT3+ brlapi.DOT4+ brlapi.DOT6)+ chr(0), chr(0)+ chr(brla\
pi.DOT4+ brlapi.DOT5+ brlapi.DOT6)+ chr(brlapi.DOT1+ brlapi.DOT2+ brla\
pi.DOT3+ brlapi.DOT4+ brlapi.DOT6)), (''.center(3, chr(brlapi.DOT3))+ \
chr(0), chr(0)+ ''.center(3, chr(brlapi.DOT3)))]