diff --git a/latex-access.conf b/latex-access.conf index 19518fc..342b5cd 100644 --- a/latex-access.conf +++ b/latex-access.conf @@ -1,6 +1,7 @@ ;;; A sample configuration for the latex-access project ;;; http://latex-access.sourceforge.net/ ;;; To use this config file under emacs move it to ~/.latex-access +;;; To use it for BRLTTY move it to /etc/latex-access.conf ;;; To use it for both jaws and nvda move it to %appdata%/latex-access.conf. For instance, ;;; Type %appdata% into the run dialog, press enter, ;;; And place this file in that directory. @@ -35,6 +36,18 @@ capitalisation 6dot ;;; Path pointing to the preprocessor strings. ;;; The preprocessor can be used to add custom commands to the translator which correspond to some standard LaTeX -;;; Default location is ~/.latex-access-preprocessor.strings, but you'll probably want to change this for BRLTTY +;;; Default location is ~/.latex-access-preprocessor.strings preprocessorfile ~/.latex-access-preprocessor.strings + +;;; Custom translation files +;;; These settings should point to a custom translations file to either add non-standard LaTeX commands or to overwrite existing translations. +;;; The format of the custom tables is the standard .table format. +;;; Custom Speech Translations +;;; Uncomment and change path accordingly +;speechfile ~/.latex-access/speech-custom.table +;;; Custom table for the nemeth Braille translations +;nemethfile /etc/latex-access/nemeth-custom.table +;;; Custom file for the UEB translations +;uebfile /etc/latex-access/ueb-custom.table + ;;; End of Config diff --git a/latex_access/settings.py b/latex_access/settings.py index 491195f..caef911 100644 --- a/latex_access/settings.py +++ b/latex_access/settings.py @@ -1,7 +1,7 @@ # settings.py # A part of the latex-access project at http://latex-access.sourceforge.net/ # Author: Daniel Dalton -# Copyright (C) 2011,2012 Daniel Dalton/latex-access Contributors +# Copyright (C) 2011,2012,2013 Daniel Dalton/latex-access Contributors # # This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; # either version 2 of the License, or (at your option) any later version. @@ -18,7 +18,7 @@ globals # Global settings for latex-access, these are the default values -settings ={"brailledollars":"True","speakdollars":"True","brailletable":"nemeth","capitalisation":"6dot","preprocessorfile":"~/.latex-access-preprocessor.strings"} +settings={"brailledollars":"True","speakdollars":"True","brailletable":"nemeth","capitalisation":"6dot","preprocessorfile":"~/.latex-access-preprocessor.strings", "speechfile":"","nemethfile":"","uebfile":""} def loadSettings (file): """Read settings from file. @@ -61,11 +61,24 @@ def activateSettings (instances): sessions to the values specified in the config file. Note the activation or deactivation of speech and Braille must be controlled by each module independently, i.e. not here.""" + + # points to our custom speech strings file + speechfile =os.path.expanduser(settings["speechfile"]) + # Decide what file holds Braille strings based on what table is in use. + if settings["brailletable"].lower() == "ueb": + bfile =os.path.expanduser(settings["uebfile"]) + else: + bfile =os.path.expanduser(settings["nemethfile"]) + if 'speak' in instances.keys(): instances["speak"].remove_dollars = not booleaniseSetting("speakdollars") + if os.path.exists(speechfile) and os.path.isfile (speechfile): + instances["speak"].load_file(speechfile) if 'braille' in instances.keys(): instances["braille"].remove_dollars = not booleaniseSetting("brailledollars") instances["braille"].capitalisation=settings["capitalisation"] + if os.path.exists(bfile) and os.path.isfile (bfile): + instances["braille"].load_file(bfile) if 'preprocessor' in instances.keys () and os.path.exists(os.path.expanduser (settings["preprocessorfile"])): instances["preprocessor"].read(os.path.expanduser (settings["preprocessorfile"]))