Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions source/NVDAObjects/IAccessible/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
from logHandler import log
import speech
import braille
import braille.regions.properties
import api
import config
import controlTypes
Expand Down Expand Up @@ -2037,7 +2038,9 @@ def event_alert(self) -> None:
if self in api.getFocusAncestors():
return
speech.speakObject(self, reason=controlTypes.OutputReason.FOCUS, priority=speech.Spri.NOW)
braille.handler.message(braille.getPropertiesBraille(name=self.name, role=self.role))
braille.handler.message(
braille.regions.properties.getPropertiesBraille(name=self.name, role=self.role),
)
hasDescription = bool(self.description)
for child in self.recursiveDescendants:
isFocusable = controlTypes.State.FOCUSABLE in child.states
Expand All @@ -2060,7 +2063,9 @@ def event_alert(self) -> None:
)
if shouldSpeak:
speech.speakObject(child, reason=controlTypes.OutputReason.FOCUS, priority=speech.Spri.NOW)
braille.handler.message(braille.getPropertiesBraille(name=self.name, role=self.role))
braille.handler.message(
braille.regions.properties.getPropertiesBraille(name=self.name, role=self.role),
)

def event_caret(self):
focus = api.getFocusObject()
Expand Down
3 changes: 2 additions & 1 deletion source/NVDAObjects/UIA/VisualStudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from . import UIA, ToolTip
import speech
import braille
import braille.regions.properties
import api
import time

Expand All @@ -28,7 +29,7 @@ def event_UIA_elementSelected(self):
self.reportFocus()
# Display results as flash messages.
braille.handler.message(
braille.getPropertiesBraille(
braille.regions.properties.getPropertiesBraille(
name=self.name,
role=self.role,
positionInfo=self.positionInfo,
Expand Down
5 changes: 4 additions & 1 deletion source/NVDAObjects/UIA/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
ToolTip,
)
import braille
import braille.regions.properties
import locationHelper
import ui
import winVersion
Expand Down Expand Up @@ -2466,7 +2467,9 @@ def event_UIA_systemAlert(self):
"""
speech.speakObject(self, reason=controlTypes.OutputReason.FOCUS)
# Ideally, we wouldn't use getPropertiesBraille directly.
braille.handler.message(braille.getPropertiesBraille(name=self.name, role=self.role))
braille.handler.message(
braille.regions.properties.getPropertiesBraille(name=self.name, role=self.role),
)

def event_UIA_notification(
self,
Expand Down
8 changes: 5 additions & 3 deletions source/NVDAObjects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
TreeInterceptor,
)
import braille
import braille.labels
import braille.regions.properties
from utils.security import _isObjectBelowLockScreen
import vision
import globalPluginHandler
Expand Down Expand Up @@ -517,8 +519,8 @@ def _get_roleTextBraille(self):
which will override the standard label for this object's role property as well as the value of roleText.
By default, NVDA falls back to using roleText.
"""
if self.landmark and self.landmark in braille.landmarkLabels:
return f"{braille.roleLabels[controlTypes.Role.LANDMARK]} {braille.landmarkLabels[self.landmark]}"
if self.landmark and self.landmark in braille.labels.landmarkLabels:
return f"{braille.labels.roleLabels[controlTypes.Role.LANDMARK]} {braille.labels.landmarkLabels[self.landmark]}"
return self.roleText

#: Typing information for auto property _get_value
Expand Down Expand Up @@ -1333,7 +1335,7 @@ def event_selection(self):
self.reportFocus()
# Display results as flash messages.
braille.handler.message(
braille.getPropertiesBraille(
braille.regions.properties.getPropertiesBraille(
name=self.name,
role=self.role,
positionInfo=self.positionInfo,
Expand Down
9 changes: 7 additions & 2 deletions source/NVDAObjects/behaviors.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import api
import ui
import braille
import braille.regions.properties
import core
import nvwave
import globalVars
Expand Down Expand Up @@ -1026,7 +1027,9 @@ def event_show(self):
return
speech.speakObject(self, reason=controlTypes.OutputReason.FOCUS)
# Ideally, we wouldn't use getPropertiesBraille directly.
braille.handler.message(braille.getPropertiesBraille(name=self.name, role=self.role))
braille.handler.message(
braille.regions.properties.getPropertiesBraille(name=self.name, role=self.role),
)


class Notification(NVDAObject):
Expand All @@ -1040,7 +1043,9 @@ def event_alert(self):
return
speech.speakObject(self, reason=controlTypes.OutputReason.FOCUS)
# Ideally, we wouldn't use getPropertiesBraille directly.
braille.handler.message(braille.getPropertiesBraille(name=self.name, role=self.role))
braille.handler.message(
braille.regions.properties.getPropertiesBraille(name=self.name, role=self.role),
)

event_show = event_alert

Expand Down
3 changes: 2 additions & 1 deletion source/_remoteClient/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import api
import baseObject
import braille
import braille.display.gesture
import brailleInput
import globalPluginHandler
import scriptHandler
Expand All @@ -28,7 +29,7 @@ class VKMapType(IntEnum):
"""Maps a virtual key code to a scan code."""


class BrailleInputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
class BrailleInputGesture(braille.display.gesture.BrailleDisplayGesture, brailleInput.BrailleInputGesture):
Comment thread
SaschaCowley marked this conversation as resolved.
Dismissed
def __init__(self, **kwargs):
super().__init__()
# Normalize legacy routingIndex field into cellIndexes before assignment
Expand Down
12 changes: 8 additions & 4 deletions source/_remoteClient/localMachine.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import winBindings.sas
import api
import braille
import braille.display
import braille.extensions
from config.registry import RegistryKey
import inputCore
Expand Down Expand Up @@ -139,7 +140,7 @@ def __init__(self) -> None:
self._lastCells: list[int] = []
"""Cached cells for display when we return from controling the local computer, or displaying a `ui.message`."""

braille.decide_enabled.register(self.handleDecideEnabled)
braille.extensions.decide_enabled.register(self.handleDecideEnabled)
braille.extensions._pre_showBrailleMessage.register(self._handleShowBrailleMessage)
braille.extensions._post_dismissBrailleMessage.register(self._handleDismissBrailleMessage)
braille.extensions._decide_disabledIncludesMessages.register(
Expand All @@ -152,7 +153,7 @@ def terminate(self) -> None:
:note: Unregisters the braille display handler to prevent memory leaks and
ensure proper cleanup when the remote connection ends.
"""
braille.decide_enabled.unregister(self.handleDecideEnabled)
braille.extensions.decide_enabled.unregister(self.handleDecideEnabled)
braille.extensions._pre_showBrailleMessage.unregister(self._handleShowBrailleMessage)
braille.extensions._post_dismissBrailleMessage.unregister(self._handleDismissBrailleMessage)
braille.extensions._decide_disabledIncludesMessages.unregister(
Expand Down Expand Up @@ -274,7 +275,10 @@ def setBrailleDisplaySize(self, sizes: list[int]) -> None:
"""
self._cachedSizes = sizes

def _handleFilterDisplayDimensions(self, value: braille.DisplayDimensions) -> braille.DisplayDimensions:
def _handleFilterDisplayDimensions(
self,
value: braille.display.DisplayDimensions,
) -> braille.display.DisplayDimensions:
"""Filter the local display dimensions based on remote display dimensions.

Determines the optimal display dimensions when sharing braille output by
Expand All @@ -294,7 +298,7 @@ def _handleFilterDisplayDimensions(self, value: braille.DisplayDimensions) -> br
# There is no point storing the number of rows if we are always going to set it to 1.
sizes = self._cachedSizes + [value.numCols]
try:
return braille.DisplayDimensions(numRows=1, numCols=min(i for i in sizes if i > 0))
return braille.display.DisplayDimensions(numRows=1, numCols=min(i for i in sizes if i > 0))
except ValueError:
return value._replace(numRows=1)

Expand Down
29 changes: 18 additions & 11 deletions source/_remoteClient/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@
from typing import Any, Final

import braille
import braille.display
import braille.display.driver
import braille.display.gesture
import braille.extensions
import brailleInput
import gui
import inputCore
Expand Down Expand Up @@ -316,7 +320,7 @@ def __init__(
RemoteMessageType.SET_DISPLAY_SIZE,
self.setDisplaySize,
)
braille.filter_displayDimensions.register(
braille.extensions.filter_displayDimensions.register(
self.localMachine._handleFilterDisplayDimensions,
)
self.transport.registerInbound(
Expand All @@ -341,7 +345,7 @@ def registerCallbacks(self) -> None:
)
self.transport.registerOutbound(decide_playWaveFile, RemoteMessageType.WAVE)
self.transport.registerOutbound(post_speechPaused, RemoteMessageType.PAUSE_SPEECH)
braille.pre_writeCells.register(self.display)
braille.extensions.pre_writeCells.register(self.display)
pre_speechQueued.register(self.sendSpeech)
self.callbacksAdded = True

Expand All @@ -352,7 +356,7 @@ def unregisterCallbacks(self) -> None:
self.transport.unregisterOutbound(RemoteMessageType.CANCEL)
self.transport.unregisterOutbound(RemoteMessageType.WAVE)
self.transport.unregisterOutbound(RemoteMessageType.PAUSE_SPEECH)
braille.pre_writeCells.unregister(self.display)
braille.extensions.pre_writeCells.unregister(self.display)
pre_speechQueued.unregister(self.sendSpeech)
self.callbacksAdded = False

Expand Down Expand Up @@ -535,15 +539,15 @@ def __init__(
def registerCallbacks(self) -> None:
if self.callbacksAdded:
return
braille.displayChanged.register(self.sendBrailleInfo)
braille.displaySizeChanged.register(self.sendBrailleInfo)
braille.extensions.displayChanged.register(self.sendBrailleInfo)
braille.extensions.displaySizeChanged.register(self.sendBrailleInfo)
self.callbacksAdded = True

def unregisterCallbacks(self) -> None:
if not self.callbacksAdded:
return
braille.displayChanged.unregister(self.sendBrailleInfo)
braille.displaySizeChanged.unregister(self.sendBrailleInfo)
braille.extensions.displayChanged.unregister(self.sendBrailleInfo)
braille.extensions.displaySizeChanged.unregister(self.sendBrailleInfo)
self.callbacksAdded = False

def handleNVDANotConnected(self) -> None:
Expand Down Expand Up @@ -590,8 +594,8 @@ def handleClientDisconnected(self, client: dict[str, Any] | None = None):

def sendBrailleInfo(
self,
display: braille.BrailleDisplayDriver | None = None,
displayDimensions: braille.DisplayDimensions | None = None,
display: braille.display.driver.BrailleDisplayDriver | None = None,
displayDimensions: braille.display.DisplayDimensions | None = None,
) -> None:
if display is None:
display = braille.handler.display
Expand All @@ -607,7 +611,7 @@ def sendBrailleInfo(

def handleDecideExecuteGesture(
self,
gesture: braille.BrailleDisplayGesture | brailleInput.BrailleInputGesture,
gesture: braille.display.gesture.BrailleDisplayGesture | brailleInput.BrailleInputGesture,
) -> bool:
"""Handle and forward braille gestures to remote client.

Expand All @@ -618,7 +622,10 @@ def handleDecideExecuteGesture(
# Import late to avoid circular import
from globalCommands import commands

if isinstance(gesture, (braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture)):
if isinstance(
gesture,
(braille.display.gesture.BrailleDisplayGesture, brailleInput.BrailleInputGesture),
):
if self.localMachine._showingLocalUiMessage and gesture.script in (
commands.script_braille_routeTo,
commands.script_braille_scrollBack,
Expand Down
3 changes: 2 additions & 1 deletion source/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import controlTypes
import eventHandler
import braille
import braille.regions.focus
import vision
import watchdog
import exceptions
Expand Down Expand Up @@ -184,7 +185,7 @@ def setFocusObject(obj: NVDAObjects.NVDAObject) -> bool: # noqa: C901
globalVars.focusDifferenceLevel = focusDifferenceLevel
globalVars.focusObject = obj
globalVars.focusAncestors = ancestors
braille.invalidateCachedFocusAncestors(focusDifferenceLevel)
braille.regions.focus.invalidateCachedFocusAncestors(focusDifferenceLevel)
if config.conf["reviewCursor"]["followFocus"]:
setNavigatorObject(obj, isFocus=True)
# Fire focusExited event for all old focus ancestors not common with the new focus
Expand Down
3 changes: 2 additions & 1 deletion source/appModules/eclipse.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from NVDAObjects.behaviors import EditableTextWithSuggestions
import speech
import braille
import braille.regions.properties
import ui
import api
from speech import sayAll
Expand Down Expand Up @@ -155,7 +156,7 @@ def event_selection(self):
# Simply calling `reportFocus` doesn't output the text in braille
# and reporting with `ui.message` needs an extra translation string when reporting position info
braille.handler.message(
braille.getPropertiesBraille(
braille.regions.properties.getPropertiesBraille(
name=self.name,
role=self.role,
positionInfo=self.positionInfo,
Expand Down
3 changes: 2 additions & 1 deletion source/appModules/explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import api
import speech
import braille
import braille.regions.properties
import eventHandler
import mouseHandler
from NVDAObjects import NVDAObject
Expand Down Expand Up @@ -506,7 +507,7 @@ def event_UIA_elementSelected(self, obj: NVDAObject, nextHandler: Callable[[], N
):
speech.speakObject(obj, reason=controlTypes.OutputReason.FOCUS)
braille.handler.message(
braille.getPropertiesBraille(
braille.regions.properties.getPropertiesBraille(
name=obj.name,
role=obj.role,
states=obj.states,
Expand Down
3 changes: 2 additions & 1 deletion source/appModules/logonui.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import speech
import api
import braille
import braille.regions.focus
import controlTypes
from NVDAObjects.IAccessible import IAccessible
from NVDAObjects.behaviors import Dialog
Expand Down Expand Up @@ -124,5 +125,5 @@ def event_gainFocus(self, obj, nextHandler):
role=True,
description=True,
)
braille.invalidateCachedFocusAncestors(1)
braille.regions.focus.invalidateCachedFocusAncestors(1)
nextHandler()
3 changes: 2 additions & 1 deletion source/appModules/notepad.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import appModuleHandler
import api
import braille
import braille.regions.properties
import controlTypes
import eventHandler
import speech
Expand All @@ -32,7 +33,7 @@ def event_UIA_elementSelected(self, obj: NVDAObject, nextHandler: Callable[[], N
speech.cancelSpeech()
speech.speakObject(obj, reason=controlTypes.OutputReason.FOCUS)
braille.handler.message(
braille.getPropertiesBraille(
braille.regions.properties.getPropertiesBraille(
name=obj.name,
role=obj.role,
states=obj.states,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import eventHandler
import speech
import braille
import braille.regions.properties
import ui
import config
import winVersion
Expand Down Expand Up @@ -226,7 +227,7 @@ def event_UIA_elementSelected(self, obj: NVDAObject, nextHandler: Callable[[], N
if obj is not None and api.setNavigatorObject(obj):
obj.reportFocus()
braille.handler.message(
braille.getPropertiesBraille(
braille.regions.properties.getPropertiesBraille(
name=obj.name,
role=obj.role,
positionInfo=obj.positionInfo,
Expand Down
Loading