1 |
|
# Orca |
2 |
|
# |
3 |
|
# Copyright 2004-2007 Sun Microsystems Inc. |
4 |
|
# |
5 |
|
# This library is free software; you can redistribute it and/or |
6 |
|
# modify it under the terms of the GNU Library General Public |
7 |
|
# License as published by the Free Software Foundation; either |
8 |
|
# version 2 of the License, or (at your option) any later version. |
9 |
|
# |
10 |
|
# This library is distributed in the hope that it will be useful, |
11 |
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 |
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 |
|
# Library General Public License for more details. |
14 |
|
# |
15 |
|
# You should have received a copy of the GNU Library General Public |
16 |
|
# License along with this library; if not, write to the |
17 |
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 |
|
# Boston, MA 02111-1307, USA. |
19 |
|
|
20 |
|
"""Manages the settings for Orca. This will defer to user settings first, but |
21 |
|
fallback to local settings if the user settings doesn't exist (e.g., in the |
22 |
1 |
case of gdm) or doesn't have the specified attribute.""" |
23 |
|
|
24 |
1 |
__id__ = "$Id: settings.py 2582 2007-08-01 15:31:33Z richb $" |
25 |
1 |
__version__ = "$Revision: 2582 $" |
26 |
1 |
__date__ = "$Date: 2007-08-01 11:31:33 -0400 (Wed, 01 Aug 2007) $" |
27 |
1 |
__copyright__ = "Copyright (c) 2005-2007 Sun Microsystems Inc." |
28 |
1 |
__license__ = "LGPL" |
29 |
|
|
30 |
1 |
import os |
31 |
1 |
import re |
32 |
|
|
33 |
1 |
screenWidth = 640 |
34 |
1 |
screenHeight = 480 |
35 |
1 |
tty = 7 |
36 |
|
|
37 |
|
# Whether tool tips can be presented. |
38 |
|
# |
39 |
1 |
canPresentToolTips = False |
40 |
|
|
41 |
1 |
try: |
42 |
|
# This can fail due to gtk not being available. We want to |
43 |
|
# be able to recover from that if possible. The main driver |
44 |
|
# for this is to allow "orca --text-setup" to work even if |
45 |
|
# the desktop is not running. |
46 |
|
# |
47 |
1 |
import gtk.gdk |
48 |
1 |
_display = gtk.gdk.display_get_default() |
49 |
1 |
_screen = _display.get_default_screen() |
50 |
1 |
_root_window = _screen.get_root_window() |
51 |
|
|
52 |
|
# These are used for placing the magnifier zoomer. |
53 |
|
# |
54 |
1 |
screenWidth = _screen.get_width() |
55 |
1 |
screenHeight = _screen.get_height() |
56 |
|
|
57 |
|
# We want to know what the tty is so we can send it to BrlAPI |
58 |
|
# if possible. |
59 |
|
# |
60 |
1 |
(atom, format, data) = _root_window.property_get("XFree86_VT") |
61 |
1 |
tty = data[0] |
62 |
|
|
63 |
|
# The bug that caused gnome-panel to crash is fixed in GTK 2.10.11. |
64 |
|
minimum_gtk_version = (100000 * 2) + \ |
65 |
1 |
(1000 * 10) + \ |
66 |
1 |
11 |
67 |
|
current_gtk_version = (100000 * gtk.gtk_version[0]) + \ |
68 |
1 |
(1000 * gtk.gtk_version[1]) + \ |
69 |
1 |
gtk.gtk_version[2] |
70 |
1 |
canPresentToolTips = (current_gtk_version >= minimum_gtk_version) |
71 |
0 |
except: |
72 |
0 |
pass |
73 |
|
|
74 |
1 |
try: |
75 |
1 |
import gconf |
76 |
1 |
gconfClient = gconf.client_get_default() |
77 |
0 |
except: |
78 |
0 |
gconfClient = None |
79 |
|
|
80 |
1 |
import debug |
81 |
1 |
from acss import ACSS |
82 |
1 |
from orca_i18n import _ # for gettext support |
83 |
|
|
84 |
|
# These are the settings that Orca supports the user customizing. |
85 |
|
# |
86 |
|
userCustomizableSettings = [ |
87 |
1 |
"orcaModifierKeys", |
88 |
1 |
"enableSpeech", |
89 |
1 |
"speechServerFactory", |
90 |
1 |
"speechServerInfo", |
91 |
1 |
"voices", |
92 |
1 |
"speechVerbosityLevel", |
93 |
1 |
"readTableCellRow", |
94 |
1 |
"enableSpeechIndentation", |
95 |
1 |
"enableEchoByWord", |
96 |
1 |
"enableKeyEcho", |
97 |
1 |
"enablePrintableKeys", |
98 |
1 |
"enableModifierKeys", |
99 |
1 |
"enableLockingKeys", |
100 |
1 |
"enableFunctionKeys", |
101 |
1 |
"enableActionKeys", |
102 |
1 |
"enableBraille", |
103 |
1 |
"enableBrailleGrouping", |
104 |
1 |
"brailleVerbosityLevel", |
105 |
1 |
"brailleRolenameStyle", |
106 |
1 |
"brailleSelectorIndicator", |
107 |
1 |
"enableBrailleMonitor", |
108 |
1 |
"enableMagnifier", |
109 |
1 |
"enableMagCursor", |
110 |
1 |
"enableMagCursorExplicitSize", |
111 |
1 |
"magCursorSize", |
112 |
1 |
"magCursorColor", |
113 |
1 |
"enableMagCrossHair", |
114 |
1 |
"enableMagCrossHairClip", |
115 |
1 |
"magCrossHairSize", |
116 |
1 |
"magZoomerLeft", |
117 |
1 |
"magZoomerRight", |
118 |
1 |
"magZoomerTop", |
119 |
1 |
"magZoomerBottom", |
120 |
1 |
"magZoomFactor", |
121 |
1 |
"enableMagZoomerColorInversion", |
122 |
1 |
"magSmoothingMode", |
123 |
1 |
"magMouseTrackingMode", |
124 |
1 |
"magSourceDisplay", |
125 |
1 |
"magTargetDisplay", |
126 |
1 |
"verbalizePunctuationStyle", |
127 |
1 |
"showMainWindow", |
128 |
1 |
"quitOrcaNoConfirmation", |
129 |
1 |
"presentToolTips", |
130 |
1 |
"sayAllStyle", |
131 |
1 |
"keyboardLayout", |
132 |
1 |
"speakBlankLines", |
133 |
1 |
"enabledSpokenTextAttributes", |
134 |
1 |
"enabledBrailledTextAttributes", |
135 |
1 |
"textAttributesBrailleIndicator", |
136 |
1 |
"enableProgressBarUpdates", |
137 |
1 |
"progressBarUpdateInterval" |
138 |
|
] |
139 |
|
|
140 |
|
# The name of the module that hold the user interface for the main window |
141 |
|
# for Orca. This module is expected to have two methods, showMainUI and |
142 |
|
# hideMainUI, which will show and hide the main window GUI. |
143 |
|
# |
144 |
1 |
mainWindowModule = "orca_gui_main" |
145 |
|
|
146 |
|
# The name of the modules that hold the user interface for setting |
147 |
|
# Orca preferences. Each module is expected to have the method, |
148 |
|
# showPreferencesUI, which will prompt the user for preferences. |
149 |
|
# |
150 |
1 |
guiPreferencesModule = "orca_gui_prefs" |
151 |
1 |
consolePreferencesModule= "orca_console_prefs" |
152 |
1 |
appGuiPreferencesModule = "app_gui_prefs" |
153 |
|
|
154 |
|
# The name of the module that hold the user interface for quitting Orca. |
155 |
|
# This module is expected to have the method, showQuitUI, which will |
156 |
|
# display the quit GUI. |
157 |
|
# |
158 |
1 |
quitModule = "orca_quit" |
159 |
|
|
160 |
|
# The name of the module that holds the user interface for performing a |
161 |
|
# flat review find. |
162 |
|
# |
163 |
1 |
findModule = "orca_gui_find" |
164 |
|
|
165 |
|
# A list of keys that can serve as the Orca modifier key. The list is |
166 |
|
# so we can provide better cross platform support (e.g., Sun keyboard |
167 |
|
# vs. PC-104 keyboard layouts). When any of these keys is pressed, |
168 |
|
# the orca.MODIFIER_ORCA bit will be set in the 'modifiers' field of |
169 |
|
# a KeyboardEvent input event. The keys are currently compared to the |
170 |
|
# event_string of a keyboard input event from AT-SPI. |
171 |
|
# |
172 |
|
# The initial set of modifier keys is dependant upon whether the user |
173 |
|
# has specified a desktop or a laptop keyboard layout. |
174 |
|
# |
175 |
1 |
DESKTOP_MODIFIER_KEYS = ["Insert", "KP_Insert"] |
176 |
1 |
LAPTOP_MODIFIER_KEYS = ["Caps_Lock"] |
177 |
1 |
orcaModifierKeys = DESKTOP_MODIFIER_KEYS |
178 |
|
|
179 |
|
# A new modifier to use (set by the press of any key in the |
180 |
|
# orcaModifierKeys list) to represent the Orca modifier. |
181 |
|
# |
182 |
1 |
MODIFIER_ORCA = 8 |
183 |
|
|
184 |
|
# Verbosity levels (see setBrailleVerbosityLevel and |
185 |
|
# setSpeechVerbosityLevel). These will have an impact on the various |
186 |
|
# individual verbosity levels for rolenames, accelerators, etc. |
187 |
|
# |
188 |
1 |
VERBOSITY_LEVEL_BRIEF = 0 |
189 |
1 |
VERBOSITY_LEVEL_VERBOSE = 1 |
190 |
1 |
speechVerbosityLevel = VERBOSITY_LEVEL_VERBOSE |
191 |
1 |
brailleVerbosityLevel = VERBOSITY_LEVEL_VERBOSE |
192 |
|
|
193 |
1 |
BRAILLE_ROLENAME_STYLE_SHORT = 0 # three letter abbreviations |
194 |
1 |
BRAILLE_ROLENAME_STYLE_LONG = 1 # full rolename |
195 |
1 |
brailleRolenameStyle = BRAILLE_ROLENAME_STYLE_LONG |
196 |
|
|
197 |
|
# Braille Selection Indicator (see brailleSelectorIndicator). |
198 |
|
# The values represent the character to be used in the attrOr |
199 |
|
# field of brlAPI's writeStruct. |
200 |
|
# |
201 |
1 |
BRAILLE_SEL_NONE = '\x00' # 00000000 |
202 |
1 |
BRAILLE_SEL_7 = '\x40' # 01000000 |
203 |
1 |
BRAILLE_SEL_8 = '\x80' # 10000000 |
204 |
1 |
BRAILLE_SEL_BOTH = '\xc0' # 11000000 |
205 |
1 |
brailleSelectorIndicator = BRAILLE_SEL_BOTH |
206 |
|
|
207 |
|
# Speech punctuation levels (see verbalizePunctuationStyle). |
208 |
|
# |
209 |
1 |
PUNCTUATION_STYLE_NONE = 3 |
210 |
1 |
PUNCTUATION_STYLE_SOME = 2 |
211 |
1 |
PUNCTUATION_STYLE_MOST = 1 |
212 |
1 |
PUNCTUATION_STYLE_ALL = 0 |
213 |
1 |
verbalizePunctuationStyle = PUNCTUATION_STYLE_MOST |
214 |
|
|
215 |
|
# Say All styles (see sayAllStyle). |
216 |
|
# |
217 |
1 |
SAYALL_STYLE_LINE = 0 |
218 |
1 |
SAYALL_STYLE_SENTENCE = 1 |
219 |
1 |
sayAllStyle = SAYALL_STYLE_SENTENCE |
220 |
|
|
221 |
|
# The absolue amount to change the speech rate when |
222 |
|
# increasing or decreasing speech. This is a numerical |
223 |
|
# value that represents an ACSS rate value. |
224 |
|
# |
225 |
1 |
speechRateDelta = 5 |
226 |
|
|
227 |
|
# The absolue amount to change the speech pitch when |
228 |
|
# increasing or decreasing pitch. This is a numerical |
229 |
|
# value that represents an ACSS pitch value. |
230 |
|
# |
231 |
1 |
speechPitchDelta = 0.5 |
232 |
|
|
233 |
|
# The port to listen on if orca is to act as an HTTP server |
234 |
|
# (mainly as a speech server for self-voicing applications). |
235 |
|
# |
236 |
1 |
httpServerPort = 20433 |
237 |
|
|
238 |
|
# The number of attempts to retry setting up an HTTP server |
239 |
|
# connection (each time incrementing the port number by 1). |
240 |
|
# |
241 |
1 |
maxHttpServerRetries = 20 |
242 |
|
|
243 |
|
# If True, enable speech. |
244 |
|
# |
245 |
1 |
enableSpeech = True |
246 |
1 |
enableSpeechCallbacks = True |
247 |
|
|
248 |
|
# If True, speech has been temporarily silenced. |
249 |
|
# |
250 |
1 |
silenceSpeech = False |
251 |
|
|
252 |
|
# Settings that apply to the particular speech engine to |
253 |
|
# use as well details on the default voices to use. |
254 |
|
# |
255 |
1 |
speechFactoryModules = ["espeechfactory","gnomespeechfactory","speechdispatcherfactory"] |
256 |
1 |
speechServerFactory = "gnomespeechfactory" |
257 |
1 |
speechServerInfo = None # None means let the factory decide. |
258 |
|
|
259 |
1 |
DEFAULT_VOICE = "default" |
260 |
1 |
UPPERCASE_VOICE = "uppercase" |
261 |
1 |
HYPERLINK_VOICE = "hyperlink" |
262 |
|
|
263 |
1 |
voices = { |
264 |
1 |
DEFAULT_VOICE : ACSS({}), |
265 |
1 |
UPPERCASE_VOICE : ACSS({ACSS.AVERAGE_PITCH : 5.6}), |
266 |
1 |
HYPERLINK_VOICE : ACSS({}) |
267 |
|
} |
268 |
|
|
269 |
|
# If True, enable speaking of speech indentation and justification. |
270 |
|
# |
271 |
1 |
enableSpeechIndentation = False |
272 |
|
|
273 |
|
# If True, enable braille. |
274 |
|
# |
275 |
1 |
enableBraille = True |
276 |
|
|
277 |
|
# If True, enable the grouping of children on the braille display. |
278 |
|
# This is for things like displaying all items of a menu, tab list, |
279 |
|
# menu bar, etc., on a single line of the braille display. |
280 |
|
# |
281 |
1 |
enableBrailleGrouping = False |
282 |
|
|
283 |
|
# If True, enable braille monitor. |
284 |
|
# |
285 |
1 |
enableBrailleMonitor = False |
286 |
|
|
287 |
|
# Strings used to indicate checkbox/radio button states in braille: |
288 |
|
# |
289 |
1 |
brailleCheckBoxIndicators = ["< >", "<x>"] |
290 |
1 |
brailleRadioButtonIndicators = ["& y", "&=y"] |
291 |
|
|
292 |
|
# If True, enable magnification. |
293 |
|
# |
294 |
1 |
enableMagnifier = False |
295 |
|
|
296 |
|
# If True, show the magnification cursor. |
297 |
|
# |
298 |
1 |
enableMagCursor = True |
299 |
|
|
300 |
|
# If True, allow an explicit size for the magnification cursor. |
301 |
|
# |
302 |
1 |
enableMagCursorExplicitSize = False |
303 |
|
|
304 |
|
# Size of the magnification cursor (in pixels). |
305 |
|
# |
306 |
1 |
magCursorSize = 32 |
307 |
|
|
308 |
|
# Magnification cursor color value (hex color spec). |
309 |
|
# |
310 |
1 |
magCursorColor = '#000000' |
311 |
|
|
312 |
|
# If True, show the magnification cross-hairs. |
313 |
|
# |
314 |
1 |
enableMagCrossHair = True |
315 |
|
|
316 |
|
# If True, enable magnification cross-hair clipping. |
317 |
|
# |
318 |
1 |
enableMagCrossHairClip = False |
319 |
|
|
320 |
|
# Size of the magnification cross-hairs (in pixels). |
321 |
|
# |
322 |
1 |
magCrossHairSize = 16 |
323 |
|
|
324 |
|
# Magnification zoomer region placement. |
325 |
|
# |
326 |
1 |
magZoomerLeft = screenWidth / 2 |
327 |
1 |
magZoomerRight = screenWidth |
328 |
1 |
magZoomerTop = 0 |
329 |
1 |
magZoomerBottom = screenHeight |
330 |
|
|
331 |
|
# Magnification zoom factor. |
332 |
|
# |
333 |
1 |
magZoomFactor = 4.0 |
334 |
|
|
335 |
|
# If True, invert the magnification zoomer colors. |
336 |
|
# |
337 |
1 |
enableMagZoomerColorInversion = False |
338 |
|
|
339 |
|
# Magnification smoothing mode (see magSmoothingMode). |
340 |
|
# |
341 |
1 |
MAG_SMOOTHING_MODE_BILINEAR = 0 |
342 |
1 |
MAG_SMOOTHING_MODE_NONE = 1 |
343 |
1 |
magSmoothingMode = MAG_SMOOTHING_MODE_BILINEAR |
344 |
|
|
345 |
|
# Magnification mouse tracking mode (see magMouseTrackingMode). |
346 |
|
# |
347 |
1 |
MAG_MOUSE_TRACKING_MODE_CENTERED = 0 |
348 |
1 |
MAG_MOUSE_TRACKING_MODE_NONE = 1 |
349 |
1 |
MAG_MOUSE_TRACKING_MODE_PROPORTIONAL = 2 |
350 |
1 |
MAG_MOUSE_TRACKING_MODE_PUSH = 3 |
351 |
1 |
magMouseTrackingMode = MAG_MOUSE_TRACKING_MODE_CENTERED |
352 |
|
|
353 |
|
# Magnification source display |
354 |
|
# |
355 |
1 |
magSourceDisplay = '' |
356 |
|
|
357 |
|
# Magnification target display |
358 |
|
# |
359 |
1 |
magTargetDisplay = '' |
360 |
|
|
361 |
|
# if True, enable word echo. |
362 |
|
# Note that it is allowable for both enableEchoByWord and enableKeyEcho |
363 |
|
# to be True |
364 |
|
# |
365 |
1 |
enableEchoByWord = False |
366 |
|
|
367 |
|
# If True, enable key echo. |
368 |
|
# Note that it is allowable for both enableEchoByWord and enableKeyEcho |
369 |
|
# to be True |
370 |
|
# |
371 |
1 |
enableKeyEcho = True |
372 |
|
|
373 |
|
# If True and key echo is enabled, echo Alphanumeric and punctuation keys. |
374 |
|
# |
375 |
1 |
enablePrintableKeys = True |
376 |
|
|
377 |
|
# If True and key echo is enabled, echo Modifier keys. |
378 |
|
# |
379 |
1 |
enableModifierKeys = True |
380 |
|
|
381 |
|
# If True and key echo is enabled, echo Locking keys. |
382 |
|
# |
383 |
1 |
enableLockingKeys = True |
384 |
|
|
385 |
|
# If True and key echo is enabled, echo Function keys. |
386 |
|
# |
387 |
1 |
enableFunctionKeys = True |
388 |
|
|
389 |
|
# If True and key echo is enabled, echo Action keys. |
390 |
|
# |
391 |
1 |
enableActionKeys = True |
392 |
|
|
393 |
|
# If True, show the main Orca window. |
394 |
|
# |
395 |
1 |
showMainWindow = True |
396 |
|
|
397 |
|
# If True, quit Orca without confirmation when the user presses |
398 |
|
# <Orca-modifier>-q. |
399 |
|
# |
400 |
1 |
quitOrcaNoConfirmation = False |
401 |
|
|
402 |
|
# Whether the user wants tooltips presented or not. |
403 |
|
# |
404 |
1 |
presentToolTips = False and canPresentToolTips |
405 |
|
|
406 |
|
# Keyboard layout options (see keyboardLayout). |
407 |
|
# |
408 |
1 |
GENERAL_KEYBOARD_LAYOUT_DESKTOP = 1 |
409 |
1 |
GENERAL_KEYBOARD_LAYOUT_LAPTOP = 2 |
410 |
1 |
keyboardLayout = GENERAL_KEYBOARD_LAYOUT_DESKTOP |
411 |
|
|
412 |
|
# If True, speak blank lines. |
413 |
|
# |
414 |
1 |
speakBlankLines = True |
415 |
|
|
416 |
|
# If True, reads all the table cells in the current row rather than just |
417 |
|
# the current one. |
418 |
|
# |
419 |
1 |
readTableCellRow = True |
420 |
|
|
421 |
|
# If True, enable speaking of progress bar updates. |
422 |
|
# |
423 |
1 |
enableProgressBarUpdates = False |
424 |
|
|
425 |
|
# The interval (in seconds) between speaking progress bar updates. A value |
426 |
|
# of zero means that progress bar updates should not be spoken at all. |
427 |
|
# |
428 |
1 |
progressBarUpdateInterval = 10 |
429 |
|
|
430 |
|
# The complete list of possible text attributes. |
431 |
|
# |
432 |
1 |
allTextAttributes = "bg-color:; bg-full-height:; bg-stipple:; direction:; editable:; family-name:; fg-color:; fg-stipple:; font-effect:none; indent:0; invisible:; justification:left; language:; left-margin:; line-height:100%; paragraph-style:Default; pixels-above-lines:; pixels-below-lines:; pixels-inside-wrap:; right-margin:; rise:; scale:; size:; stretch:; strikethrough:false; style:normal; text-decoration:none; text-rotation:0; text-shadow:none; underline:none; variant:; vertical-align:baseline; weight:400; wrap-mode:; writing-mode:lr-tb;" |
433 |
|
|
434 |
|
# The default set of text attributes to speak to the user. Specific |
435 |
|
# application scripts (or individual users can override these values if |
436 |
|
# so desired. Each of these text attributes is of the form <key>:<value>; |
437 |
|
# The <value> part will be the "default" value for that attribute. In |
438 |
|
# other words, if the attribute for a given piece of text has that value, |
439 |
|
# it won't be spoken. If no value part is given, then that attribute will |
440 |
|
# always be spoken. |
441 |
|
|
442 |
1 |
enabledSpokenTextAttributes = "size:; family-name:; weight:400; indent:0; underline:none; strikethrough:false; justification:left; style:normal;" |
443 |
|
|
444 |
|
# The default set of text attributes to be brailled for the user. Specific |
445 |
|
# application scripts (or individual users can override these values if |
446 |
|
# so desired. Each of these text attributes is of the form <key>:<value>; |
447 |
|
# The <value> part will be the "default" value for that attribute. In |
448 |
|
# other words, if the attribute for a given piece of text has that value, |
449 |
|
# it won't be spoken. If no value part is given, then that attribute will |
450 |
|
# always be brailled. |
451 |
|
|
452 |
1 |
enabledBrailledTextAttributes = "size:; family-name:; weight:400; indent:0; underline:none; strikethrough:false; justification:left; style:normal;" |
453 |
|
|
454 |
|
# Text Attributes Braille Indicator (see textAttributesBrailleIndicator). |
455 |
|
# The values represent the character to be used in the attrOr |
456 |
|
# field of brlAPI's writeStruct. |
457 |
|
# |
458 |
1 |
TEXT_ATTR_BRAILLE_NONE = '\x00' # 00000000 |
459 |
1 |
TEXT_ATTR_BRAILLE_7 = '\x40' # 01000000 |
460 |
1 |
TEXT_ATTR_BRAILLE_8 = '\x80' # 10000000 |
461 |
1 |
TEXT_ATTR_BRAILLE_BOTH = '\xc0' # 11000000 |
462 |
1 |
textAttributesBrailleIndicator = TEXT_ATTR_BRAILLE_NONE |
463 |
|
|
464 |
|
# The limit to enable a repeat character count to be spoken. |
465 |
|
# If set to 0, then there will be no repeat character count. |
466 |
|
# Each character will be spoken singularly (i.e. "dash dash |
467 |
|
# dash dash dash" instead of "five dash characters"). |
468 |
|
# If the value is set to 1, 2 or 3 then it's treated as if it was |
469 |
|
# zero. In other words, no repeat character count is given. |
470 |
|
# |
471 |
1 |
repeatCharacterLimit = 4 |
472 |
|
|
473 |
|
# Script developer feature. If False, just the default script |
474 |
|
# will be used. Helps determine difference between custom |
475 |
|
# scripts and the default script behavior. |
476 |
|
# |
477 |
1 |
enableCustomScripts = True |
478 |
|
|
479 |
|
# Latent support to allow the user to override/define keybindings |
480 |
|
# and braille bindings. Unsupported and undocumented for now. |
481 |
|
# Use at your own risk. |
482 |
|
# |
483 |
1 |
keyBindingsMap = {} |
484 |
1 |
brailleBindingsMap = {} |
485 |
|
|
486 |
|
# Script developer feature. If False, no AT-SPI object values |
487 |
|
# will be cached locally. Helps determine if there might be a |
488 |
|
# problem related to the cache being out of sync with the real |
489 |
|
# objects. |
490 |
|
# |
491 |
1 |
cacheValues = True |
492 |
1 |
cacheDescriptions = True |
493 |
|
|
494 |
|
# Script developer feature. If False, no AT-SPI objects |
495 |
|
# will be cached locally. Helps determine if there might be a |
496 |
|
# problem related to the cache being out of sync with the real |
497 |
|
# objects. |
498 |
|
# |
499 |
1 |
cacheAccessibles = True |
500 |
|
|
501 |
|
# Assists with learn mode (what you enter when you press Insert+F1 |
502 |
|
# and exit when you press escape. |
503 |
|
# |
504 |
1 |
learnModeEnabled = False |
505 |
|
|
506 |
|
# The location of the user's preferences. By default this is ~/.orca. |
507 |
|
# It can be overridden by the Orca -d command line option. |
508 |
|
# |
509 |
1 |
userPrefsDir = os.path.join(os.environ["HOME"], ".orca") |
510 |
|
|
511 |
|
# If non-zero, we use time.sleep() in various places to attempt to |
512 |
|
# free up the global interpreter lock. Take a look at the following |
513 |
|
# URLs for more information: |
514 |
|
# |
515 |
|
# http://mail.python.org/pipermail/python-list/2002-October/126632.html |
516 |
|
# http://twistedmatrix.com/pipermail/twisted-python/2005-July/011052.html |
517 |
|
# http://www.pyzine.com/Issue001/Section_Articles/article_ThreadingGlobalInterpreter.html |
518 |
|
# |
519 |
1 |
gilSleepTime = 0.00001 |
520 |
|
|
521 |
|
# If True, use the gidle __blockPreventor() code in atspi.py. |
522 |
|
# |
523 |
1 |
useBlockPreventor = False |
524 |
|
|
525 |
|
# If True, we use the bonobo main loop provided by bonobo to handle |
526 |
|
# all events in atspi.py. If False, we create our own loop. |
527 |
|
# |
528 |
1 |
useBonoboMain = True |
529 |
|
|
530 |
|
# If True, we handle events asynchronously - our normal mode of |
531 |
|
# queueing events and processing them later on the gidle thread. |
532 |
|
# If False, we handle events immediately - helpful for testing. |
533 |
|
# |
534 |
1 |
asyncMode = True |
535 |
|
|
536 |
|
# If True, we output debug information for the event queue. We |
537 |
|
# use this in addition to log level to prevent debug logic from |
538 |
|
# bogging down event handling. |
539 |
|
# |
540 |
1 |
debugEventQueue = False |
541 |
|
|
542 |
|
# If True, we collect information regarding memory usage and provide |
543 |
|
# keystrokes to dump the usage information to the console: |
544 |
|
# Orca+Ctrl+F8 for brief, Orca+Shift+Ctrl+F8 for detailed. |
545 |
|
# |
546 |
1 |
debugMemoryUsage = False |
547 |
|
|
548 |
|
# The timeout value (in seconds) and callback used to determine if |
549 |
|
# Orca has hung or not. The only setting one should muck with here is |
550 |
|
# the timeoutTime unless you want to create a custom callback handler |
551 |
|
# for the timeout. See braille.py, atspi.py, and orca.py:init for how |
552 |
|
# these are used. |
553 |
|
# |
554 |
1 |
timeoutTime = 10 # a value of 0 means don't do hang checking |
555 |
1 |
timeoutCallback = None # Set by orca.py:init to orca.timeout |
556 |
|
|
557 |
|
# Keyboard double-click period. If the same key is pressed within |
558 |
|
# this time period, it's considered to be a double-click and might |
559 |
|
# provide different functionality (for example, Numpad 5 double-click |
560 |
|
# spells the current word rather than speaks it). |
561 |
|
# |
562 |
1 |
doubleClickTimeout = 0.5 |
563 |
|
|
564 |
|
# Obtain/set information regarding whether accessibility is enabled |
565 |
|
# or not. |
566 |
|
# |
567 |
1 |
def isAccessibilityEnabled(): |
568 |
1 |
try: |
569 |
1 |
return gconfClient.get_bool("/desktop/gnome/interface/accessibility") |
570 |
0 |
except: |
571 |
0 |
return False |
572 |
|
|
573 |
1 |
def setAccessibilityEnabled(enable): |
574 |
0 |
try: |
575 |
0 |
return gconfClient.set_bool("/desktop/gnome/interface/accessibility", |
576 |
0 |
enable) |
577 |
0 |
except: |
578 |
0 |
return False |
579 |
|
|
580 |
|
# Obtain/set information regarding whether the gksu keyboard grab is enabled |
581 |
|
# or not. |
582 |
|
# |
583 |
1 |
def isGKSUGrabDisabled(): |
584 |
0 |
try: |
585 |
0 |
return gconfClient.get_bool("/apps/gksu/disable-grab") |
586 |
0 |
except: |
587 |
0 |
return False |
588 |
|
|
589 |
1 |
def setGKSUGrabDisabled(disable): |
590 |
0 |
try: |
591 |
0 |
return gconfClient.set_bool("/apps/gksu/disable-grab", |
592 |
0 |
disable) |
593 |
0 |
except: |
594 |
0 |
return False |
595 |
|
|
596 |
|
# Allow for the customization of key bindings. |
597 |
|
# |
598 |
1 |
def overrideKeyBindings(script, keyBindings): |
599 |
79 |
return keyBindings |
600 |
|
|
601 |
|
# Allow for user customization of pronunciations. |
602 |
|
# |
603 |
1 |
def overridePronunciations(script, pronunciations): |
604 |
0 |
return pronunciations |
605 |
|
|
606 |
|
# Which packages to search, and the order in which to search, |
607 |
|
# for application settings. These packages are expected to be on |
608 |
|
# the PYTHONPATH and/or subpackages of the "orca" package. |
609 |
|
# REMEMBER: to make something a package, the directory has to |
610 |
|
# have a __init__.py file in it. |
611 |
|
# |
612 |
1 |
settingsPackages = ["app-settings"] |
613 |
|
|
614 |
|
# Which packages to search, and the order in which to search, |
615 |
|
# for custom scripts. These packages are expected to be on |
616 |
|
# the PYTHONPATH and/or subpackages of the "orca" package. |
617 |
|
# REMEMBER: to make something a package, the directory has to |
618 |
|
# have a __init__.py file in it. |
619 |
|
# |
620 |
1 |
scriptPackages = ["orca-scripts", "scripts"] |
621 |
|
|
622 |
|
# A list that helps us map application names to script module |
623 |
|
# names. The key is the name of an application, and the value is |
624 |
|
# the name of a script module. There are some default values here, |
625 |
|
# but one may call the setScriptMapping method of this module to |
626 |
|
# extend or override any mappings. |
627 |
|
# |
628 |
1 |
_scriptMappings = [] |
629 |
|
|
630 |
1 |
def setScriptMapping(regExpression, moduleName): |
631 |
|
"""Tells this module what script module to look for a given |
632 |
|
application name. The mappings are stored as a list and each |
633 |
|
new mapping is added to the beginning of the list, meaning it |
634 |
|
takes precedence over all other mappings. |
635 |
|
|
636 |
|
Arguments: |
637 |
|
- regExpression: a regular expression used to match against an |
638 |
|
application name |
639 |
|
- moduleName: the name of the Python module containing the script |
640 |
|
class definition for the application |
641 |
|
""" |
642 |
|
|
643 |
12 |
_scriptMappings.insert(0, [regExpression, moduleName]) |
644 |
|
|
645 |
1 |
def getScriptModuleName(app): |
646 |
|
"""Returns the module name of the script to use for a given |
647 |
|
application. Any script mapping set via the setScriptMapping |
648 |
|
method is searched first, with the ultimate fallback being the |
649 |
|
name of the application itself. |
650 |
|
|
651 |
|
Arguments: |
652 |
|
- app: the application to find a script module name for |
653 |
|
""" |
654 |
|
|
655 |
435 |
if not app.name: |
656 |
0 |
return None |
657 |
|
|
658 |
5655 |
for mapping in _scriptMappings: |
659 |
5220 |
regExpression = mapping[0] |
660 |
5220 |
moduleName = mapping[1] |
661 |
5220 |
if regExpression.match(app.name): |
662 |
0 |
debug.println( |
663 |
0 |
debug.LEVEL_FINEST, |
664 |
0 |
"Script mapping for %s is %s" % (app.name, moduleName)) |
665 |
0 |
return moduleName |
666 |
|
|
667 |
435 |
return app.name |
668 |
|
|
669 |
|
# Translators: the regular expression here represents a string to |
670 |
|
# match in the localized application name as seen by at-poke. For |
671 |
|
# most cases, the application name is the name of the binary used to |
672 |
|
# start the application, but this is an unreliable assumption. The |
673 |
|
# only reliable way to do the translation is by running the |
674 |
|
# application and then viewing its name in the main window of at-poke. |
675 |
|
# I wish the AT-SPI spec'd this out as machine readable (unlocalized) |
676 |
|
# names, but it's what we're stuck with (unfortunately). |
677 |
|
# |
678 |
1 |
setScriptMapping(re.compile(_('[\S\s]*StarOffice[\s\S]*')), "StarOffice") |
679 |
|
|
680 |
|
# Translators: see the regular expression note above. This is for |
681 |
|
# OpenOffice and StarOffice. |
682 |
|
# |
683 |
1 |
setScriptMapping(re.compile(_('soffice.bin')), "StarOffice") |
684 |
|
|
685 |
|
# Translators: see the regular expression note above. This is for |
686 |
|
# OpenOffice and StarOffice. |
687 |
|
# |
688 |
1 |
setScriptMapping(re.compile(_('soffice')), "StarOffice") |
689 |
|
|
690 |
|
# Translators: see the regular expression note above. This is for the |
691 |
|
# Evolution mail application. |
692 |
|
# |
693 |
1 |
setScriptMapping(re.compile(_('[Ee]volution')), "Evolution") |
694 |
|
|
695 |
|
# Translators: see the regular expression note above. This is for the |
696 |
|
# help application (yelp). |
697 |
|
# |
698 |
1 |
setScriptMapping(re.compile(_('yelp')), "Mozilla") |
699 |
|
|
700 |
|
# Translators: see the regular expression note above. This is for a |
701 |
|
# version of Mozilla Firefox, which chooses to create strange names |
702 |
|
# for itself at the drop of a hat. |
703 |
|
# |
704 |
1 |
setScriptMapping(re.compile(_('Deer Park')), "Mozilla") |
705 |
|
|
706 |
|
# Translators: see the regular expression note above. This is for a |
707 |
|
# version of Mozilla Firefox, which chooses to create strange names |
708 |
|
# for itself at the drop of a hat. |
709 |
|
# |
710 |
1 |
setScriptMapping(re.compile(_('Bon Echo')), "Mozilla") |
711 |
|
|
712 |
|
# Translators: see the regular expression note above. This is for a |
713 |
|
# version of Mozilla Firefox, which chooses to create strange names |
714 |
|
# for itself at the drop of a hat. |
715 |
|
# |
716 |
1 |
setScriptMapping(re.compile(_('Minefield')), "Mozilla") |
717 |
|
|
718 |
|
# Translators: see the regular expression note above. This is for |
719 |
|
# the Thunderbird e-mail application. |
720 |
|
# |
721 |
1 |
setScriptMapping(re.compile(_('Mail/News')), "Thunderbird") |
722 |
|
|
723 |
|
# Translators: see the regular expression note above. This is for |
724 |
|
# gnome_segv2, which calls itself bug-buddy in at-poke. |
725 |
|
# |
726 |
1 |
setScriptMapping(re.compile(_('bug-buddy')), "gnome_segv2") |
727 |
|
|
728 |
|
# Translators: see the regular expression note above. This is for |
729 |
|
# the underlying terminal support in gnome-terminal. |
730 |
|
# |
731 |
1 |
setScriptMapping(re.compile(_('vte')), "gnome-terminal") |
732 |
|
|
733 |
|
# Translators: see the regular expression note above. This is for |
734 |
|
# supporting pidgin, which is the new name for gaim. |
735 |
|
# |
736 |
1 |
setScriptMapping(re.compile(_('pidgin')), "gaim") |