From f049b0eba3480dbc917633a83adf4a0356b02685 Mon Sep 17 00:00:00 2001 From: hwf1324 <1398969445@qq.com> Date: Thu, 7 May 2026 20:12:36 +0800 Subject: [PATCH 1/5] Remove duplicate screen curtain checks. --- source/_magnifier/fullscreenMagnifier.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/source/_magnifier/fullscreenMagnifier.py b/source/_magnifier/fullscreenMagnifier.py index b10632cc80e..62d57c49553 100644 --- a/source/_magnifier/fullscreenMagnifier.py +++ b/source/_magnifier/fullscreenMagnifier.py @@ -8,7 +8,6 @@ """ from logHandler import log -import screenCurtain import speech import ui import winUser @@ -60,11 +59,6 @@ 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") - super()._startMagnifier() log.debug( f"Starting magnifier with zoom level {self.zoomLevel} and filter {self.filterType} and full-screen mode {self._fullscreenMode}", From e62f96d1e5de550e10ed5258a82ff9cb6959b247 Mon Sep 17 00:00:00 2001 From: hwf1324 <1398969445@qq.com> Date: Thu, 7 May 2026 20:24:52 +0800 Subject: [PATCH 2/5] Type hint: Added `@override` annotation. --- source/_magnifier/fullscreenMagnifier.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/_magnifier/fullscreenMagnifier.py b/source/_magnifier/fullscreenMagnifier.py index 62d57c49553..6dff46beaf1 100644 --- a/source/_magnifier/fullscreenMagnifier.py +++ b/source/_magnifier/fullscreenMagnifier.py @@ -7,6 +7,8 @@ Full-screen magnifier module. """ +from typing import override + from logHandler import log import speech import ui @@ -55,6 +57,7 @@ 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 @@ -104,6 +107,7 @@ def _initializeNativeMagnification(self) -> None: self._uninitializeNativeMagnification() raise + @override def _doUpdate(self): """ Perform the actual update of the magnifier @@ -115,6 +119,7 @@ def _doUpdate(self): self._fullscreenMagnifier(coordinates) + @override def _stopMagnifier(self) -> None: """ Stop the Full-screen magnifier using windows DLL @@ -144,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 @@ -249,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. @@ -371,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) From 371fcc9d41ed26176bea89a48e8f0b1b1816a056 Mon Sep 17 00:00:00 2001 From: hwf1324 <1398969445@qq.com> Date: Thu, 7 May 2026 20:28:51 +0800 Subject: [PATCH 3/5] fix tyype hint --- source/_magnifier/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_magnifier/commands.py b/source/_magnifier/commands.py index 4ab40da2594..a3ddf545057 100644 --- a/source/_magnifier/commands.py +++ b/source/_magnifier/commands.py @@ -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() From dd50ddb72dda1c37d3b35d5bc5272399b71a47b8 Mon Sep 17 00:00:00 2001 From: hwf1324 <1398969445@qq.com> Date: Thu, 7 May 2026 20:40:27 +0800 Subject: [PATCH 4/5] Remove redundant `return` --- source/_magnifier/commands.py | 1 - 1 file changed, 1 deletion(-) diff --git a/source/_magnifier/commands.py b/source/_magnifier/commands.py index a3ddf545057..65da2a3eb14 100644 --- a/source/_magnifier/commands.py +++ b/source/_magnifier/commands.py @@ -102,7 +102,6 @@ def toggleMagnifier() -> None: "Cannot start magnifier: Screen Curtain is active. Please disable Screen Curtain first.", ), ) - return else: initialize() filter = getFilter() From 80d1e302d911aadfe004dfa5bbcba35a2d4901be Mon Sep 17 00:00:00 2001 From: hwf1324 <1398969445@qq.com> Date: Thu, 7 May 2026 20:47:06 +0800 Subject: [PATCH 5/5] rename filter variable to currentFilter, Because it shadows a builtin functions. --- source/_magnifier/commands.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/_magnifier/commands.py b/source/_magnifier/commands.py index 65da2a3eb14..d614870aee5 100644 --- a/source/_magnifier/commands.py +++ b/source/_magnifier/commands.py @@ -104,7 +104,7 @@ def toggleMagnifier() -> None: ) else: initialize() - filter = getFilter() + currentFilter = getFilter() magnifiedView = getMagnifiedView() zoomLevel = getZoomLevelString() if magnifiedView == MagnifiedView.FULLSCREEN: @@ -116,7 +116,7 @@ def toggleMagnifier() -> None: ).format( magnifiedView=magnifiedView.displayString, zoomLevel=zoomLevel, - filter=filter.displayString, + filter=currentFilter.displayString, fullscreenMode=fullscreenMode.displayString, ) else: @@ -127,7 +127,7 @@ def toggleMagnifier() -> None: ).format( magnifiedView=magnifiedView.displayString, zoomLevel=zoomLevel, - filter=filter.displayString, + filter=currentFilter.displayString, ) ui.message(msg)