1 '''
2 Defines the base class for all Braille output devices.
3
4 @author: Peter Parente
5 @organization: IBM Corporation
6 @copyright: Copyright (c) 2005, 2007 IBM Corporation
7 @license: The BSD License
8
9 All rights reserved. This program and the accompanying materials are made
10 available under the terms of the BSD license which accompanies
11 this distribution, and is available at
12 U{http://www.opensource.org/licenses/bsd-license.php}
13 '''
14 import Base, AEConstants
15
17 '''
18 Defines the base class for all Braille output devices. Provides default
19 implementation of L{parseString} specific to Braille devices.
20 '''
22 '''
23 @return: 'braille' as the only capability of this device.
24 @rtype: list of string
25 '''
26 return ['braille']
27
29 '''
30 Looks at the L{USE_THREAD} flag to see if the device implementing this
31 interface wants a thread proxy or not.
32
33 @return: self or L{ThreadProxy.BrailleThreadProxy}
34 @rtype: L{AEOutput}
35 '''
36 if self.USE_THREAD == True:
37 raise NotImplementedError
38 elif self.USE_THREAD == False:
39 return self
40 else:
41 raise NotImplementedError('USE_THREAD not specified')
42
44 '''
45 Dummy implementation returns the text as-is.
46
47 @param text: Text to be parsed
48 @type text: string
49 @param style: Style object defining how the text should be parsed
50 @type style: L{AEOutput.Style}
51 @param por: Point of regard for the first character in the text, or None if
52 the text is not associated with a POR
53 @type por: L{POR}
54 @param sem: Semantic tag for the text
55 @type sem: integer
56 @return: Parsed words
57 @rtype: 3-tuple of lists of string, L{POR}, L{AEOutput.Style}
58 '''
59 return [(text, por, style)]
60
61 - def send(self, name, value, style=None):
93
94
96 '''
97 Sends the current caret position relative to the first cell (zero-offset)
98 on the device. The style object is used by the device in deciding how the
99 caret should be presented.
100
101 @param pos: Zero-offset cell position of the caret, up to the device to
102 change to one-offset if need be
103 @type pos: string
104 @param style: Style with which the caret should be indicated
105 @type style: L{AEOutput.Style}
106 @raise NotImplementedError: When not overridden in a subclass
107 '''
108 raise NotImplementedError
109
111 '''
112 Sends indicators of whether text was truncated on either side of the
113 current line or not. The style object is used by the device in deciding how
114 the truncation should be presented.
115
116 @param left: Was text truncated to the left?
117 @type left: boolean
118 @param right: Was text truncated to the right?
119 @type right: boolean
120 @param style: Style with which the truncation should be indicated
121 @type style: L{AEOutput.Style}
122 @raise NotImplementedError: When not overridden in a subclass
123 '''
124 raise NotImplementedError
125
127 '''
128 @param style: Style with which the ellipsis are defined
129 @type style: L{AEOutput.Style}
130 @return: tuple containing length of left and right ellipsis
131 @rtype: tuple
132 @raise NotImplementedError: When not overridden in a subclass
133 '''
134 raise NotImplementedError
135
137 '''
138 @param style: Style with which the ellipsis are defined
139 @type style: L{AEOutput.Style}
140 @return: tuple containing length of left and right ellipsis
141 @rtype: tuple
142 @raise NotImplementedError: When not overridden in a subclass
143 '''
144 raise NotImplementedError
145
147 '''
148 @param style: Style with which the ellipsis are defined
149 @type style: L{AEOutput.Style}
150 @return: tuple containing length of left and right ellipsis
151 @rtype: tuple
152 @raise NotImplementedError: When not overridden in a subclass
153 '''
154 raise NotImplementedError
155
157 '''
158 @return: integer containing missing cell count
159 @rtype: integer
160 @raise NotImplementedError: When not overridden in a subclass
161 '''
162 raise NotImplementedError
163
165 '''
166 Sends a string of one or more characters to the device. The style object
167 is used by the device in deciding how the given text should be presented.
168
169 @param text: Text to send to the device
170 @type text: string
171 @param style: Style with which this text should be output
172 @type style: L{AEOutput.Style}
173 @raise NotImplementedError: When not overridden in a subclass
174 '''
175 raise NotImplementedError
176
178 '''
179 Sends a string filename to the device, the contents of which should be
180 output. The style object is used by the device in decided how the given
181 text should be presented.
182
183 Typically, this method should be implemented by an audio device that
184 supports playback of waveform or sequencer files. It might also be used
185 by devices as a way of synthesizing the entire contents of a file without
186 having to pass all of the contents through the rest of the system.
187
188 @param fn: Absolute filename
189 @type fn: string
190 @param style: Style with which this text should be output
191 @type style: L{AEOutput.Style}
192 @raise NotImplementedError: When not overridden in a subclass
193 '''
194 raise NotImplementedError
195
197 '''
198 Purges buffered text and styles, and interrupts on-going output.
199
200 @param style: Style indicating which channel on which the stop should be
201 performed; None indicates stop on all channels
202 @type style: L{AEOutput.Style}
203 @raise NotImplementedError: When not overridden in a subclass
204 '''
205 raise NotImplementedError
206
208 '''
209 Indicates all text buffered by L{sendString} should now be output.
210 For devices that do the buffering in the driver, this action may mean
211 simply sending the command. For devices that do not buffer, this action
212 means sending text and styles buffered in the LSR device definition.
213
214 @param style: Style indicating which channel on which the talk should be
215 performed; None indicates talk on all channels
216 @type style: L{AEOutput.Style}
217 @raise NotImplementedError: When not overridden in a subclass
218 '''
219 raise NotImplementedError
220