diff --git a/addon/globalPlugins/brailleExtender/__init__.py b/addon/globalPlugins/brailleExtender/__init__.py index 777dd6e4..fc61512c 100644 --- a/addon/globalPlugins/brailleExtender/__init__.py +++ b/addon/globalPlugins/brailleExtender/__init__.py @@ -41,20 +41,20 @@ import ui import versionInfo import virtualBuffers -from . import configBE -config.conf.spec["brailleExtender"] = configBE.getConfspec() +from . import addoncfg +config.conf.spec["brailleExtender"] = addoncfg.getConfspec() from . import utils -from .updateCheck import * -from . import advancedInputMode -from . import dictionaries +from .updatecheck import * +from . import advancedinput +from . import tabledictionaries from . import huc from . import patches from . import settings from .common import * -from . import undefinedChars +from . import undefinedchars instanceGP = None -lang = configBE.lang +lang = addoncfg.lang ATTRS = config.conf["brailleExtender"]["attributes"].copy().keys() logTextInfo = False rotorItems = [ @@ -111,9 +111,9 @@ def _getTypeformFromFormatField(self, field, formatConfig=None): k = v[0] v = True if len(v) == 1 else v[1] if k in field and (field[k] == v or field[k] == '1'): - if config.conf["brailleExtender"]["attributes"][attr] == configBE.CHOICE_dot7: return 7 - if config.conf["brailleExtender"]["attributes"][attr] == configBE.CHOICE_dot8: return 8 - if config.conf["brailleExtender"]["attributes"][attr] == configBE.CHOICE_dots78: return 78 + if config.conf["brailleExtender"]["attributes"][attr] == addoncfg.CHOICE_dot7: return 7 + if config.conf["brailleExtender"]["attributes"][attr] == addoncfg.CHOICE_dot8: return 8 + if config.conf["brailleExtender"]["attributes"][attr] == addoncfg.CHOICE_dots78: return 78 # if COMPLCOLORS != None: # col = field.get("color",False) # if col and (col != COMPLCOLORS): @@ -170,7 +170,7 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin): _pGestures = OrderedDict() rotorGES = {} noKC = None - if not configBE.noUnicodeTable: + if not addoncfg.noUnicodeTable: backupInputTable = brailleInput.handler.table backupMessageTimeout = None backupShowCursor = False @@ -183,15 +183,15 @@ def __init__(self): patches.instanceGP = self self.reloadBrailleTables() settings.instanceGP = self - configBE.loadConf() - configBE.initGestures() - configBE.loadGestures() + addoncfg.loadConf() + addoncfg.initGestures() + addoncfg.loadGestures() self.gesturesInit() checkingForced = False - if config.conf["brailleExtender"]["lastNVDAVersion"] != updateCheck.versionInfo.version: - config.conf["brailleExtender"]["lastNVDAVersion"] = updateCheck.versionInfo.version + if config.conf["brailleExtender"]["lastNVDAVersion"] != updatecheck.versionInfo.version: + config.conf["brailleExtender"]["lastNVDAVersion"] = updatecheck.versionInfo.version checkingForced = True - delayChecking = 86400 if config.conf["brailleExtender"]["updateChannel"] != configBE.CHANNEL_stable else 604800 + delayChecking = 86400 if config.conf["brailleExtender"]["updateChannel"] != addoncfg.CHANNEL_stable else 604800 if not globalVars.appArgs.secure and config.conf["brailleExtender"]["autoCheckUpdate"] and (checkingForced or (time.time() - config.conf["brailleExtender"]["lastCheckUpdate"]) > delayChecking): checkUpdates(True) config.conf["brailleExtender"]["lastCheckUpdate"] = time.time() @@ -204,7 +204,7 @@ def __init__(self): braille.TextInfoRegion._getTypeformFromFormatField = decorator(braille.TextInfoRegion._getTypeformFromFormatField, "_getTypeformFromFormatField") if config.conf["brailleExtender"]["reverseScrollBtns"]: self.reverseScrollBtns() self.createMenu() - advancedInputMode.initialize() + advancedinput.initialize() log.info(f"{addonName} {addonVersion} loaded ({round(time.time()-startTime, 2)}s)") def event_gainFocus(self, obj, nextHandler): @@ -236,12 +236,12 @@ def event_gainFocus(self, obj, nextHandler): self.switchedMode = True elif self.switchedMode and obj.role != controlTypes.ROLE_TERMINAL: self.restorReviewCursorTethering() - if "tabSize_%s" % configBE.curBD not in config.conf["brailleExtender"].copy().keys(): self.onReload(None, 1) + if "tabSize_%s" % addoncfg.curBD not in config.conf["brailleExtender"].copy().keys(): self.onReload(None, 1) if self.hourDatePlayed: self.script_hourDate(None) if self.autoScrollRunning: self.script_autoScroll(None) if self.autoTestPlayed: self.script_autoTest(None) - if braille.handler is not None and configBE.curBD != braille.handler.display.name: - configBE.curBD = braille.handler.display.name + if braille.handler is not None and addoncfg.curBD != braille.handler.display.name: + addoncfg.curBD = braille.handler.display.name self.onReload(None, 1) if self.backup__brailleTableDict != config.conf["braille"]["translationTable"]: self.reloadBrailleTables() @@ -275,7 +275,7 @@ def createMenu(self): item = self.submenu.Append(wx.ID_ANY, _("Advanced &input mode dictionary..."), _("Advanced input mode configuration")) gui.mainFrame.sysTrayIcon.Bind( wx.EVT_MENU, - lambda event: gui.mainFrame._popupSettingsDialog(advancedInputMode.AdvancedInputModeDlg), + lambda event: gui.mainFrame._popupSettingsDialog(advancedinput.AdvancedInputModeDlg), item ) item = self.submenu.Append(wx.ID_ANY, "%s..." % _("&Quick launches"), _("Quick launches configuration")) @@ -298,25 +298,25 @@ def createMenu(self): def reloadBrailleTables(self): self.backup__brailleTableDict = config.conf["braille"]["translationTable"] - dictionaries.setDictTables() - dictionaries.notifyInvalidTables() + tabledictionaries.setDictTables() + tabledictionaries.notifyInvalidTables() if config.conf["brailleExtender"]["tabSpace"]: - liblouisDef = r"always \t " + ("0-" * configBE.getTabSize()).strip('-') + liblouisDef = r"always \t " + ("0-" * addoncfg.getTabSize()).strip('-') patches.louis.compileString(patches.getCurrentBrailleTables(), bytes(liblouisDef, "ASCII")) - undefinedChars.setUndefinedChar() + undefinedchars.setUndefinedChar() @staticmethod def onDefaultDictionary(evt): - gui.mainFrame._popupSettingsDialog(dictionaries.DictionaryDlg, _("Global dictionary"), "default") + gui.mainFrame._popupSettingsDialog(tabledictionaries.DictionaryDlg, _("Global dictionary"), "default") @staticmethod def onTableDictionary(evt): - outTable = configBE.tablesTR[configBE.tablesFN.index(config.conf["braille"]["translationTable"])] - gui.mainFrame._popupSettingsDialog(dictionaries.DictionaryDlg, _("Table dictionary ({})").format(outTable), "table") + outTable = addoncfg.tablesTR[addoncfg.tablesFN.index(config.conf["braille"]["translationTable"])] + gui.mainFrame._popupSettingsDialog(tabledictionaries.DictionaryDlg, _("Table dictionary ({})").format(outTable), "table") @staticmethod def onTemporaryDictionary(evt): - gui.mainFrame._popupSettingsDialog(dictionaries.DictionaryDlg, _("Temporary dictionary"), "tmp") + gui.mainFrame._popupSettingsDialog(tabledictionaries.DictionaryDlg, _("Temporary dictionary"), "tmp") def restorReviewCursorTethering(self): if not self.switchedMode: return @@ -340,17 +340,17 @@ def restorReviewCursorTethering(self): self.switchedMode = False def getGestureWithBrailleIdentifier(self, gesture = ''): - return ("br(%s):" % configBE.curBD if ':' not in gesture else '')+gesture + return ("br(%s):" % addoncfg.curBD if ':' not in gesture else '') + gesture def gesturesInit(self): # rotor gestures - if 'rotor' in configBE.iniProfile.keys(): - for k in configBE.iniProfile["rotor"]: - if isinstance(configBE.iniProfile["rotor"][k], list): - for l in configBE.iniProfile["rotor"][k]: + if 'rotor' in addoncfg.iniProfile.keys(): + for k in addoncfg.iniProfile["rotor"]: + if isinstance(addoncfg.iniProfile["rotor"][k], list): + for l in addoncfg.iniProfile["rotor"][k]: self.rotorGES[self.getGestureWithBrailleIdentifier(l)] = k else: - self.rotorGES[self.getGestureWithBrailleIdentifier(configBE.iniProfile["rotor"][k])] = k + self.rotorGES[self.getGestureWithBrailleIdentifier(addoncfg.iniProfile["rotor"][k])] = k log.debug(self.rotorGES) else: log.debug("No rotor gestures for this profile") @@ -358,7 +358,7 @@ def gesturesInit(self): # keyboard layout gestures gK = OrderedDict() try: - cK = configBE.iniProfile["keyboardLayouts"][config.conf["brailleExtender"]["keyboardLayout_%s" % configBE.curBD]] if config.conf["brailleExtender"]["keyboardLayout_%s" % configBE.curBD] and config.conf["brailleExtender"]["keyboardLayout_%s" % configBE.curBD] in configBE.iniProfile["keyboardLayouts"] is not None else configBE.iniProfile["keyboardLayouts"].keys()[0] + cK = addoncfg.iniProfile["keyboardLayouts"][config.conf["brailleExtender"]["keyboardLayout_%s" % addoncfg.curBD]] if config.conf["brailleExtender"]["keyboardLayout_%s" % addoncfg.curBD] and config.conf["brailleExtender"]["keyboardLayout_%s" % addoncfg.curBD] in addoncfg.iniProfile["keyboardLayouts"] is not None else addoncfg.iniProfile["keyboardLayouts"].keys()[0] for k in cK: if k in ["enter", "backspace"]: if isinstance(cK[k], list): @@ -377,13 +377,13 @@ def gesturesInit(self): gK[k] = cK[k] inputCore.manager.localeGestureMap.update({'globalCommands.GlobalCommands': gK}) self.noKC = False - log.debug("Keyboard conf found, loading layout `%s`" % config.conf["brailleExtender"]["keyboardLayout_%s" % configBE.curBD]) + log.debug("Keyboard conf found, loading layout `%s`" % config.conf["brailleExtender"]["keyboardLayout_%s" % addoncfg.curBD]) except BaseException: log.debug("No keyboard conf found") self.noKC = True - if configBE.gesturesFileExists: + if addoncfg.gesturesFileExists: self._pGestures = OrderedDict() - for k, v in (configBE.iniProfile["modifierKeys"].items() + [k for k in configBE.iniProfile["miscs"].items() if k[0] != 'defaultQuickLaunches']): + for k, v in (addoncfg.iniProfile["modifierKeys"].items() + [k for k in addoncfg.iniProfile["miscs"].items() if k[0] != 'defaultQuickLaunches']): if isinstance(v, list): for i, gesture in enumerate(v): self._pGestures[inputCore.normalizeGestureIdentifier(self.getGestureWithBrailleIdentifier(gesture))] = k @@ -393,7 +393,7 @@ def gesturesInit(self): self.loadQuickLaunchesGes() def loadQuickLaunchesGes(self): - self.bindGestures({k: "quickLaunch" for k in config.conf["brailleExtender"]["quickLaunches"].copy().keys() if '(%s' % configBE.curBD in k}) + self.bindGestures({k: "quickLaunch" for k in config.conf["brailleExtender"]["quickLaunches"].copy().keys() if '(%s' % addoncfg.curBD in k}) def bindRotorGES(self): for k in self.rotorGES: @@ -588,7 +588,7 @@ def script_toggleAttribra(self, gesture): script_toggleAttribra.__doc__ = _("Toggle font attributes report") def script_toggleSpeechScrollFocusMode(self, gesture): - choices = configBE.focusOrReviewChoices + choices = addoncfg.focusOrReviewChoices curChoice = config.conf["brailleExtender"]["speakScroll"] curChoiceID = list(choices.keys()).index(curChoice) newChoiceID = (curChoiceID+1) % len(choices) @@ -620,7 +620,7 @@ def script_reportExtraInfos(self, gesture): def script_getTableOverview(self, gesture): inTable = brailleInput.handler.table.displayName - ouTable = configBE.tablesTR[configBE.tablesFN.index(config.conf["braille"]["translationTable"])] + ouTable = addoncfg.tablesTR[addoncfg.tablesFN.index(config.conf["braille"]["translationTable"])] t = (_(" Input table")+": %s\n"+_("Output table")+": %s\n\n") % (inTable+' (%s)' % (brailleInput.handler.table.fileName), ouTable+' (%s)' % (config.conf["braille"]["translationTable"])) t += utils.getTableOverview() ui.browseableMessage("
%s
" % t, _("Table overview (%s)" % brailleInput.handler.table.displayName), True) @@ -681,11 +681,11 @@ def script_hourDate(self, gesture=None): if self.hourDatePlayed: self.hourDateTimer.Stop() self.clearMessageFlash() - if configBE.noMessageTimeout: + if addoncfg.noMessageTimeout: config.conf["braille"]["noMessageTimeout"] = self.backupMessageTimeout else: if config.conf["brailleExtender"]["hourDynamic"]: - if configBE.noMessageTimeout: + if addoncfg.noMessageTimeout: self.backupMessageTimeout = config.conf["braille"]["noMessageTimeout"] config.conf["braille"]["noMessageTimeout"] = True self.showHourDate() @@ -715,9 +715,9 @@ def script_autoScroll(self, gesture, sil=False): config.conf["braille"]["showCursor"] = self.backupShowCursor else: self.autoScrollTimer = wx.PyTimer(self.autoScroll) - try: self.autoScrollTimer.Start(int(config.conf["brailleExtender"]["autoScrollDelay_%s" % configBE.curBD])) + try: self.autoScrollTimer.Start(int(config.conf["brailleExtender"]["autoScrollDelay_%s" % addoncfg.curBD])) except BaseException as e: - log.error("%s | %s" % (config.conf["brailleExtender"]["autoScrollDelay_%s" % configBE.curBD], e)) + log.error("%s | %s" % (config.conf["brailleExtender"]["autoScrollDelay_%s" % addoncfg.curBD], e)) ui.message(_("Unable to start autoscroll. More info in NVDA log")) return self.backupShowCursor = config.conf["braille"]["showCursor"] @@ -752,31 +752,31 @@ def clearMessageFlash(): braille.handler._dismissMessage() def script_getHelp(self, g): - from . import addonDoc - addonDoc.AddonDoc(self) + from . import addondoc + addondoc.AddonDoc(self) script_getHelp.__doc__ = _("Shows the Braille Extender documentation") def noKeyboarLayout(self): return self.noKC def getKeyboardLayouts(self): - if not self.noKC and "keyboardLayouts" in configBE.iniProfile: - for layout in configBE.iniProfile["keyboardLayouts"]: + if not self.noKC and "keyboardLayouts" in addoncfg.iniProfile: + for layout in addoncfg.iniProfile["keyboardLayouts"]: t = [] - for lk in configBE.iniProfile["keyboardLayouts"][layout]: + for lk in addoncfg.iniProfile["keyboardLayouts"][layout]: if lk in ["braille_dots", "braille_enter", "braille_translate"]: scriptName = 'script_%s' % lk func = getattr(globalCommands.GlobalCommands, scriptName, None) - if isinstance(configBE.iniProfile["keyboardLayouts"][layout][lk], list): - t.append(utils.beautifulSht(configBE.iniProfile["keyboardLayouts"][layout][lk]) + punctuationSeparator + ": " + func.__doc__) + if isinstance(addoncfg.iniProfile["keyboardLayouts"][layout][lk], list): + t.append(utils.beautifulSht(addoncfg.iniProfile["keyboardLayouts"][layout][lk]) + punctuationSeparator + ": " + func.__doc__) else: - t.append(utils.beautifulSht(configBE.iniProfile["keyboardLayouts"][layout][lk]) + punctuationSeparator + ": " + func.__doc__) + t.append(utils.beautifulSht(addoncfg.iniProfile["keyboardLayouts"][layout][lk]) + punctuationSeparator + ": " + func.__doc__) else: if isinstance( - configBE.iniProfile["keyboardLayouts"][layout][lk], list): - t.append(utils.beautifulSht(configBE.iniProfile["keyboardLayouts"][layout][lk]) + punctuationSeparator + ": " + utils.getKeysTranslation(lk)) + addoncfg.iniProfile["keyboardLayouts"][layout][lk], list): + t.append(utils.beautifulSht(addoncfg.iniProfile["keyboardLayouts"][layout][lk]) + punctuationSeparator + ": " + utils.getKeysTranslation(lk)) else: - t.append(utils.beautifulSht(configBE.iniProfile["keyboardLayouts"][layout][lk]) + punctuationSeparator + ": " + utils.getKeysTranslation(lk)) + t.append(utils.beautifulSht(addoncfg.iniProfile["keyboardLayouts"][layout][lk]) + punctuationSeparator + ": " + utils.getKeysTranslation(lk)) yield ((punctuationSeparator + '; ').join(t)) def getGestures(s): return s.__gestures @@ -804,12 +804,12 @@ def script_checkUpdate(self, gesture): @staticmethod def increaseDelayAutoScroll(): - config.conf["brailleExtender"]["autoScrollDelay_%s" % configBE.curBD] += 25 + config.conf["brailleExtender"]["autoScrollDelay_%s" % addoncfg.curBD] += 25 @staticmethod def decreaseDelayAutoScroll(): - if config.conf["brailleExtender"]["autoScrollDelay_%s" % configBE.curBD] - 25 >= 25: - config.conf["brailleExtender"]["autoScrollDelay_%s" % configBE.curBD] -= 25 + if config.conf["brailleExtender"]["autoScrollDelay_%s" % addoncfg.curBD] - 25 >= 25: + config.conf["brailleExtender"]["autoScrollDelay_%s" % addoncfg.curBD] -= 25 def script_increaseDelayAutoScroll(self, gesture): self.increaseDelayAutoScroll() @@ -818,7 +818,7 @@ def script_increaseDelayAutoScroll(self, gesture): self.script_autoScroll(None) else: ui.message('%s ms' % - config.conf["brailleExtender"]["autoScrollDelay_%s" % configBE.curBD]) + config.conf["brailleExtender"]["autoScrollDelay_%s" % addoncfg.curBD]) return def script_decreaseDelayAutoScroll(self, gesture): @@ -827,46 +827,46 @@ def script_decreaseDelayAutoScroll(self, gesture): self.script_autoScroll(None, True) self.script_autoScroll(None) else: - ui.message('%s ms' % config.conf["brailleExtender"]["autoScrollDelay_%s" % configBE.curBD]) + ui.message('%s ms' % config.conf["brailleExtender"]["autoScrollDelay_%s" % addoncfg.curBD]) return script_increaseDelayAutoScroll.__doc__ = _("Increases braille autoscroll delay") script_decreaseDelayAutoScroll.__doc__ = _("Decreases braille autoscroll delay") def script_switchInputBrailleTable(self, gesture): - if configBE.noUnicodeTable: + if addoncfg.noUnicodeTable: return ui.message(_("NVDA 2017.3 or later is required to use this feature")) - if len(configBE.inputTables) < 2: + if len(addoncfg.inputTables) < 2: return ui.message(_("You must choose at least two tables for this feature. Please fill in the settings")) - if not config.conf["braille"]["inputTable"] in configBE.inputTables: - configBE.inputTables.append(config.conf["braille"]["inputTable"]) - tid = configBE.inputTables.index(config.conf["braille"]["inputTable"]) - nID = tid + 1 if tid + 1 < len(configBE.inputTables) else 0 + if not config.conf["braille"]["inputTable"] in addoncfg.inputTables: + addoncfg.inputTables.append(config.conf["braille"]["inputTable"]) + tid = addoncfg.inputTables.index(config.conf["braille"]["inputTable"]) + nID = tid + 1 if tid + 1 < len(addoncfg.inputTables) else 0 brailleInput.handler.table = brailleTables.listTables( - )[configBE.tablesFN.index(configBE.inputTables[nID])] + )[addoncfg.tablesFN.index(addoncfg.inputTables[nID])] ui.message(_("Input: %s") % brailleInput.handler.table.displayName) return script_switchInputBrailleTable.__doc__ = _("Switches between configured braille input tables") def script_switchOutputBrailleTable(self, gesture): - if configBE.noUnicodeTable: + if addoncfg.noUnicodeTable: return ui.message(_("NVDA 2017.3 or later is required to use this feature")) - if len(configBE.outputTables) < 2: + if len(addoncfg.outputTables) < 2: return ui.message(_("You must choose at least two tables for this feature. Please fill in the settings")) - if not config.conf["braille"]["translationTable"] in configBE.outputTables: - configBE.outputTables.append(config.conf["braille"]["translationTable"]) - tid = configBE.outputTables.index( + if not config.conf["braille"]["translationTable"] in addoncfg.outputTables: + addoncfg.outputTables.append(config.conf["braille"]["translationTable"]) + tid = addoncfg.outputTables.index( config.conf["braille"]["translationTable"]) - nID = tid + 1 if tid + 1 < len(configBE.outputTables) else 0 - config.conf["braille"]["translationTable"] = configBE.outputTables[nID] + nID = tid + 1 if tid + 1 < len(addoncfg.outputTables) else 0 + config.conf["braille"]["translationTable"] = addoncfg.outputTables[nID] utils.refreshBD() - dictionaries.setDictTables() - ui.message(_("Output: %s") % configBE.tablesTR[configBE.tablesFN.index(config.conf["braille"]["translationTable"])]) + tabledictionaries.setDictTables() + ui.message(_("Output: %s") % addoncfg.tablesTR[addoncfg.tablesFN.index(config.conf["braille"]["translationTable"])]) return script_switchOutputBrailleTable.__doc__ = _("Switches between configured braille input tables") def script_currentBrailleTable(self, gesture): inTable = brailleInput.handler.table.displayName - ouTable = configBE.tablesTR[configBE.tablesFN.index(config.conf["braille"]["translationTable"])] + ouTable = addoncfg.tablesTR[addoncfg.tablesFN.index(config.conf["braille"]["translationTable"])] if ouTable == inTable: braille.handler.message(_("I⣿O:{I}").format(I=inTable, O=ouTable)) speech.speakMessage(_("Input and output: {I}.").format(I=inTable, O=ouTable)) @@ -898,11 +898,11 @@ def onReload(self, evt=None, sil=False, sv=False): self.clearGestureBindings() self.bindGestures(self.__gestures) self._pGestures=OrderedDict() - configBE.quickLaunches = OrderedDict() - config.conf.spec["brailleExtender"] = configBE.getConfspec() - configBE.loadConf() - configBE.initGestures() - configBE.loadGestures() + addoncfg.quickLaunches = OrderedDict() + config.conf.spec["brailleExtender"] = addoncfg.getConfspec() + addoncfg.loadConf() + addoncfg.initGestures() + addoncfg.loadGestures() self.gesturesInit() if config.conf["brailleExtender"]["reverseScrollBtns"]: self.reverseScrollBtns() @@ -937,11 +937,11 @@ def reload_brailledisplay(self, n): if config.conf["braille"]["display"] == "noBraille": return ui.message(_("No braille display specified. No reload to do")) utils.reload_brailledisplay(config.conf["braille"]["display"]) - configBE.curBD = braille.handler.display.name + addoncfg.curBD = braille.handler.display.name utils.refreshBD() else: utils.reload_brailledisplay(config.conf["brailleExtender"][k]) - configBE.curBD = config.conf["brailleExtender"][k] + addoncfg.curBD = config.conf["brailleExtender"][k] utils.refreshBD() return self.onReload(None, True) @@ -969,9 +969,9 @@ def getActualModifiers(self, short=True): s += t[k] + '+' if short else k + '+' if not short: return s - if config.conf["brailleExtender"]["modifierKeysFeedback"] in [configBE.CHOICE_braille, configBE.CHOICE_speechAndBraille]: + if config.conf["brailleExtender"]["modifierKeysFeedback"] in [addoncfg.CHOICE_braille, addoncfg.CHOICE_speechAndBraille]: braille.handler.message('%s...' % s) - if config.conf["brailleExtender"]["modifierKeysFeedback"] in [configBE.CHOICE_speech, configBE.CHOICE_speechAndBraille]: + if config.conf["brailleExtender"]["modifierKeysFeedback"] in [addoncfg.CHOICE_speech, addoncfg.CHOICE_speechAndBraille]: speech.speakMessage(keyLabels.getKeyCombinationLabel('+'.join([m for m in self.modifiers]))) def toggleModifier(self, modifier, beep = True): @@ -1132,12 +1132,12 @@ def script_saveCurrentBrailleView(self, gesture): config.conf["brailleExtender"]["viewSaved"] = ''.join(chr(c | 0x2800) for c in braille.handler.mainBuffer.brailleCells) ui.message(_("Current braille view saved")) else: - config.conf["brailleExtender"]["viewSaved"] = configBE.NOVIEWSAVED + config.conf["brailleExtender"]["viewSaved"] = addoncfg.NOVIEWSAVED ui.message(_("Buffer cleaned")) script_saveCurrentBrailleView.__doc__ = _("Saves the current braille view. Press twice quickly to clean the buffer") def script_showBrailleViewSaved(self, gesture): - if config.conf["brailleExtender"]["viewSaved"] != configBE.NOVIEWSAVED: + if config.conf["brailleExtender"]["viewSaved"] != addoncfg.NOVIEWSAVED: if scriptHandler.getLastScriptRepeatCount() == 0: braille.handler.message("⣇ %s ⣸" % config.conf["brailleExtender"]["viewSaved"]) else: ui.browseableMessage(config.conf["brailleExtender"]["viewSaved"], _("View saved"), True) else: ui.message(_("Buffer empty")) @@ -1235,9 +1235,9 @@ def script_autoTest(self, gesture): self.autoTest_charPtr = self.autoTest_cellPtr = 0 self.clearMessageFlash() speech.speakMessage(_("Auto test stopped")) - if configBE.noMessageTimeout: config.conf["braille"]["noMessageTimeout"] = self.backupMessageTimeout + if addoncfg.noMessageTimeout: config.conf["braille"]["noMessageTimeout"] = self.backupMessageTimeout else: - if configBE.noMessageTimeout: + if addoncfg.noMessageTimeout: self.backupMessageTimeout = config.conf["braille"]["noMessageTimeout"] config.conf["braille"]["noMessageTimeout"] = True self.showAutoTest() @@ -1251,7 +1251,7 @@ def script_autoTest(self, gesture): def script_addDictionaryEntry(self, gesture): curChar = utils.getCurrentChar() - gui.mainFrame._popupSettingsDialog(dictionaries.DictionaryEntryDlg, title=_("Add dictionary entry or see a dictionary"), textPattern=curChar, specifyDict=True) + gui.mainFrame._popupSettingsDialog(tabledictionaries.DictionaryEntryDlg, title=_("Add dictionary entry or see a dictionary"), textPattern=curChar, specifyDict=True) script_addDictionaryEntry.__doc__ = _("Adds an entry in braille dictionary") def script_toggle_blank_line_scroll(self, gesture): @@ -1291,19 +1291,19 @@ def terminate(self): braille.TextInfoRegion._getTypeformFromFormatField = self.backup__getTypeformFromFormatField self.removeMenu() self.restorReviewCursorTethering() - configBE.discardRoleLabels() - if configBE.noUnicodeTable: + addoncfg.discardRoleLabels() + if addoncfg.noUnicodeTable: brailleInput.handler.table = self.backupInputTable if self.hourDatePlayed: self.hourDateTimer.Stop() - if configBE.noMessageTimeout: + if addoncfg.noMessageTimeout: config.conf["braille"]["noMessageTimeout"] = self.backupMessageTimeout if self.autoScrollRunning: self.autoScrollTimer.Stop() config.conf["braille"]["showCursor"] = self.backupShowCursor if self.autoTestPlayed: self.autoTestTimer.Stop() - dictionaries.removeTmpDict() - advancedInputMode.terminate() + tabledictionaries.removeTmpDict() + advancedinput.terminate() super().terminate() def removeMenu(self): diff --git a/addon/globalPlugins/brailleExtender/configBE.py b/addon/globalPlugins/brailleExtender/addoncfg.py similarity index 99% rename from addon/globalPlugins/brailleExtender/configBE.py rename to addon/globalPlugins/brailleExtender/addoncfg.py index 9f466d0d..53d3cb16 100644 --- a/addon/globalPlugins/brailleExtender/configBE.py +++ b/addon/globalPlugins/brailleExtender/addoncfg.py @@ -1,4 +1,4 @@ -# configBE.py +# addoncfg.py # Part of BrailleExtender addon for NVDA # Copyright 2016-2020 André-Abush CLAUSE, released under GPL. @@ -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 diff --git a/addon/globalPlugins/brailleExtender/addonDoc.py b/addon/globalPlugins/brailleExtender/addondoc.py similarity index 94% rename from addon/globalPlugins/brailleExtender/addonDoc.py rename to addon/globalPlugins/brailleExtender/addondoc.py index 4c193a2d..bcb12543 100644 --- a/addon/globalPlugins/brailleExtender/addonDoc.py +++ b/addon/globalPlugins/brailleExtender/addondoc.py @@ -1,4 +1,4 @@ -# addonDoc.py +# addondoc.py # Part of BrailleExtender addon for NVDA # Copyright 2016-2020 André-Abush CLAUSE, released under GPL. @@ -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 * @@ -156,8 +156,8 @@ def __init__(self, instanceGP): doc += "

" + _("Let's explore some features") + "

" doc += getFeaturesDoc() doc += "

" + _("Profile gestures") + "

" - if configBE.gesturesFileExists: - brailleDisplayDriverName = configBE.curBD.capitalize() + if addoncfg.gesturesFileExists: + brailleDisplayDriverName = addoncfg.curBD.capitalize() profileName = "default" doc += ''.join([ "

", @@ -168,14 +168,14 @@ 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 += ("

" + _("Simple keys") + " (%d)

") % len(mKB) doc += self.translateLst(mKB) doc += ("

" + _("Usual shortcuts") + " (%d)

") % len(mW) @@ -183,29 +183,29 @@ def __init__(self, instanceGP): doc += ("

" + _("Standard NVDA commands") + " (%d)

") % len(mNV) doc += self.translateLst(mNV) doc += "

{} ({})

".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 += "

" + _("Quick navigation keys") + "

" doc += self.translateLst( - configBE.iniGestures["cursorManager.CursorManager"] + addoncfg.iniGestures["cursorManager.CursorManager"] ) doc += "

" + _("Rotor feature") + "

" 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 += ("

" + _("Gadget commands") + " (%d)

") % ( - 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"] ] ) @@ -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 += "

{}

".format(_("Keyboard configurations provided")) diff --git a/addon/globalPlugins/brailleExtender/advancedInputMode.py b/addon/globalPlugins/brailleExtender/advancedinput.py similarity index 99% rename from addon/globalPlugins/brailleExtender/advancedInputMode.py rename to addon/globalPlugins/brailleExtender/advancedinput.py index 799cab60..a6fd15f2 100644 --- a/addon/globalPlugins/brailleExtender/advancedInputMode.py +++ b/addon/globalPlugins/brailleExtender/advancedinput.py @@ -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 diff --git a/addon/globalPlugins/brailleExtender/oneHandMode.py b/addon/globalPlugins/brailleExtender/onehand.py similarity index 99% rename from addon/globalPlugins/brailleExtender/oneHandMode.py rename to addon/globalPlugins/brailleExtender/onehand.py index ae7d44ec..6350169a 100644 --- a/addon/globalPlugins/brailleExtender/oneHandMode.py +++ b/addon/globalPlugins/brailleExtender/onehand.py @@ -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 diff --git a/addon/globalPlugins/brailleExtender/patches.py b/addon/globalPlugins/brailleExtender/patches.py index a0ba3c86..3a51f501 100644 --- a/addon/globalPlugins/brailleExtender/patches.py +++ b/addon/globalPlugins/brailleExtender/patches.py @@ -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 * @@ -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 @@ -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: @@ -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"]] @@ -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: @@ -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"]) @@ -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) diff --git a/addon/globalPlugins/brailleExtender/brailleRegionHelper.py b/addon/globalPlugins/brailleExtender/regionhelper.py similarity index 99% rename from addon/globalPlugins/brailleExtender/brailleRegionHelper.py rename to addon/globalPlugins/brailleExtender/regionhelper.py index f557ea70..ec96039c 100644 --- a/addon/globalPlugins/brailleExtender/brailleRegionHelper.py +++ b/addon/globalPlugins/brailleExtender/regionhelper.py @@ -1,4 +1,4 @@ -# brailleRegionHelper.py +# regionhelper.py # Part of BrailleExtender addon for NVDA # Copyright 2016-2020 André-Abush CLAUSE, released under GPL. diff --git a/addon/globalPlugins/brailleExtender/settings.py b/addon/globalPlugins/brailleExtender/settings.py index 8e707598..8e3f0c22 100644 --- a/addon/globalPlugins/brailleExtender/settings.py +++ b/addon/globalPlugins/brailleExtender/settings.py @@ -20,11 +20,11 @@ import ui addonHandler.initTranslation() -from . import configBE +from . import addoncfg from . import utils -from .advancedInputMode import SettingsDlg as AdvancedInputModeDlg -from .oneHandMode import SettingsDlg as OneHandModeDlg -from .undefinedChars import SettingsDlg as UndefinedCharsDlg +from .advancedinput import SettingsDlg as AdvancedInputModeDlg +from .onehand import SettingsDlg as OneHandModeDlg +from .undefinedchars import SettingsDlg as UndefinedCharsDlg from .common import * instanceGP = None @@ -39,8 +39,8 @@ class GeneralDlg(gui.settingsDialogs.SettingsPanel): # Translators: title of a dialog. title = _("General") - bds_k = [k for k, v in configBE.getValidBrailleDisplayPrefered()] - bds_v = [v for k, v in configBE.getValidBrailleDisplayPrefered()] + bds_k = [k for k, v in addoncfg.getValidBrailleDisplayPrefered()] + bds_v = [v for k, v in addoncfg.getValidBrailleDisplayPrefered()] def makeSettings(self, settingsSizer): sHelper = gui.guiHelper.BoxSizerHelper(self, sizer=settingsSizer) @@ -49,15 +49,15 @@ def makeSettings(self, settingsSizer): self.autoCheckUpdate.SetValue(config.conf["brailleExtender"]["autoCheckUpdate"]) # Translators: label of a dialog. - self.updateChannel = sHelper.addLabeledControl(_("Add-on &update channel:"), wx.Choice, choices=list(configBE.updateChannels.values())) - if config.conf["brailleExtender"]["updateChannel"] in configBE.updateChannels.keys(): - itemToSelect = list(configBE.updateChannels.keys()).index(config.conf["brailleExtender"]["updateChannel"]) - else: itemToSelect = list(config.conf["brailleExtender"]["updateChannel"]).index(configBE.CHANNEL_stable) + self.updateChannel = sHelper.addLabeledControl(_("Add-on &update channel:"), wx.Choice, choices=list(addoncfg.updateChannels.values())) + if config.conf["brailleExtender"]["updateChannel"] in addoncfg.updateChannels.keys(): + itemToSelect = list(addoncfg.updateChannels.keys()).index(config.conf["brailleExtender"]["updateChannel"]) + else: itemToSelect = list(config.conf["brailleExtender"]["updateChannel"]).index(addoncfg.CHANNEL_stable) self.updateChannel.SetSelection(itemToSelect) # Translators: label of a dialog. - self.speakScroll = sHelper.addLabeledControl(_("Say current line while &scrolling in:"), wx.Choice, choices=list(configBE.focusOrReviewChoices.values())) - self.speakScroll.SetSelection(list(configBE.focusOrReviewChoices.keys()).index(config.conf["brailleExtender"]["speakScroll"])) + self.speakScroll = sHelper.addLabeledControl(_("Say current line while &scrolling in:"), wx.Choice, choices=list(addoncfg.focusOrReviewChoices.values())) + self.speakScroll.SetSelection(list(addoncfg.focusOrReviewChoices.keys()).index(config.conf["brailleExtender"]["speakScroll"])) # Translators: label of a dialog. self.stopSpeechScroll = sHelper.addItem(wx.CheckBox(self, label=_("Speech &interrupt when scrolling on same line"))) @@ -86,38 +86,38 @@ def makeSettings(self, settingsSizer): self.reviewModeTerminal.SetValue(config.conf["brailleExtender"]["reviewModeTerminal"]) # Translators: label of a dialog. - self.volumeChangeFeedback = sHelper.addLabeledControl(_("Announce &volume changes:"), wx.Choice, choices=list(configBE.outputMessage.values())) - if config.conf["brailleExtender"]["volumeChangeFeedback"] in configBE.outputMessage: - itemToSelect = list(configBE.outputMessage.keys()).index(config.conf["brailleExtender"]["volumeChangeFeedback"]) + self.volumeChangeFeedback = sHelper.addLabeledControl(_("Announce &volume changes:"), wx.Choice, choices=list(addoncfg.outputMessage.values())) + if config.conf["brailleExtender"]["volumeChangeFeedback"] in addoncfg.outputMessage: + itemToSelect = list(addoncfg.outputMessage.keys()).index(config.conf["brailleExtender"]["volumeChangeFeedback"]) else: - itemToSelect = list(configBE.outputMessage.keys()).index(configBE.CHOICE_braille) + itemToSelect = list(addoncfg.outputMessage.keys()).index(addoncfg.CHOICE_braille) self.volumeChangeFeedback.SetSelection(itemToSelect) # Translators: label of a dialog. - self.modifierKeysFeedback = sHelper.addLabeledControl(_("Announce m&odifier key presses:"), wx.Choice, choices=list(configBE.outputMessage.values())) - if config.conf["brailleExtender"]["modifierKeysFeedback"] in configBE.outputMessage: - itemToSelect = list(configBE.outputMessage.keys()).index(config.conf["brailleExtender"]["modifierKeysFeedback"]) + self.modifierKeysFeedback = sHelper.addLabeledControl(_("Announce m&odifier key presses:"), wx.Choice, choices=list(addoncfg.outputMessage.values())) + if config.conf["brailleExtender"]["modifierKeysFeedback"] in addoncfg.outputMessage: + itemToSelect = list(addoncfg.outputMessage.keys()).index(config.conf["brailleExtender"]["modifierKeysFeedback"]) else: - itemToSelect = list(configBE.outputMessage.keys()).index(configBE.CHOICE_braille) + itemToSelect = list(addoncfg.outputMessage.keys()).index(addoncfg.CHOICE_braille) # Translators: label of a dialog. self.beepsModifiers = sHelper.addItem(wx.CheckBox(self, label=_("Play &beeps for modifier keys"))) self.beepsModifiers.SetValue(config.conf["brailleExtender"]["beepsModifiers"]) # Translators: label of a dialog. self.modifierKeysFeedback.SetSelection(itemToSelect) - self.rightMarginCells = sHelper.addLabeledControl(_("&Right margin on cells for the active braille display"), gui.nvdaControls.SelectOnFocusSpinCtrl, min=0, max=100, initial=int(config.conf["brailleExtender"]["rightMarginCells_%s" % configBE.curBD])) - if configBE.gesturesFileExists: + self.rightMarginCells = sHelper.addLabeledControl(_("&Right margin on cells for the active braille display"), gui.nvdaControls.SelectOnFocusSpinCtrl, min=0, max=100, initial=int(config.conf["brailleExtender"]["rightMarginCells_%s" % addoncfg.curBD])) + if addoncfg.gesturesFileExists: lb = [k for k in instanceGP.getKeyboardLayouts()] # Translators: label of a dialog. self.KBMode = sHelper.addLabeledControl(_("Braille &keyboard configuration:"), wx.Choice, choices=lb) - self.KBMode.SetSelection(configBE.getKeyboardLayout()) + self.KBMode.SetSelection(addoncfg.getKeyboardLayout()) # Translators: label of a dialog. self.reverseScrollBtns = sHelper.addItem(wx.CheckBox(self, label=_("&Reverse forward and back scroll buttons"))) self.reverseScrollBtns.SetValue(config.conf["brailleExtender"]["reverseScrollBtns"]) # Translators: label of a dialog. - self.autoScrollDelay = sHelper.addLabeledControl(_("Autoscroll &delay for the active braille display (ms):"), gui.nvdaControls.SelectOnFocusSpinCtrl, min=125, max=42000, initial=int(config.conf["brailleExtender"]["autoScrollDelay_%s" % configBE.curBD])) + self.autoScrollDelay = sHelper.addLabeledControl(_("Autoscroll &delay for the active braille display (ms):"), gui.nvdaControls.SelectOnFocusSpinCtrl, min=125, max=42000, initial=int(config.conf["brailleExtender"]["autoScrollDelay_%s" % addoncfg.curBD])) self.brailleDisplay1 = sHelper.addLabeledControl(_("Preferred &primary braille display:"), wx.Choice, choices=self.bds_v) self.brailleDisplay1.SetSelection(self.bds_k.index(config.conf["brailleExtender"]["brailleDisplay1"])) self.brailleDisplay2 = sHelper.addLabeledControl(_("Preferred &secondary braille display:"), wx.Choice, choices=self.bds_v) @@ -138,17 +138,17 @@ def onSave(self): config.conf["brailleExtender"]["speakRoutingTo"] = self.speakRoutingTo.IsChecked() config.conf["brailleExtender"]["routingReviewModeWithCursorKeys"] = self.routingReviewModeWithCursorKeys.IsChecked() - config.conf["brailleExtender"]["updateChannel"] = list(configBE.updateChannels.keys())[self.updateChannel.GetSelection()] - config.conf["brailleExtender"]["speakScroll"] = list(configBE.focusOrReviewChoices.keys())[self.speakScroll.GetSelection()] + config.conf["brailleExtender"]["updateChannel"] = list(addoncfg.updateChannels.keys())[self.updateChannel.GetSelection()] + config.conf["brailleExtender"]["speakScroll"] = list(addoncfg.focusOrReviewChoices.keys())[self.speakScroll.GetSelection()] - config.conf["brailleExtender"]["autoScrollDelay_%s" % configBE.curBD] = self.autoScrollDelay.Value - config.conf["brailleExtender"]["rightMarginCells_%s" % configBE.curBD] = self.rightMarginCells.Value + config.conf["brailleExtender"]["autoScrollDelay_%s" % addoncfg.curBD] = self.autoScrollDelay.Value + config.conf["brailleExtender"]["rightMarginCells_%s" % addoncfg.curBD] = self.rightMarginCells.Value config.conf["brailleExtender"]["brailleDisplay1"] = self.bds_k[self.brailleDisplay1.GetSelection()] config.conf["brailleExtender"]["brailleDisplay2"] = self.bds_k[self.brailleDisplay2.GetSelection()] - if configBE.gesturesFileExists: - config.conf["brailleExtender"]["keyboardLayout_%s" % configBE.curBD] = configBE.iniProfile["keyboardLayouts"].keys()[self.KBMode.GetSelection()] - config.conf["brailleExtender"]["volumeChangeFeedback"] = list(configBE.outputMessage.keys())[self.volumeChangeFeedback.GetSelection()] - config.conf["brailleExtender"]["modifierKeysFeedback"] = list(configBE.outputMessage.keys())[self.modifierKeysFeedback.GetSelection()] + if addoncfg.gesturesFileExists: + config.conf["brailleExtender"]["keyboardLayout_%s" % addoncfg.curBD] = addoncfg.iniProfile["keyboardLayouts"].keys()[self.KBMode.GetSelection()] + config.conf["brailleExtender"]["volumeChangeFeedback"] = list(addoncfg.outputMessage.keys())[self.volumeChangeFeedback.GetSelection()] + config.conf["brailleExtender"]["modifierKeysFeedback"] = list(addoncfg.outputMessage.keys())[self.modifierKeysFeedback.GetSelection()] config.conf["brailleExtender"]["beepsModifiers"] = self.beepsModifiers.IsChecked() class AttribraDlg(gui.settingsDialogs.SettingsPanel): @@ -160,39 +160,39 @@ def makeSettings(self, settingsSizer): sHelper = gui.guiHelper.BoxSizerHelper(self, sizer=settingsSizer) self.toggleAttribra = sHelper.addItem(wx.CheckBox(self, label=_("Indicate text attributes in braille with &Attribra"))) self.toggleAttribra.SetValue(config.conf["brailleExtender"]["features"]["attributes"]) - self.selectedElement = sHelper.addLabeledControl(_("&Selected elements:"), wx.Choice, choices=configBE.attributeChoicesValues) + self.selectedElement = sHelper.addLabeledControl(_("&Selected elements:"), wx.Choice, choices=addoncfg.attributeChoicesValues) self.selectedElement.SetSelection(self.getItemToSelect("selectedElement")) - self.spellingErrorsAttribute = sHelper.addLabeledControl(_("Spelling &errors:"), wx.Choice, choices=configBE.attributeChoicesValues) + self.spellingErrorsAttribute = sHelper.addLabeledControl(_("Spelling &errors:"), wx.Choice, choices=addoncfg.attributeChoicesValues) self.spellingErrorsAttribute.SetSelection(self.getItemToSelect("invalid-spelling")) - self.boldAttribute = sHelper.addLabeledControl(_("&Bold:"), wx.Choice, choices=configBE.attributeChoicesValues) + self.boldAttribute = sHelper.addLabeledControl(_("&Bold:"), wx.Choice, choices=addoncfg.attributeChoicesValues) self.boldAttribute.SetSelection(self.getItemToSelect("bold")) - self.italicAttribute = sHelper.addLabeledControl(_("&Italic:"), wx.Choice, choices=configBE.attributeChoicesValues) + self.italicAttribute = sHelper.addLabeledControl(_("&Italic:"), wx.Choice, choices=addoncfg.attributeChoicesValues) self.italicAttribute.SetSelection(self.getItemToSelect("italic")) - self.underlineAttribute = sHelper.addLabeledControl(_("&Underline:"), wx.Choice, choices=configBE.attributeChoicesValues) + self.underlineAttribute = sHelper.addLabeledControl(_("&Underline:"), wx.Choice, choices=addoncfg.attributeChoicesValues) self.underlineAttribute.SetSelection(self.getItemToSelect("underline")) - self.strikethroughAttribute = sHelper.addLabeledControl(_("Strike&through:"), wx.Choice, choices=configBE.attributeChoicesValues) + self.strikethroughAttribute = sHelper.addLabeledControl(_("Strike&through:"), wx.Choice, choices=addoncfg.attributeChoicesValues) self.strikethroughAttribute.SetSelection(self.getItemToSelect("strikethrough")) - self.subAttribute = sHelper.addLabeledControl(_("Su&bscripts:"), wx.Choice, choices=configBE.attributeChoicesValues) + self.subAttribute = sHelper.addLabeledControl(_("Su&bscripts:"), wx.Choice, choices=addoncfg.attributeChoicesValues) self.subAttribute.SetSelection(self.getItemToSelect("text-position:sub")) - self.superAttribute = sHelper.addLabeledControl(_("Su&perscripts:"), wx.Choice, choices=configBE.attributeChoicesValues) + self.superAttribute = sHelper.addLabeledControl(_("Su&perscripts:"), wx.Choice, choices=addoncfg.attributeChoicesValues) self.superAttribute.SetSelection(self.getItemToSelect("text-position:super")) def postInit(self): self.toggleAttribra.SetFocus() def onSave(self): config.conf["brailleExtender"]["features"]["attributes"] = self.toggleAttribra.IsChecked() - config.conf["brailleExtender"]["attributes"]["selectedElement"] = configBE.attributeChoicesKeys[self.selectedElement.GetSelection()] - config.conf["brailleExtender"]["attributes"]["invalid-spelling"] = configBE.attributeChoicesKeys[self.spellingErrorsAttribute.GetSelection()] - config.conf["brailleExtender"]["attributes"]["bold"] = configBE.attributeChoicesKeys[self.boldAttribute.GetSelection()] - config.conf["brailleExtender"]["attributes"]["italic"] = configBE.attributeChoicesKeys[self.italicAttribute.GetSelection()] - config.conf["brailleExtender"]["attributes"]["underline"] = configBE.attributeChoicesKeys[self.underlineAttribute.GetSelection()] - config.conf["brailleExtender"]["attributes"]["strikethrough"] = configBE.attributeChoicesKeys[self.strikethroughAttribute.GetSelection()] - config.conf["brailleExtender"]["attributes"]["text-position:sub"] = configBE.attributeChoicesKeys[self.subAttribute.GetSelection()] - config.conf["brailleExtender"]["attributes"]["text-position:super"] = configBE.attributeChoicesKeys[self.superAttribute.GetSelection()] + config.conf["brailleExtender"]["attributes"]["selectedElement"] = addoncfg.attributeChoicesKeys[self.selectedElement.GetSelection()] + config.conf["brailleExtender"]["attributes"]["invalid-spelling"] = addoncfg.attributeChoicesKeys[self.spellingErrorsAttribute.GetSelection()] + config.conf["brailleExtender"]["attributes"]["bold"] = addoncfg.attributeChoicesKeys[self.boldAttribute.GetSelection()] + config.conf["brailleExtender"]["attributes"]["italic"] = addoncfg.attributeChoicesKeys[self.italicAttribute.GetSelection()] + config.conf["brailleExtender"]["attributes"]["underline"] = addoncfg.attributeChoicesKeys[self.underlineAttribute.GetSelection()] + config.conf["brailleExtender"]["attributes"]["strikethrough"] = addoncfg.attributeChoicesKeys[self.strikethroughAttribute.GetSelection()] + config.conf["brailleExtender"]["attributes"]["text-position:sub"] = addoncfg.attributeChoicesKeys[self.subAttribute.GetSelection()] + config.conf["brailleExtender"]["attributes"]["text-position:super"] = addoncfg.attributeChoicesKeys[self.superAttribute.GetSelection()] @staticmethod def getItemToSelect(attribute): - try: idx = configBE.attributeChoicesKeys.index(config.conf["brailleExtender"]["attributes"][attribute]) + try: idx = addoncfg.attributeChoicesKeys.index(config.conf["brailleExtender"]["attributes"][attribute]) except BaseException as err: log.error(err) idx = 0 @@ -299,8 +299,8 @@ def onResetAllLabelsBtn(self, event): self.onCategories(None) def getOriginalLabel(self, idCategory, idLabel, defaultValue = ''): - if "%s:%s" % (idCategory, idLabel) in configBE.backupRoleLabels.keys(): - return configBE.backupRoleLabels["%s:%s" % (idCategory, idLabel)][1] + if "%s:%s" % (idCategory, idLabel) in addoncfg.backupRoleLabels.keys(): + return addoncfg.backupRoleLabels["%s:%s" % (idCategory, idLabel)][1] return self.getLabelFromID(idCategory, idLabel) @staticmethod @@ -325,9 +325,9 @@ def postInit(self): self.toggleRoleLabels.SetFocus() def onSave(self): config.conf["brailleExtender"]["features"]["roleLabels"] = self.toggleRoleLabels.IsChecked() config.conf["brailleExtender"]["roleLabels"] = self.roleLabels - configBE.discardRoleLabels() + addoncfg.discardRoleLabels() if config.conf["brailleExtender"]["features"]["roleLabels"]: - configBE.loadRoleLabels(config.conf["brailleExtender"]["roleLabels"].copy()) + addoncfg.loadRoleLabels(config.conf["brailleExtender"]["roleLabels"].copy()) class BrailleTablesDlg(gui.settingsDialogs.SettingsPanel): @@ -335,13 +335,13 @@ class BrailleTablesDlg(gui.settingsDialogs.SettingsPanel): title = _("Braille tables") def makeSettings(self, settingsSizer): - self.oTables = set(configBE.outputTables) - self.iTables = set(configBE.inputTables) + self.oTables = set(addoncfg.outputTables) + self.iTables = set(addoncfg.inputTables) lt = [_("Use the current input table")] - for table in configBE.tables: + for table in addoncfg.tables: if table.output and not table.contracted: lt.append(table[1]) - if config.conf["brailleExtender"]["inputTableShortcuts"] in configBE.tablesUFN: - iSht = configBE.tablesUFN.index(config.conf["brailleExtender"]["inputTableShortcuts"]) + 1 + if config.conf["brailleExtender"]["inputTableShortcuts"] in addoncfg.tablesUFN: + iSht = addoncfg.tablesUFN.index(config.conf["brailleExtender"]["inputTableShortcuts"]) + 1 else: iSht = 0 sHelper = gui.guiHelper.BoxSizerHelper(self, sizer=settingsSizer) bHelper1 = gui.guiHelper.ButtonHelper(orientation=wx.HORIZONTAL) @@ -353,17 +353,17 @@ def makeSettings(self, settingsSizer): self.inputTableShortcuts = sHelper.addLabeledControl(_("Input braille table for &keyboard shortcut keys:"), wx.Choice, choices=lt) self.inputTableShortcuts.SetSelection(iSht) lt = [_('None')] - for table in configBE.tables: + for table in addoncfg.tables: if table.output: lt.append(table[1]) self.postTable = sHelper.addLabeledControl(_("&Secondary output table:"), wx.Choice, choices=lt) - self.postTable.SetSelection(configBE.tablesFN.index(config.conf["brailleExtender"]["postTable"]) if config.conf["brailleExtender"]["postTable"] in configBE.tablesFN else 0) + self.postTable.SetSelection(addoncfg.tablesFN.index(config.conf["brailleExtender"]["postTable"]) if config.conf["brailleExtender"]["postTable"] in addoncfg.tablesFN else 0) # Translators: label of a dialog. self.tabSpace = sHelper.addItem(wx.CheckBox(self, label=_("Display &tabs as spaces"))) self.tabSpace.SetValue(config.conf["brailleExtender"]["tabSpace"]) # Translators: label of a dialog. - self.tabSize = sHelper.addLabeledControl(_("&Spaces per tab for the active braille display:"), gui.nvdaControls.SelectOnFocusSpinCtrl, min=1, max=42, initial=int(config.conf["brailleExtender"]["tabSize_%s" % configBE.curBD])) + self.tabSize = sHelper.addLabeledControl(_("&Spaces per tab for the active braille display:"), gui.nvdaControls.SelectOnFocusSpinCtrl, min=1, max=42, initial=int(config.conf["brailleExtender"]["tabSize_%s" % addoncfg.curBD])) self.customBrailleTablesBtn = bHelper1.addButton(self, wx.NewId(), _("Alternative and &custom braille tables..."), wx.DefaultPosition) self.customBrailleTablesBtn.Bind(wx.EVT_BUTTON, self.onCustomBrailleTablesBtn) sHelper.addItem(bHelper1) @@ -373,16 +373,16 @@ def postInit(self): self.tables.SetFocus() def onSave(self): config.conf["brailleExtender"]["outputTables"] = ','.join(self.oTables) config.conf["brailleExtender"]["inputTables"] = ','.join(self.iTables) - config.conf["brailleExtender"]["inputTableShortcuts"] = configBE.tablesUFN[self.inputTableShortcuts.GetSelection()-1] if self.inputTableShortcuts.GetSelection()>0 else '?' - configBE.loadPreferedTables() + config.conf["brailleExtender"]["inputTableShortcuts"] = addoncfg.tablesUFN[self.inputTableShortcuts.GetSelection() - 1] if self.inputTableShortcuts.GetSelection() > 0 else '?' + addoncfg.loadPreferedTables() postTableID = self.postTable.GetSelection() - postTable = "None" if postTableID == 0 else configBE.tablesFN[postTableID] + postTable = "None" if postTableID == 0 else addoncfg.tablesFN[postTableID] config.conf["brailleExtender"]["postTable"] = postTable if self.tabSpace.IsChecked() and config.conf["brailleExtender"]["tabSpace"] != self.tabSpace.IsChecked(): restartRequired = True else: restartRequired = False config.conf["brailleExtender"]["tabSpace"] = self.tabSpace.IsChecked() - config.conf["brailleExtender"]["tabSize_%s" % configBE.curBD] = self.tabSize.Value + config.conf["brailleExtender"]["tabSize_%s" % addoncfg.curBD] = self.tabSize.Value if restartRequired: res = gui.messageBox( _("NVDA must be restarted for changes to take effect. Would you like to restart now?"), @@ -393,13 +393,13 @@ def onSave(self): def getTablesWithSwitches(self): out = [] - for i, tbl in enumerate(configBE.tablesTR): - out.append("%s%s: %s" % (tbl, punctuationSeparator, self.getInSwitchesText(configBE.tablesFN[i]))) + for i, tbl in enumerate(addoncfg.tablesTR): + out.append("%s%s: %s" % (tbl, punctuationSeparator, self.getInSwitchesText(addoncfg.tablesFN[i]))) return out def getCurrentSelection(self): idx = self.tables.GetSelection() - tbl = configBE.tablesFN[self.tables.GetSelection()] + tbl = addoncfg.tablesFN[self.tables.GetSelection()] return idx, tbl def setCurrentSelection(self, tbl, newLoc): @@ -457,7 +457,7 @@ def onTables(self, evt): queueHandler.queueFunction(queueHandler.eventQueue, ui.message, "%s" % tbl) else: ui.browseableMessage('\n'.join([ - _("Table name: %s") % configBE.tablesTR[idx], + _("Table name: %s") % addoncfg.tablesTR[idx], _("File name: %s") % tbl, _("In switches: %s") % self.getInSwitchesText(tbl) ]), _("About this table"), False) @@ -472,7 +472,7 @@ def onTables(self, evt): elif keycode == wx.WXK_RIGHT: self.changeSwitch(tbl, 1, False) elif keycode == wx.WXK_SPACE: self.changeSwitch(tbl, 1, True) newSwitch = self.getInSwitchesText(tbl) - self.tables.SetString(self.tables.GetSelection(), "%s%s: %s" % (configBE.tablesTR[idx], punctuationSeparator, newSwitch)) + self.tables.SetString(self.tables.GetSelection(), "%s%s: %s" % (addoncfg.tablesTR[idx], punctuationSeparator, newSwitch)) queueHandler.queueFunction(queueHandler.eventQueue, ui.message, "%s" % newSwitch) utils.refreshBD() else: evt.Skip() @@ -482,8 +482,8 @@ class CustomBrailleTablesDlg(gui.settingsDialogs.SettingsDialog): # Translators: title of a dialog. title = "Braille Extender - %s" % _("Custom braille tables") - providedTablesPath = "%s/res/brailleTables.json" % configBE.baseDir - userTablesPath = "%s/brailleTables.json" % configBE.configDir + providedTablesPath = "%s/res/brailleTables.json" % addoncfg.baseDir + userTablesPath = "%s/brailleTables.json" % addoncfg.configDir def makeSettings(self, settingsSizer): self.providedTables = self.getBrailleTablesFromJSON(self.providedTablesPath) @@ -500,7 +500,7 @@ def makeSettings(self, settingsSizer): @staticmethod def getBrailleTablesFromJSON(path): if not os.path.exists(path): - path = "%s/%s" % (configBE.baseDir, path) + path = "%s/%s" % (addoncfg.baseDir, path) if not os.path.exists(path): return {} f = open(path) return json.load(f) @@ -568,11 +568,11 @@ def onOk(self, event): @staticmethod def getAvailableBrailleTables(): out = [] - brailleTablesDir = configBE.brailleTables.TABLES_DIR + brailleTablesDir = addoncfg.brailleTables.TABLES_DIR ls = glob.glob(brailleTablesDir+'\\*.ctb')+glob.glob(brailleTablesDir+'\\*.cti')+glob.glob(brailleTablesDir+'\\*.utb') for i, e in enumerate(ls): e = str(e.split('\\')[-1]) - if e in configBE.tablesFN or e.lower() in configBE.tablesFN: del ls[i] + if e in addoncfg.tablesFN or e.lower() in addoncfg.tablesFN: del ls[i] else: out.append(e.lower()) out = sorted(out) return out @@ -632,7 +632,7 @@ def getCaptured(gesture): return False if gesture.isModifier: return False if gesture.normalizedIdentifiers[0].startswith("kb") and not gesture.normalizedIdentifiers[0].endswith(":escape"): - queueHandler.queueFunction(queueHandler.eventQueue, ui.message, _(f"Please enter a gesture from your {configBE.curBD} braille display. Press space to cancel.")) + queueHandler.queueFunction(queueHandler.eventQueue, ui.message, _(f"Please enter a gesture from your {addoncfg.curBD} braille display. Press space to cancel.")) return False if gesture.normalizedIdentifiers[0].endswith(":space"): inputCore.manager._captureFunc = None diff --git a/addon/globalPlugins/brailleExtender/dictionaries.py b/addon/globalPlugins/brailleExtender/tabledictionaries.py similarity index 98% rename from addon/globalPlugins/brailleExtender/dictionaries.py rename to addon/globalPlugins/brailleExtender/tabledictionaries.py index 4e864070..c357da55 100644 --- a/addon/globalPlugins/brailleExtender/dictionaries.py +++ b/addon/globalPlugins/brailleExtender/tabledictionaries.py @@ -1,4 +1,4 @@ -# dictionaries.py +# tabledictionaries.py # Part of BrailleExtender addon for NVDA # Copyright 2016-2020 André-Abush CLAUSE, released under GPL. @@ -15,7 +15,7 @@ import louis from collections import namedtuple -from . import configBE +from . import addoncfg from .common import * from . import huc @@ -291,7 +291,7 @@ def __init__(self, parent=None, title=_("Edit Dictionary Entry"), textPattern='' if specifyDict: # Translators: This is a label for an edit field in add dictionary entry dialog. dictText = _("Dictionary") - outTable = configBE.tablesTR[configBE.tablesFN.index(config.conf["braille"]["translationTable"])] + outTable = addoncfg.tablesTR[addoncfg.tablesFN.index(config.conf["braille"]["translationTable"])] dictChoices = [_("Global"), _("Table ({})").format(outTable), _("Temporary")] self.dictRadioBox = sHelper.addItem(wx.RadioBox(self, label=dictText, choices=dictChoices)) self.dictRadioBox.SetSelection(1) @@ -337,7 +337,7 @@ def __init__(self, parent=None, title=_("Edit Dictionary Entry"), textPattern='' def onSeeEntriesClick(self, evt): - outTable = configBE.tablesTR[configBE.tablesFN.index(config.conf["braille"]["translationTable"])] + outTable = addoncfg.tablesTR[addoncfg.tablesFN.index(config.conf["braille"]["translationTable"])] label = [_("Global dictionary"), _("Table dictionary ({})").format(outTable), _("Temporary dictionary")][self.dictRadioBox.GetSelection()] type_ = self.getType_() self.Destroy() diff --git a/addon/globalPlugins/brailleExtender/undefinedChars.py b/addon/globalPlugins/brailleExtender/undefinedchars.py similarity index 96% rename from addon/globalPlugins/brailleExtender/undefinedChars.py rename to addon/globalPlugins/brailleExtender/undefinedchars.py index 5fb31f27..fe0489ac 100644 --- a/addon/globalPlugins/brailleExtender/undefinedChars.py +++ b/addon/globalPlugins/brailleExtender/undefinedchars.py @@ -1,4 +1,4 @@ -# undefinedChars.py +# undefinedchars.py # Part of BrailleExtender addon for NVDA # Copyright 2016-2020 André-Abush CLAUSE, released under GPL. import re @@ -11,10 +11,10 @@ import gui import louis -from . import configBE, huc +from . import addoncfg, huc from .common import * from .utils import getCurrentBrailleTables, getTextInBraille -from . import brailleRegionHelper +from . import regionhelper addonHandler.initTranslation() @@ -193,7 +193,7 @@ def getReplacement(text, method=None): def undefinedCharProcess(self): - Repl = brailleRegionHelper.BrailleCellReplacement + Repl = regionhelper.BrailleCellReplacement fullExtendedDesc = config.conf["brailleExtender"]["undefinedCharsRepr"]["fullExtendedDesc"] startTag = config.conf["brailleExtender"]["undefinedCharsRepr"]["start"] endTag = config.conf["brailleExtender"]["undefinedCharsRepr"]["end"] @@ -203,7 +203,7 @@ def undefinedCharProcess(self): endTag = getTextInBraille(endTag) lang = config.conf["brailleExtender"]["undefinedCharsRepr"]["lang"] table = [config.conf["brailleExtender"]["undefinedCharsRepr"]["table"]] - undefinedCharsPos = [e for e in brailleRegionHelper.findBrailleCellsPattern( + undefinedCharsPos = [e for e in regionhelper.findBrailleCellsPattern( self, undefinedCharPattern)] extendedSymbolsRawText = {} if config.conf["brailleExtender"]["undefinedCharsRepr"]["desc"] and config.conf["brailleExtender"]["undefinedCharsRepr"]["extendedDesc"]: @@ -227,7 +227,7 @@ def undefinedCharProcess(self): for pos in undefinedCharsPos] + replacements if not replacements: return - brailleRegionHelper.replaceBrailleCells(self, replacements) + regionhelper.replaceBrailleCells(self, replacements) class SettingsDlg(gui.settingsDialogs.SettingsPanel): @@ -309,15 +309,15 @@ def makeSettings(self, settingsSizer): ) self.undefinedCharLang.SetSelection(undefinedCharLangID) values = [_("Use the current output table")] + [ - table.displayName for table in configBE.tables if table.output + table.displayName for table in addoncfg.tables if table.output ] keys = ["current"] + [ - table.fileName for table in configBE.tables if table.output + table.fileName for table in addoncfg.tables if table.output ] undefinedCharTable = config.conf["brailleExtender"]["undefinedCharsRepr"][ "table" ] - if undefinedCharTable not in configBE.tablesFN + ["current"]: + if undefinedCharTable not in addoncfg.tablesFN + ["current"]: undefinedCharTable = "current" undefinedCharTableID = keys.index(undefinedCharTable) self.undefinedCharTable = sHelper.addLabeledControl( @@ -409,7 +409,7 @@ def onSave(self): ] undefinedCharTable = self.undefinedCharTable.GetSelection() keys = ["current"] + [ - table.fileName for table in configBE.tables if table.output + table.fileName for table in addoncfg.tables if table.output ] config.conf["brailleExtender"]["undefinedCharsRepr"]["table"] = keys[ undefinedCharTable diff --git a/addon/globalPlugins/brailleExtender/updateCheck.py b/addon/globalPlugins/brailleExtender/updatecheck.py similarity index 99% rename from addon/globalPlugins/brailleExtender/updateCheck.py rename to addon/globalPlugins/brailleExtender/updatecheck.py index 724dd328..afaff6c7 100644 --- a/addon/globalPlugins/brailleExtender/updateCheck.py +++ b/addon/globalPlugins/brailleExtender/updatecheck.py @@ -1,4 +1,4 @@ -# updateCheck.py +# updatecheck.py # Part of BrailleExtender addon for NVDA # Copyright 2020 André-Abush Clause, released under GPL. diff --git a/addon/globalPlugins/brailleExtender/utils.py b/addon/globalPlugins/brailleExtender/utils.py index cd885588..02e8af1d 100644 --- a/addon/globalPlugins/brailleExtender/utils.py +++ b/addon/globalPlugins/brailleExtender/utils.py @@ -22,14 +22,14 @@ addonHandler.initTranslation() import treeInterceptorHandler import unicodedata -from .configBE import CHOICE_braille,CHOICE_speech , CHOICE_speechAndBraille +from .addoncfg import CHOICE_braille,CHOICE_speech , CHOICE_speechAndBraille from .common import INSERT_AFTER, INSERT_BEFORE, REPLACE_TEXT, baseDir from . import huc -from . import dictionaries -from . import volume_helper +from . import tabledictionaries +from . import volumehelper -get_mute = volume_helper.get_mute -get_volume_level = volume_helper.get_volume_level +get_mute = volumehelper.get_mute +get_volume_level = volumehelper.get_volume_level def report_volume_level(): @@ -330,7 +330,7 @@ def getCurrentBrailleTables(input_=False, brf=False): else: tables = [] app = appModuleHandler.getAppModuleForNVDAObject(api.getNavigatorObject()) - if brailleInput.handler._table.fileName == config.conf["braille"]["translationTable"] and app and app.appName != "nvda": tables += dictionaries.dictTables + if brailleInput.handler._table.fileName == config.conf["braille"]["translationTable"] and app and app.appName != "nvda": tables += tabledictionaries.dictTables if input_: mainTable = os.path.join(brailleTables.TABLES_DIR, brailleInput.handler._table.fileName) else: mainTable = os.path.join(brailleTables.TABLES_DIR, config.conf["braille"]["translationTable"]) tables += [ diff --git a/addon/globalPlugins/brailleExtender/volume_helper.py b/addon/globalPlugins/brailleExtender/volumehelper.py similarity index 99% rename from addon/globalPlugins/brailleExtender/volume_helper.py rename to addon/globalPlugins/brailleExtender/volumehelper.py index 070f93c8..baeaeddf 100644 --- a/addon/globalPlugins/brailleExtender/volume_helper.py +++ b/addon/globalPlugins/brailleExtender/volumehelper.py @@ -1,4 +1,4 @@ -# volume_helper.py +# volumehelper.py # Borrowed from Tim Roberts => See https://mail.python.org/pipermail/python-win32/2014-March/013080.html from comtypes import * import comtypes.client