Skip to content

Commit 1e28323

Browse files
committed
Merge branch 'master' into tables
2 parents 26166c8 + b60d100 commit 1e28323

21 files changed

Lines changed: 699 additions & 693 deletions

addon/globalPlugins/brailleExtender/__init__.py

Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
# coding: utf-8
12
# BrailleExtender Addon for NVDA
23
# This file is covered by the GNU General Public License.
34
# See the file LICENSE for more details.
4-
# Copyright (C) 2016-2020 André-Abush Clause <dev@andreabc.net>
5+
# Copyright (C) 2016-2023 André-Abush Clause <dev@andreabc.net>
56
#
67
# Additional third party copyrighted code is included:
78
# - *Attribra*: Copyright (C) 2017 Alberto Zanella <lapostadialberto@gmail.com>
@@ -168,8 +169,6 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
168169
noKC = None
169170
backupInputTable = brailleInput.handler.table
170171
backupMessageTimeout = None
171-
backupTether = utils.getTether()
172-
switchedMode = False
173172

174173
def __init__(self):
175174
startTime = time.time()
@@ -217,32 +216,13 @@ def event_gainFocus(self, obj, nextHandler):
217216
rotorItem = 0
218217
self.bindRotorGES()
219218

220-
if config.conf["brailleExtender"]["reviewModeTerminal"]:
221-
if not self.switchedMode and obj.role == utils.get_control_type("ROLE_TERMINAL") and obj.hasFocus:
222-
if not hasattr(braille.handler, "TETHER_AUTO"):
223-
self.backupTether = utils.getTether()
224-
braille.handler.tether = braille.handler.TETHER_REVIEW
225-
else:
226-
if config.conf["braille"]["autoTether"]:
227-
self.backupTether = braille.handler.TETHER_AUTO
228-
config.conf["braille"]["autoTether"] = False
229-
else:
230-
self.backupTether = utils.getTether()
231-
braille.handler.setTether(braille.handler.TETHER_REVIEW, auto=False)
232-
braille.handler.handleReviewMove(shouldAutoTether=False)
233-
self.switchedMode = True
234-
elif self.switchedMode and obj.role != utils.get_control_type("ROLE_TERMINAL"): self.restorReviewCursorTethering()
235-
236219
if "tabSize_%s" % addoncfg.curBD not in config.conf["brailleExtender"]["tables"].copy().keys(): self.onReload(None, 1)
237220
if self.hourDatePlayed: self.script_hourDate(None)
238221
if self.autoTestPlayed: self.script_autoTest(None)
239222
if braille.handler is not None and addoncfg.curBD != braille.handler.display.name:
240223
addoncfg.curBD = braille.handler.display.name
241224
self.onReload(None, 1)
242-
243-
244225
nextHandler()
245-
return
246226

247227
def event_foreground(self, obj, nextHandler):
248228
if braille.handler._auto_scroll:
@@ -318,27 +298,6 @@ def onTableDictionary(evt):
318298
def onTemporaryDictionary(evt):
319299
gui.mainFrame._popupSettingsDialog(tabledictionaries.DictionaryDlg, _("Temporary dictionary"), "tmp")
320300

321-
def restorReviewCursorTethering(self):
322-
if not self.switchedMode: return
323-
if not hasattr(braille.handler, "TETHER_AUTO"):
324-
braille.handler.tether = self.backupTether
325-
else:
326-
if self.backupTether == braille.handler.TETHER_AUTO:
327-
config.conf["braille"]["autoTether"] = True
328-
config.conf["braille"]["tetherTo"] = braille.handler.TETHER_FOCUS
329-
else:
330-
config.conf["braille"]["autoTether"] = False
331-
braille.handler.setTether(self.backupTether, auto=False)
332-
if self.backupTether == braille.handler.TETHER_REVIEW:
333-
braille.handler.handleReviewMove(shouldAutoTether=False)
334-
else:
335-
focus = api.getFocusObject()
336-
if focus.treeInterceptor and not focus.treeInterceptor.passThrough:
337-
braille.handler.handleGainFocus(focus.treeInterceptor,shouldAutoTether=False)
338-
else:
339-
braille.handler.handleGainFocus(focus,shouldAutoTether=False)
340-
self.switchedMode = False
341-
342301
def getGestureWithBrailleIdentifier(self, gesture = ''):
343302
return ("br(%s):" % addoncfg.curBD if ':' not in gesture else '') + gesture
344303

@@ -1297,23 +1256,18 @@ def script_toggleSpeechHistoryMode(self, gesture):
12971256
__gestures["kb:shift+NVDA+p"] = "currentBrailleTable"
12981257
__gestures["kb:shift+NVDA+i"] = "switchInputBrailleTable"
12991258
__gestures["kb:shift+NVDA+u"] = "switchOutputBrailleTable"
1300-
__gestures["kb:shift+NVDA+y"] = "autoScroll"
1301-
__gestures["kb:nvda+k"] = "reload_brailledisplay1"
1302-
__gestures["kb:nvda+shift+k"] = "reload_brailledisplay2"
1303-
__gestures["kb:nvda+alt+h"] = "toggleDots78"
1259+
__gestures["kb:nvda+j"] = "reload_brailledisplay1"
1260+
__gestures["kb:nvda+shift+j"] = "reload_brailledisplay2"
13041261
__gestures["kb:nvda+alt+f"] = "toggleBRFMode"
13051262
__gestures["kb:nvda+windows+i"] = "advancedInput"
13061263
__gestures["kb:nvda+windows+u"] = "undefinedCharsDesc"
1307-
__gestures["kb:nvda+windows+h"] = "toggleOneHandMode"
1308-
__gestures["kb:nvda+windows+k"] = "reloadAddon"
13091264
__gestures["kb:volumeMute"] = "toggleVolume"
13101265
__gestures["kb:volumeUp"] = "volumePlus"
13111266
__gestures["kb:volumeDown"] = "volumeMinus"
13121267
__gestures["kb:nvda+alt+u"] = "translateInBRU"
13131268
__gestures["kb:nvda+alt+i"] = "charsToCellDescriptions"
13141269
__gestures["kb:nvda+alt+o"] = "cellDescriptionsToChars"
13151270
__gestures["kb:nvda+alt+y"] = "addDictionaryEntry"
1316-
__gestures["kb:nvda+shift+j"] = "toggleAttribra"
13171271

13181272
def terminate(self):
13191273
if braille.handler.getTether() == "speech":

addon/globalPlugins/brailleExtender/addoncfg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# coding: utf-8
12
# addoncfg.py
23
# Part of BrailleExtender addon for NVDA
34
# Copyright 2016-2022 André-Abush CLAUSE, released under GPL.

addon/globalPlugins/brailleExtender/addondoc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# coding: utf-8
12
# addondoc.py
23
# Part of BrailleExtender addon for NVDA
34
# Copyright 2016-2021 André-Abush CLAUSE, released under GPL.

addon/globalPlugins/brailleExtender/advancedinput.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# coding: utf-8
12
# advancedinput.py
23
# Part of BrailleExtender addon for NVDA
34
# Copyright 2016-2021 André-Abush CLAUSE, released under GPL.

addon/globalPlugins/brailleExtender/autoscroll.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# coding: utf-8
12
# autoscroll.py
23
# Part of BrailleExtender addon for NVDA
34
# Copyright 2016-2020 André-Abush CLAUSE, released under GPL.

addon/globalPlugins/brailleExtender/common.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# coding: utf-8
12
# common.py
23
# Part of BrailleExtender addon for NVDA
34
# Copyright 2016-2020 André-Abush CLAUSE, released under GPL.

addon/globalPlugins/brailleExtender/huc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env python3
2+
# coding: utf-8
23
import re
34

45
HUC6_patterns = {

addon/globalPlugins/brailleExtender/onehand.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# coding: utf-8
12
# onehand.py
23
# Part of BrailleExtender addon for NVDA
34
# Copyright 2016-2020 André-Abush CLAUSE, released under GPL.

addon/globalPlugins/brailleExtender/patches.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
# coding: utf-8
12
# patches.py
23
# Part of BrailleExtender addon for NVDA
34
# Copyright 2016-2022 André-Abush CLAUSE, released under GPL.
45
# This file modify some functions from core.
6+
# coding: utf-8
57

68
import os
79
import struct
@@ -13,6 +15,7 @@
1315
import braille
1416
import brailleInput
1517
import config
18+
import controlTypes
1619
import core
1720
import globalCommands
1821
import inputCore
@@ -559,6 +562,20 @@ def _displayWithCursor(self):
559562
cells[self._cursorPos] |= config.conf["braille"]["cursorShapeReview"]
560563
self._writeCells(cells)
561564

565+
origGetTether = braille.BrailleHandler.getTether
566+
567+
def getTetherWithRoleTerminal(self):
568+
role = None
569+
obj = api.getNavigatorObject()
570+
if obj:
571+
role = api.getNavigatorObject().role
572+
if (
573+
config.conf["brailleExtender"]["reviewModeTerminal"]
574+
and role == controlTypes.ROLE_TERMINAL
575+
):
576+
return braille.handler.TETHER_REVIEW
577+
return origGetTether(self)
578+
562579

563580
# applying patches
564581
braille.Region.update = update
@@ -588,3 +605,4 @@ def _displayWithCursor(self):
588605
braille.BrailleHandler._displayWithCursor = _displayWithCursor
589606

590607
REASON_CARET = get_output_reason("CARET")
608+
braille.BrailleHandler.getTether = getTetherWithRoleTerminal

addon/globalPlugins/brailleExtender/regionhelper.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# coding: utf-8
12
# regionhelper.py
23
# Part of BrailleExtender addon for NVDA
34
# Copyright 2016-2020 André-Abush CLAUSE, released under GPL.

0 commit comments

Comments
 (0)