1# Orca 2# 3# Copyright 2004-2009 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 Lesser General Public 7# License as published by the Free Software Foundation; either 8# version 2.1 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# Lesser General Public License for more details. 14# 15# You should have received a copy of the GNU Lesser General Public 16# License along with this library; if not, write to the 17# Free Software Foundation, Inc., Franklin Street, Fifth Floor, 18# Boston MA 02110-1301 USA. 19 20"""Manages the settings for Orca. This will defer to user settings first, but 21fallback to local settings if the user settings doesn't exist (e.g., in the 22case of gdm) or doesn't have the specified attribute.""" 23 24__id__ = "$Id$" 25__version__ = "$Revision$" 26__date__ = "$Date$" 27__copyright__ = "Copyright (c) 2004-2009 Sun Microsystems Inc." 28__license__ = "LGPL" 29 30import pyatspi 31 32from . import messages 33from .acss import ACSS 34 35userCustomizableSettings = [ 36 "orcaModifierKeys", 37 "enableSpeech", 38 "onlySpeakDisplayedText", 39 "speechServerFactory", 40 "speechServerInfo", 41 "voices", 42 "speechVerbosityLevel", 43 "readFullRowInGUITable", 44 "readFullRowInDocumentTable", 45 "readFullRowInSpreadSheet", 46 "enableSpeechIndentation", 47 "enableEchoByCharacter", 48 "enableEchoByWord", 49 "enableEchoBySentence", 50 "enableKeyEcho", 51 "enableAlphabeticKeys", 52 "enableNumericKeys", 53 "enablePunctuationKeys", 54 "enableSpace", 55 "enableModifierKeys", 56 "enableFunctionKeys", 57 "enableActionKeys", 58 "enableNavigationKeys", 59 "enableDiacriticalKeys", 60 "enablePauseBreaks", 61 "enableTutorialMessages", 62 "enableMnemonicSpeaking", 63 "enablePositionSpeaking", 64 "enableBraille", 65 "enableBrailleContext", 66 "disableBrailleEOL", 67 "brailleVerbosityLevel", 68 "brailleRolenameStyle", 69 "brailleSelectorIndicator", 70 "brailleLinkIndicator", 71 "enableSound", 72 "soundVolume", 73 "playSoundForRole", 74 "playSoundForState", 75 "playSoundForPositionInSet", 76 "playSoundForValue", 77 "verbalizePunctuationStyle", 78 "presentToolTips", 79 "sayAllStyle", 80 "keyboardLayout", 81 "speakBlankLines", 82 "speakMultiCaseStringsAsWords", 83 "speakNumbersAsDigits", 84 "speakMisspelledIndicator", 85 "enabledSpokenTextAttributes", 86 "enabledBrailledTextAttributes", 87 "textAttributesBrailleIndicator", 88 "profile", 89 "speakProgressBarUpdates", 90 "brailleProgressBarUpdates", 91 "beepProgressBarUpdates", 92 "progressBarUpdateInterval", 93 "progressBarVerbosity", 94 "ignoreStatusBarProgressBars", 95 "enableBrailleWordWrap", 96 "enableContractedBraille", 97 "brailleContractionTable", 98 "enableMouseReview", 99 "speakCellCoordinates", 100 "speakSpreadsheetCoordinates", 101 "alwaysSpeakSelectedSpreadsheetRange", 102 "speakCellSpan", 103 "speakCellHeaders", 104 "skipBlankCells", 105 "largeObjectTextLength", 106 "structuralNavigationEnabled", 107 "wrappedStructuralNavigation", 108 "chatMessageVerbosity", 109 "chatSpeakRoomName", 110 "chatAnnounceBuddyTyping", 111 "chatRoomHistories", 112 "enableFlashMessages", 113 "brailleFlashTime", 114 "flashIsPersistent", 115 "flashIsDetailed", 116 "messagesAreDetailed", 117 "presentDateFormat", 118 "presentTimeFormat", 119 "activeProfile", 120 "startingProfile", 121 "spellcheckSpellError", 122 "spellcheckSpellSuggestion", 123 "spellcheckPresentContext", 124 "useColorNames", 125 "capitalizationStyle", 126 "findResultsVerbosity", 127 "findResultsMinimumLength", 128 "structNavTriggersFocusMode", 129 "caretNavTriggersFocusMode", 130 "layoutMode", 131 "nativeNavTriggersFocusMode", 132 "rewindAndFastForwardInSayAll", 133 "structNavInSayAll", 134 "speakDescription", 135 "speakContextBlockquote", 136 "speakContextPanel", 137 "speakContextLandmark", 138 "speakContextNonLandmarkForm", 139 "speakContextList", 140 "speakContextTable", 141 "sayAllContextBlockquote", 142 "sayAllContextPanel", 143 "sayAllContextLandmark", 144 "sayAllContextNonLandmarkForm", 145 "sayAllContextList", 146 "sayAllContextTable" 147] 148 149GENERAL_KEYBOARD_LAYOUT_DESKTOP = 1 150GENERAL_KEYBOARD_LAYOUT_LAPTOP = 2 151 152DESKTOP_MODIFIER_KEYS = ["Insert", "KP_Insert"] 153LAPTOP_MODIFIER_KEYS = ["Caps_Lock", "Shift_Lock"] 154 155VERBOSITY_LEVEL_BRIEF = 0 156VERBOSITY_LEVEL_VERBOSE = 1 157 158BRAILLE_UNDERLINE_NONE = 0x00 # 00000000 159BRAILLE_UNDERLINE_7 = 0x40 # 01000000 160BRAILLE_UNDERLINE_8 = 0x80 # 10000000 161BRAILLE_UNDERLINE_BOTH = 0xc0 # 11000000 162 163BRAILLE_ROLENAME_STYLE_SHORT = 0 # three letter abbreviations 164BRAILLE_ROLENAME_STYLE_LONG = 1 # full rolename 165 166PUNCTUATION_STYLE_NONE = 3 167PUNCTUATION_STYLE_SOME = 2 168PUNCTUATION_STYLE_MOST = 1 169PUNCTUATION_STYLE_ALL = 0 170 171CAPITALIZATION_STYLE_NONE = "none" 172CAPITALIZATION_STYLE_SPELL = "spell" 173CAPITALIZATION_STYLE_ICON = "icon" 174 175SAYALL_STYLE_LINE = 0 176SAYALL_STYLE_SENTENCE = 1 177 178PROGRESS_BAR_ALL = 0 179PROGRESS_BAR_APPLICATION = 1 180PROGRESS_BAR_WINDOW = 2 181 182CHAT_SPEAK_ALL = 0 183CHAT_SPEAK_ALL_IF_FOCUSED = 1 184CHAT_SPEAK_FOCUSED_CHANNEL = 2 185 186DEFAULT_VOICE = "default" 187UPPERCASE_VOICE = "uppercase" 188HYPERLINK_VOICE = "hyperlink" 189SYSTEM_VOICE = "system" 190 191voicesKeys = { 192"DEFAULT_VOICE" : "default", 193"UPPERCASE_VOICE" : "uppercase", 194"HYPERLINK_VOICE" : "hyperlink", 195"SYSTEM_VOICE" : "system" 196} 197 198 199voices = { 200 DEFAULT_VOICE: ACSS({}), 201 UPPERCASE_VOICE: ACSS({ACSS.AVERAGE_PITCH : 7.0}), 202 HYPERLINK_VOICE: ACSS({}), 203 SYSTEM_VOICE: ACSS({}), 204} 205 206# Profiles 207startingProfile = ['Default', 'default'] 208activeProfile = ['Default', 'default'] 209profile = ['Default', 'default'] 210 211# Speech 212speechFactoryModules = ["speechdispatcherfactory"] 213speechServerFactory = "speechdispatcherfactory" 214speechServerInfo = None # None means let the factory decide. 215enableSpeech = True 216silenceSpeech = False 217enableTutorialMessages = False 218enableMnemonicSpeaking = False 219enablePositionSpeaking = False 220enableSpeechIndentation = False 221onlySpeakDisplayedText = False 222presentToolTips = False 223speakBlankLines = True 224repeatCharacterLimit = 4 225readFullRowInGUITable = True 226readFullRowInDocumentTable = True 227readFullRowInSpreadSheet = False 228speakCellCoordinates = True 229speakCellSpan = True 230speakCellHeaders = True 231speakSpreadsheetCoordinates = True 232alwaysSpeakSelectedSpreadsheetRange = False 233speakMultiCaseStringsAsWords = False 234speakNumbersAsDigits = False 235speakMisspelledIndicator = True 236useColorNames = True 237usePronunciationDictionary = True 238sayAllStyle = SAYALL_STYLE_SENTENCE 239capitalizationStyle = CAPITALIZATION_STYLE_NONE 240verbalizePunctuationStyle = PUNCTUATION_STYLE_MOST 241speechVerbosityLevel = VERBOSITY_LEVEL_VERBOSE 242messagesAreDetailed = True 243enablePauseBreaks = True 244speakDescription = True 245speakContextBlockquote = True 246speakContextPanel = True 247speakContextNonLandmarkForm = True 248speakContextLandmark = True 249speakContextList = True 250speakContextTable = True 251sayAllContextBlockquote = True 252sayAllContextPanel = True 253sayAllContextNonLandmarkForm = True 254sayAllContextLandmark = True 255sayAllContextList = True 256sayAllContextTable = True 257 258# Braille 259enableBraille = True 260enableBrailleMonitor = False 261enableBrailleContext = True 262enableFlashMessages = True 263brailleFlashTime = 5000 264flashIsPersistent = False 265flashIsDetailed = True 266enableBrailleWordWrap = False 267enableContractedBraille = False 268brailleContractionTable = '' 269disableBrailleEOL = False 270brailleRolenameStyle = BRAILLE_ROLENAME_STYLE_LONG 271brailleSelectorIndicator = BRAILLE_UNDERLINE_BOTH 272brailleLinkIndicator = BRAILLE_UNDERLINE_BOTH 273textAttributesBrailleIndicator = BRAILLE_UNDERLINE_NONE 274brailleVerbosityLevel = VERBOSITY_LEVEL_VERBOSE 275 276# Sound 277enableSound = True 278soundVolume = 0.5 279playSoundForRole = False 280playSoundForState = False 281playSoundForPositionInSet = False 282playSoundForValue = False 283 284# Keyboard and Echo 285keyboardLayout = GENERAL_KEYBOARD_LAYOUT_DESKTOP 286orcaModifierKeys = DESKTOP_MODIFIER_KEYS 287doubleClickTimeout = 0.5 288enableKeyEcho = True 289enableAlphabeticKeys = True 290enableNumericKeys = True 291enablePunctuationKeys = True 292enableSpace = True 293enableModifierKeys = True 294enableFunctionKeys = True 295enableActionKeys = True 296enableNavigationKeys = False 297enableDiacriticalKeys = False 298enableEchoByCharacter = False 299enableEchoByWord = False 300enableEchoBySentence = False 301presentLockingKeys = None 302 303# Mouse review 304enableMouseReview = False 305 306# Progressbars 307speakProgressBarUpdates = True 308brailleProgressBarUpdates = False 309beepProgressBarUpdates = False 310progressBarUpdateInterval = 10 311progressBarSpeechInterval = None 312progressBarBrailleInterval = None 313progressBarBeepInterval = 0 314progressBarVerbosity = PROGRESS_BAR_APPLICATION 315ignoreStatusBarProgressBars = True 316 317# Structural navigation 318structuralNavigationEnabled = True 319skipBlankCells = False 320largeObjectTextLength = 75 321wrappedStructuralNavigation = True 322inferLiveRegions = True 323 324# Chat 325chatMessageVerbosity = CHAT_SPEAK_ALL 326chatSpeakRoomName = False 327chatAnnounceBuddyTyping = False 328chatRoomHistories = False 329 330# Spellcheck 331spellcheckSpellError = True 332spellcheckSpellSuggestion = True 333spellcheckPresentContext = True 334 335# Day and time 336presentDateFormat = messages.DATE_FORMAT_LOCALE 337presentTimeFormat = messages.TIME_FORMAT_LOCALE 338 339# App search support 340FIND_SPEAK_NONE = 0 341FIND_SPEAK_IF_LINE_CHANGED = 1 342FIND_SPEAK_ALL = 2 343findResultsVerbosity = FIND_SPEAK_ALL 344findResultsMinimumLength = 4 345 346# The complete list of possible text attributes. 347allTextAttributes = \ 348 "bg-color:; bg-full-height:; bg-stipple:; direction:; editable:; " \ 349 "family-name:; fg-color:; fg-stipple:; font-effect:none; indent:0; " \ 350 "invisible:; justification:left; language:; left-margin:; " \ 351 "line-height:100%; paragraph-style:Default; pixels-above-lines:; " \ 352 "pixels-below-lines:; pixels-inside-wrap:; right-margin:; rise:; " \ 353 "scale:; size:; stretch:; strikethrough:false; style:normal; " \ 354 "text-decoration:none; text-rotation:0; text-shadow:none; " \ 355 "text-spelling:none; underline:none; variant:; " \ 356 "vertical-align:baseline; weight:400; wrap-mode:; writing-mode:lr-tb;" 357 358# The default set of text attributes to speak to the user. Specific 359# application scripts (or individual users can override these values if 360# so desired. Each of these text attributes is of the form <key>:<value>; 361# The <value> part will be the "default" value for that attribute. In 362# other words, if the attribute for a given piece of text has that value, 363# it won't be spoken. If no value part is given, then that attribute will 364# always be spoken. 365enabledSpokenTextAttributes = \ 366 "size:; family-name:; weight:400; indent:0; underline:none; " \ 367 "strikethrough:false; justification:left; style:normal; " \ 368 "paragraph-style:; text-spelling:none; fg-color:; bg-color:;" 369 370# The default set of text attributes to be brailled for the user. Specific 371# application scripts (or individual users can override these values if 372# so desired. Each of these text attributes is of the form <key>:<value>; 373# The <value> part will be the "default" value for that attribute. In 374# other words, if the attribute for a given piece of text has that value, 375# it won't be spoken. If no value part is given, then that attribute will 376# always be brailled. 377enabledBrailledTextAttributes = \ 378 "size:; family-name:; weight:400; indent:0; underline:none; " \ 379 "strikethrough:false; justification:left; style:normal; " \ 380 "text-spelling:none;" 381 382# Latent support to allow the user to override/define keybindings 383# and braille bindings. Unsupported and undocumented for now. 384# Use at your own risk. 385# 386keyBindingsMap = {} 387brailleBindingsMap = {} 388 389# TODO - JD: Is this still needed now that AT-SPI has its own timeout? 390timeoutTime = 10 # a value of 0 means don't do hang checking 391timeoutCallback = None # Set by orca.py:init to orca.timeout 392 393structNavTriggersFocusMode = False 394caretNavTriggersFocusMode = False 395nativeNavTriggersFocusMode = True 396 397layoutMode = True 398 399rewindAndFastForwardInSayAll = False 400structNavInSayAll = False 401 402# N.B. The following are experimental and may change or go away at any time. 403enableSadPidginHack = False 404presentChatRoomLast = False 405presentLiveRegionFromInactiveTab = False 406