-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide a more reliable solution for automatic review cursor tetherin…
…g in terminals
- Loading branch information
Showing
2 changed files
with
17 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# BrailleExtender Addon for NVDA | ||
# This file is covered by the GNU General Public License. | ||
# See the file LICENSE for more details. | ||
# Copyright (C) 2016-2020 André-Abush Clause <[email protected]> | ||
# Copyright (C) 2016-2023 André-Abush Clause <[email protected]> | ||
# | ||
# Additional third party copyrighted code is included: | ||
# - *Attribra*: Copyright (C) 2017 Alberto Zanella <[email protected]> | ||
|
@@ -168,8 +168,6 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin): | |
if not addoncfg.noUnicodeTable: | ||
backupInputTable = brailleInput.handler.table | ||
backupMessageTimeout = None | ||
backupTether = utils.getTether() | ||
switchedMode = False | ||
|
||
def __init__(self): | ||
startTime = time.time() | ||
|
@@ -216,22 +214,6 @@ def event_gainFocus(self, obj, nextHandler): | |
rotorItem = 0 | ||
self.bindRotorGES() | ||
|
||
if config.conf["brailleExtender"]["reviewModeTerminal"]: | ||
if not self.switchedMode and obj.role == utils.get_control_type("ROLE_TERMINAL") and obj.hasFocus: | ||
if not hasattr(braille.handler, "TETHER_AUTO"): | ||
self.backupTether = utils.getTether() | ||
braille.handler.tether = braille.handler.TETHER_REVIEW | ||
else: | ||
if config.conf["braille"]["autoTether"]: | ||
self.backupTether = braille.handler.TETHER_AUTO | ||
config.conf["braille"]["autoTether"] = False | ||
else: | ||
self.backupTether = utils.getTether() | ||
braille.handler.setTether(braille.handler.TETHER_REVIEW, auto=False) | ||
braille.handler.handleReviewMove(shouldAutoTether=False) | ||
self.switchedMode = True | ||
elif self.switchedMode and obj.role != utils.get_control_type("ROLE_TERMINAL"): self.restorReviewCursorTethering() | ||
|
||
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.autoTestPlayed: self.script_autoTest(None) | ||
|
@@ -240,9 +222,7 @@ def event_gainFocus(self, obj, nextHandler): | |
self.onReload(None, 1) | ||
|
||
if self.backup__brailleTableDict != config.conf["braille"]["translationTable"]: self.reloadBrailleTables() | ||
|
||
nextHandler() | ||
return | ||
|
||
def event_foreground(self, obj, nextHandler): | ||
if braille.handler._auto_scroll: | ||
|
@@ -318,27 +298,6 @@ def onTableDictionary(evt): | |
def onTemporaryDictionary(evt): | ||
gui.mainFrame._popupSettingsDialog(tabledictionaries.DictionaryDlg, _("Temporary dictionary"), "tmp") | ||
|
||
def restorReviewCursorTethering(self): | ||
if not self.switchedMode: return | ||
if not hasattr(braille.handler, "TETHER_AUTO"): | ||
braille.handler.tether = self.backupTether | ||
else: | ||
if self.backupTether == braille.handler.TETHER_AUTO: | ||
config.conf["braille"]["autoTether"] = True | ||
config.conf["braille"]["tetherTo"] = braille.handler.TETHER_FOCUS | ||
else: | ||
config.conf["braille"]["autoTether"] = False | ||
braille.handler.setTether(self.backupTether, auto=False) | ||
if self.backupTether == braille.handler.TETHER_REVIEW: | ||
braille.handler.handleReviewMove(shouldAutoTether=False) | ||
else: | ||
focus = api.getFocusObject() | ||
if focus.treeInterceptor and not focus.treeInterceptor.passThrough: | ||
braille.handler.handleGainFocus(focus.treeInterceptor,shouldAutoTether=False) | ||
else: | ||
braille.handler.handleGainFocus(focus,shouldAutoTether=False) | ||
self.switchedMode = False | ||
|
||
def getGestureWithBrailleIdentifier(self, gesture = ''): | ||
return ("br(%s):" % addoncfg.curBD if ':' not in gesture else '') + gesture | ||
|
||
|
@@ -1278,7 +1237,6 @@ def terminate(self): | |
braille.TextInfoRegion.update = self.backup__update | ||
braille.TextInfoRegion._getTypeformFromFormatField = self.backup__getTypeformFromFormatField | ||
self.removeMenu() | ||
self.restorReviewCursorTethering() | ||
rolelabels.discardRoleLabels() | ||
if addoncfg.noUnicodeTable: | ||
brailleInput.handler.table = self.backupInputTable | ||
|
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