changes magnifier types and function name for clarity#19882
changes magnifier types and function name for clarity#19882Boumtchack wants to merge 8 commits intonvaccess:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the magnifier configuration and type model to improve clarity and enable future magnifier mode work (e.g., fixed/docked/lens).
Changes:
- Renames magnifier config keys/functions to drop the “default” wording (e.g.,
getDefaultZoomLevel→getZoomLevel) and updates UI bindings accordingly. - Reworks magnifier geometry/type types (introduces
MagnifierParameters,Size,Coordinates, expandsMagnifierType). - Updates unit tests to align with the refactored APIs and fullscreen magnifier parameter calculation.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/test_magnifier/test_magnifier.py | Updates baseline magnifier tests to reflect removed/abstracted position logic and type changes. |
| tests/unit/test_magnifier/test_fullscreenMagnifier.py | Updates fullscreen magnifier tests to use _getMagnifierParameters and explicit start behavior. |
| source/gui/settingsDialogs.py | Renames magnifier settings controls/config interactions and updates help IDs/labels. |
| source/config/configSpec.py | Renames magnifier config keys in the config spec (drops default* keys). |
| source/_magnifier/utils/types.py | Refactors magnifier-related types (parameters/size/coordinates/type/filter). |
| source/_magnifier/magnifier.py | Updates base magnifier to use renamed config getters and makes parameters computation abstract. |
| source/_magnifier/fullscreenMagnifier.py | Implements _getMagnifierParameters for fullscreen magnifier and adjusts lifecycle behavior. |
| source/_magnifier/config.py | Renames config accessor functions to match new key names and API names. |
| source/_magnifier/commands.py | Updates command messaging to use renamed config accessors. |
Comments suppressed due to low confidence (1)
source/_magnifier/utils/types.py:145
CoordinatesandFilterare defined twice in this module (e.g.,Coordinatesat ~22 and again at ~140;Filterat ~107 and again at ~171). The later definitions override the earlier ones and can lead to inconsistent types (e.g.,MagnifierParameters.filtervsconfig.getFilter()), plus it’s confusing for maintainers. Remove the duplicate definitions and keep a single canonicalCoordinates/Filter(and update references accordingly).
class MagnifierParameters(NamedTuple):
"""Named tuple representing the size and position of the magnifier"""
magnifierSize: Size
coordinates: Coordinates
filter: Filter
class Coordinates(NamedTuple):
"""Named tuple representing x and y coordinates"""
x: int
y: int
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi, Regarding the types, I have a question: could we use Thanks! |
|
|
|
Regarding |
|
I think we should be using Coordinates. |
| self.magnifier._stopTimer() | ||
| self.assertIsNone(self.magnifier._timer) | ||
|
|
||
| def testMagnifierPosition(self): |
There was a problem hiding this comment.
I plan to do a review of all tests in the future, this one were not really working as intended so I'll look into it soon
| from dataclasses import dataclass | ||
| from _magnifier.utils.focusManager import FocusManager | ||
| from _magnifier.utils.types import Coordinates, FocusType | ||
| from _magnifier.utils.types import FocusType, Coordinates |
There was a problem hiding this comment.
why was the order swapped here?
There was a problem hiding this comment.
changing back from locationHelper.Point to Coordinates
| } | ||
|
|
||
|
|
||
| class Filter(DisplayStringStrEnum): |
There was a problem hiding this comment.
it was not, I think changes are weirdly reviewed by git
There was a problem hiding this comment.
no Filter exists twice in this file
|
|
||
| class MagnifierParams(NamedTuple): | ||
| """Named tuple representing magnifier parameters for initialization""" | ||
| class Coordinates(NamedTuple): |
There was a problem hiding this comment.
no, Coordinates exists twice in this file
|
|
||
| class MagnifierPosition(NamedTuple): | ||
| """Named tuple representing the position and size of the magnifier window""" | ||
| class MagnifierParameters(NamedTuple): |
There was a problem hiding this comment.
why was this class moved and renamed?
There was a problem hiding this comment.
it takes know the filter and might take others params in the future, it basically gives info on what the settings are for the magnifier.
There was a problem hiding this comment.
I mean why was it moved from where MagnifierParams was?
| import winUser | ||
| import mouseHandler | ||
| from .types import Coordinates, FocusType | ||
| from .types import FocusType, Coordinates |
There was a problem hiding this comment.
| from .types import FocusType, Coordinates | |
| from .types import Coordinates, FocusType |
Link to issue number:
pre - #19473
parts of #19810
Summary of the issue:
#19810 was still to big so I focused on types changes and some functions renaming to go accordingly.
All these changes are nescessary for futur magnifier implementations.
Description of user facing changes:
"default"s have been removed so it can be seen in the doc
Description of developer facing changes:
replaced MagnifierPosition with MagnifierParameters for better handling of size, place and filter of the magnifier.
added a MagnifierType to handle magnifiers different types.
Description of development approach:
This work was split out from PR #19473 to make review and integration easier.
We first added the new structure: MagnifierParameters for size/position/filter, and MagnifierType for futur mode switching.
Testing strategy:
Unit
Known issues with pull request:
Code Review Checklist: