Skip to content

Commit

Permalink
Rename modules to follow Python file naming convention (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
AAClause authored Oct 25, 2020
1 parent a8f2ff1 commit 970a004
Show file tree
Hide file tree
Showing 13 changed files with 240 additions and 240 deletions.
198 changes: 99 additions & 99 deletions addon/globalPlugins/brailleExtender/__init__.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# configBE.py
# addoncfg.py
# Part of BrailleExtender addon for NVDA
# Copyright 2016-2020 André-Abush CLAUSE, released under GPL.

Expand All @@ -13,7 +13,7 @@
import configobj
import inputCore
from .common import *
from .oneHandMode import DOT_BY_DOT, ONE_SIDE, BOTH_SIDES
from .onehand import DOT_BY_DOT, ONE_SIDE, BOTH_SIDES

Validator = configobj.validate.Validator

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# addonDoc.py
# addondoc.py
# Part of BrailleExtender addon for NVDA
# Copyright 2016-2020 André-Abush CLAUSE, released under GPL.

Expand All @@ -7,14 +7,14 @@

addonHandler.initTranslation()
import braille
from . import configBE
from . import addoncfg
from collections import OrderedDict
import config
import cursorManager
import globalCommands
import ui
import random
from .undefinedChars import CHOICES_LABELS
from .undefinedchars import CHOICES_LABELS
from . import utils
from .common import *

Expand Down Expand Up @@ -156,8 +156,8 @@ def __init__(self, instanceGP):
doc += "<h2>" + _("Let's explore some features") + "</h2>"
doc += getFeaturesDoc()
doc += "<h2>" + _("Profile gestures") + "</h2>"
if configBE.gesturesFileExists:
brailleDisplayDriverName = configBE.curBD.capitalize()
if addoncfg.gesturesFileExists:
brailleDisplayDriverName = addoncfg.curBD.capitalize()
profileName = "default"
doc += ''.join([
"<p>",
Expand All @@ -168,44 +168,44 @@ def __init__(self, instanceGP):
mKB = OrderedDict()
mNV = OrderedDict()
mW = OrderedDict()
for g in configBE.iniGestures["globalCommands.GlobalCommands"].keys():
for g in addoncfg.iniGestures["globalCommands.GlobalCommands"].keys():
if "kb:" in g:
if "+" in g:
mW[g] = configBE.iniGestures["globalCommands.GlobalCommands"][g]
mW[g] = addoncfg.iniGestures["globalCommands.GlobalCommands"][g]
else:
mKB[g] = configBE.iniGestures["globalCommands.GlobalCommands"][g]
mKB[g] = addoncfg.iniGestures["globalCommands.GlobalCommands"][g]
else:
mNV[g] = configBE.iniGestures["globalCommands.GlobalCommands"][g]
mNV[g] = addoncfg.iniGestures["globalCommands.GlobalCommands"][g]
doc += ("<h3>" + _("Simple keys") + " (%d)</h3>") % len(mKB)
doc += self.translateLst(mKB)
doc += ("<h3>" + _("Usual shortcuts") + " (%d)</h3>") % len(mW)
doc += self.translateLst(mW)
doc += ("<h3>" + _("Standard NVDA commands") + " (%d)</h3>") % len(mNV)
doc += self.translateLst(mNV)
doc += "<h3>{} ({})</h3>".format(
_("Modifier keys"), len(configBE.iniProfile["modifierKeys"])
_("Modifier keys"), len(addoncfg.iniProfile["modifierKeys"])
)
doc += self.translateLst(configBE.iniProfile["modifierKeys"])
doc += self.translateLst(addoncfg.iniProfile["modifierKeys"])
doc += "<h3>" + _("Quick navigation keys") + "</h3>"
doc += self.translateLst(
configBE.iniGestures["cursorManager.CursorManager"]
addoncfg.iniGestures["cursorManager.CursorManager"]
)
doc += "<h3>" + _("Rotor feature") + "</h3>"
doc += self.translateLst(
{
k: configBE.iniProfile["miscs"][k]
for k in configBE.iniProfile["miscs"]
k: addoncfg.iniProfile["miscs"][k]
for k in addoncfg.iniProfile["miscs"]
if "rotor" in k.lower()
}
) + self.translateLst(configBE.iniProfile["rotor"])
) + self.translateLst(addoncfg.iniProfile["rotor"])
doc += ("<h3>" + _("Gadget commands") + " (%d)</h3>") % (
len(configBE.iniProfile["miscs"]) - 2
len(addoncfg.iniProfile["miscs"]) - 2
)
doc += self.translateLst(
OrderedDict(
[
(k, configBE.iniProfile["miscs"][k])
for k in configBE.iniProfile["miscs"]
(k, addoncfg.iniProfile["miscs"][k])
for k in addoncfg.iniProfile["miscs"]
if k not in ["nextRotor", "priorRotor"]
]
)
Expand Down Expand Up @@ -236,7 +236,7 @@ def __init__(self, instanceGP):
# list keyboard layouts
if (
not instanceGP.noKeyboarLayout()
and "keyboardLayouts" in configBE.iniProfile
and "keyboardLayouts" in addoncfg.iniProfile
):
lb = instanceGP.getKeyboardLayouts()
doc += "<h3>{}</h3>".format(_("Keyboard configurations provided"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# advancedInputMode.py
# advancedinput.py
# Part of BrailleExtender addon for NVDA
# Copyright 2016-2020 André-Abush CLAUSE, released under GPL.
import codecs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# oneHandMode.py
# onehand.py
# Part of BrailleExtender addon for NVDA
# Copyright 2016-2020 André-Abush CLAUSE, released under GPL.
import gui
Expand Down
38 changes: 19 additions & 19 deletions addon/globalPlugins/brailleExtender/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
import addonHandler
addonHandler.initTranslation()

from . import advancedInputMode
from . import brailleRegionHelper
from . import configBE
from . import dictionaries
from . import advancedinput
from . import regionhelper
from . import addoncfg
from . import tabledictionaries
from . import huc
from . import undefinedChars
from .oneHandMode import process as processOneHandMode
from . import undefinedchars
from .onehand import process as processOneHandMode
from .utils import getCurrentChar, getSpeechSymbols, getTether, getCharFromValue, getCurrentBrailleTables
from .common import *

Expand All @@ -57,10 +57,10 @@ def sayCurrentLine():
global instanceGP
if not instanceGP.autoScrollRunning:
if getTether() == braille.handler.TETHER_REVIEW:
if config.conf["brailleExtender"]["speakScroll"] in [configBE.CHOICE_focusAndReview, configBE.CHOICE_review]:
if config.conf["brailleExtender"]["speakScroll"] in [addoncfg.CHOICE_focusAndReview, addoncfg.CHOICE_review]:
scriptHandler.executeScript(globalCommands.commands.script_review_currentLine, None)
return
if config.conf["brailleExtender"]["speakScroll"] in [configBE.CHOICE_focusAndReview, configBE.CHOICE_focus]:
if config.conf["brailleExtender"]["speakScroll"] in [addoncfg.CHOICE_focusAndReview, addoncfg.CHOICE_focus]:
obj = api.getFocusObject()
treeInterceptor = obj.treeInterceptor
if isinstance(treeInterceptor, treeInterceptorHandler.DocumentTreeInterceptor) and not treeInterceptor.passThrough: obj = treeInterceptor
Expand Down Expand Up @@ -97,7 +97,7 @@ def script_braille_routeTo(self, gesture):
if region.cursorPos is None: return
try:
start = region.brailleToRawPos[braille.handler.buffer.windowStartPos + gesture.routingIndex]
_, endBraillePos = brailleRegionHelper.getBraillePosFromRawPos(region, start)
_, endBraillePos = regionhelper.getBraillePosFromRawPos(region, start)
end = region.brailleToRawPos[endBraillePos+1]
ch = region.rawText[start:end]
if ch:
Expand All @@ -123,13 +123,13 @@ def update(self):
mode=mode,
cursorPos=self.cursorPos
)
if self.parseUndefinedChars and config.conf["brailleExtender"]["undefinedCharsRepr"]["method"] != undefinedChars.CHOICE_tableBehaviour:
undefinedChars.undefinedCharProcess(self)
if config.conf["brailleExtender"]["features"]["attributes"] and config.conf["brailleExtender"]["attributes"]["selectedElement"] != configBE.CHOICE_none:
if self.parseUndefinedChars and config.conf["brailleExtender"]["undefinedCharsRepr"]["method"] != undefinedchars.CHOICE_tableBehaviour:
undefinedchars.undefinedCharProcess(self)
if config.conf["brailleExtender"]["features"]["attributes"] and config.conf["brailleExtender"]["attributes"]["selectedElement"] != addoncfg.CHOICE_none:
d = {
configBE.CHOICE_dot7: 64,
configBE.CHOICE_dot8: 128,
configBE.CHOICE_dots78: 192
addoncfg.CHOICE_dot7: 64,
addoncfg.CHOICE_dot8: 128,
addoncfg.CHOICE_dots78: 192
}
if config.conf["brailleExtender"]["attributes"]["selectedElement"] in d:
addDots = d[config.conf["brailleExtender"]["attributes"]["selectedElement"]]
Expand All @@ -138,8 +138,8 @@ def update(self):
if name in self.rawText:
start = self.rawText.index(name)
end = start + len(name)-1
startBraillePos, _ = brailleRegionHelper.getBraillePosFromRawPos(self, start)
_, endBraillePos = brailleRegionHelper.getBraillePosFromRawPos(self, end)
startBraillePos, _ = regionhelper.getBraillePosFromRawPos(self, start)
_, endBraillePos = regionhelper.getBraillePosFromRawPos(self, end)
self.brailleCells = [cell | addDots if startBraillePos <= pos <= endBraillePos else cell for pos, cell in enumerate(self.brailleCells)]
if self.selectionStart is not None and self.selectionEnd is not None:
try:
Expand Down Expand Up @@ -373,7 +373,7 @@ def input_(self, dots):
advancedInputStr = ''.join([chr(cell | 0x2800) for cell in self.bufferBraille[:pos]])
if advancedInputStr:
res = ''
abreviations = advancedInputMode.getReplacements([advancedInputStr])
abreviations = advancedinput.getReplacements([advancedInputStr])
startUnicodeValue = "⠃⠙⠓⠕⠭⡃⡙⡓⡕⡭"
if not abreviations and advancedInputStr[0] in startUnicodeValue: advancedInputStr = config.conf["brailleExtender"]["advancedInputMode"]["escapeSignUnicodeValue"] + advancedInputStr
lenEscapeSign = len(config.conf["brailleExtender"]["advancedInputMode"]["escapeSignUnicodeValue"])
Expand Down Expand Up @@ -426,7 +426,7 @@ def input_(self, dots):
# reason for patching: possibility to lock modifiers, display modifiers in braille during input, HUC Braille input

def sendChar(char):
nvwave.playWaveFile(os.path.join(configBE.baseDir, "res/sounds/keyPress.wav"))
nvwave.playWaveFile(os.path.join(addoncfg.baseDir, "res/sounds/keyPress.wav"))
core.callLater(0, brailleInput.handler.sendChars, char)
if len(char) == 1:
core.callLater(100, speech.speakSpelling, char)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# brailleRegionHelper.py
# regionhelper.py
# Part of BrailleExtender addon for NVDA
# Copyright 2016-2020 André-Abush CLAUSE, released under GPL.

Expand Down
Loading

0 comments on commit 970a004

Please sign in to comment.