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: 4 additions & 5 deletions source/_magnifier/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def toggleMagnifier() -> None:
"""Toggle the NVDA magnifier on/off"""
import screenCurtain

magnifier: Magnifier = getMagnifier()
magnifier: Magnifier | None = getMagnifier()
if magnifier and magnifier._isActive:
# Stop magnifier
terminate()
Expand All @@ -102,10 +102,9 @@ def toggleMagnifier() -> None:
"Cannot start magnifier: Screen Curtain is active. Please disable Screen Curtain first.",
),
)
return
else:
initialize()
filter = getFilter()
currentFilter = getFilter()
magnifiedView = getMagnifiedView()
zoomLevel = getZoomLevelString()
if magnifiedView == MagnifiedView.FULLSCREEN:
Expand All @@ -117,7 +116,7 @@ def toggleMagnifier() -> None:
).format(
magnifiedView=magnifiedView.displayString,
zoomLevel=zoomLevel,
filter=filter.displayString,
filter=currentFilter.displayString,
fullscreenMode=fullscreenMode.displayString,
)
else:
Expand All @@ -128,7 +127,7 @@ def toggleMagnifier() -> None:
).format(
magnifiedView=magnifiedView.displayString,
zoomLevel=zoomLevel,
filter=filter.displayString,
filter=currentFilter.displayString,
)
ui.message(msg)

Expand Down
14 changes: 8 additions & 6 deletions source/_magnifier/fullscreenMagnifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
Full-screen magnifier module.
"""

from typing import override

from logHandler import log
import screenCurtain
import speech
import ui
import winUser
Expand Down Expand Up @@ -56,15 +57,11 @@ def event_gainFocus(
log.debug("Full-screen Magnifier gain focus event")
nextHandler()

@override
def _startMagnifier(self) -> None:
"""
Start the Full-screen magnifier using windows DLL
"""
# Check if Screen Curtain is active
if screenCurtain.screenCurtain and screenCurtain.screenCurtain.enabled:
log.warning("Cannot start magnifier: Screen Curtain is active")
raise RuntimeError("Screen Curtain is active")

Comment thread
seanbudd marked this conversation as resolved.
super()._startMagnifier()
log.debug(
f"Starting magnifier with zoom level {self.zoomLevel} and filter {self.filterType} and full-screen mode {self._fullscreenMode}",
Expand Down Expand Up @@ -110,6 +107,7 @@ def _initializeNativeMagnification(self) -> None:
self._uninitializeNativeMagnification()
raise

@override
def _doUpdate(self):
"""
Perform the actual update of the magnifier
Expand All @@ -121,6 +119,7 @@ def _doUpdate(self):

self._fullscreenMagnifier(coordinates)

@override
def _stopMagnifier(self) -> None:
"""
Stop the Full-screen magnifier using windows DLL
Expand Down Expand Up @@ -150,6 +149,7 @@ def _uninitializeNativeMagnification(self) -> None:
magnification.MagUninitialize()
log.debug("Magnification API uninitialized")

@override
def _attemptRecovery(self) -> None:
"""
Attempt to recover from repeated Magnification API errors by
Expand Down Expand Up @@ -255,6 +255,7 @@ def _getCoordinatesForMode(
case FullScreenMode.CENTER:
return coordinates

@override
def _keepMouseCentered(self) -> None:
"""
Move the mouse to the center of the magnified view.
Expand Down Expand Up @@ -377,6 +378,7 @@ def _stopSpotlight(self) -> None:
self._spotlightManager._spotlightIsActive = False
self._startTimer(self._updateMagnifier)

@override
def _getMagnifierParameters(self, coordinates: Coordinates) -> MagnifierParameters:
"""
Compute the top-left corner of the magnifier window centered on (x, y)
Expand Down
Loading