forked from latex-access/latex-access
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the ability to use custom .table files.
i.e. You can overwrite our default translation strings for simple commands such as \pi, or add your own custom commands such as \implies. This gives the advantage over the preprocessor of working better with brltty and routing, as well as allowing us to change existing commands and add new commands which may not be equivilant to any existing commands. The preprocessor still serves an important purpose though, as I think it works with more complex commands with arguments, where this will not.
- Loading branch information
1 parent
755041d
commit 6c7c76b
Showing
2 changed files
with
29 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# settings.py | ||
# A part of the latex-access project at http://latex-access.sourceforge.net/ | ||
# Author: Daniel Dalton <[email protected]> | ||
# 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"])) | ||
|
||
|