Skip to content

Persist magnifier zoom, filter, full screen mode#20050

Merged
seanbudd merged 11 commits into
betafrom
persistMag
May 28, 2026
Merged

Persist magnifier zoom, filter, full screen mode#20050
seanbudd merged 11 commits into
betafrom
persistMag

Conversation

@seanbudd

@seanbudd seanbudd commented May 4, 2026

Copy link
Copy Markdown
Member

Link to issue number:

Fixes #19493
Fixes #20110
Fixes #20149

Summary of the issue:

Magnifier zoom, filter and full screen mode were not persisted when set via keyboard gestures

Description of user facing changes:

Persist Magnifier zoom, filter and full screen mode in settings

Description of developer facing changes:

none

Description of development approach:

Settings Synchronization and Immediate Application:

  • Added _applyCurrentSettingsToConfigAndRuntime method to MagnifierPanel, which applies the current UI control values to both the configuration and the active magnifier instance, ensuring settings changes are reflected immediately. Immediate updates are now handled for zoom, pan step, filter, fullscreen mode, "true centered", follow focus, and "keep mouse centered" settings.
  • The onSave and onDiscard methods now use the new synchronization logic, improving reliability when saving or discarding changes. Initial values are stored and restored as needed.

Magnifier Runtime Updates:

  • When toggling filter, fullscreen mode, or zoom, the corresponding runtime setter (setFilter, setFullscreenMode, setZoomLevel) is now called to ensure the running magnifier instance is updated immediately.

Codebase Cleanup and Modernization:

  • Removed unused getDefaultFullscreenMode and setDefaultFullscreenMode functions from the config module, a

Testing Improvements:

  • The magnifier test setup now explicitly sets default values for zoomLevel and _filterType, improving test reliability and clarity.

Testing strategy:

manual testing

Known issues with pull request:

none

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@seanbudd seanbudd marked this pull request as ready for review May 4, 2026 06:07
@seanbudd seanbudd requested a review from a team as a code owner May 4, 2026 06:07
@seanbudd seanbudd requested review from SaschaCowley and Copilot May 4, 2026 06:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates NVDA's magnifier module so gesture-driven changes are written back to the running configuration, aligning keyboard commands with how magnifier settings are expected to persist across restarts and re-enablement.

Changes:

  • Persist zoom level changes by writing from the magnifier zoom setter into config.
  • Persist filter changes when cycling filters from commands.
  • Persist full-screen mode changes when cycling focus modes from commands.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
source/_magnifier/magnifier.py Writes zoom-level updates to config from the shared magnifier setter.
source/_magnifier/commands.py Persists filter and full-screen mode changes triggered by keyboard commands.

Comment thread source/_magnifier/commands.py
Comment thread source/_magnifier/magnifier.py Outdated
Comment thread source/_magnifier/commands.py
@seanbudd seanbudd marked this pull request as draft May 4, 2026 06:34
@seanbudd seanbudd added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label May 4, 2026
@seanbudd seanbudd changed the base branch from master to beta May 11, 2026 08:20
@seanbudd seanbudd added this to the 2026.2 milestone May 11, 2026
@seanbudd seanbudd changed the base branch from beta to master May 11, 2026 09:32
@seanbudd seanbudd changed the base branch from master to beta May 11, 2026 09:33
@seanbudd seanbudd marked this pull request as ready for review May 26, 2026 05:39
@seanbudd seanbudd requested a review from Copilot May 26, 2026 05:39
@seanbudd

Copy link
Copy Markdown
Member Author

Hi @CyrilleB79 - do you mind testing this PR? I will fix the remaining items from #20148 in a separate PR

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

source/_magnifier/commands.py:203

  • New persistence behavior is introduced for gesture-driven changes (zoom persists via setZoomLevel, filter via setFilter, fullscreen mode via setFullscreenMode), but there are unit tests for magnifier commands already and none cover these new persistence calls. Please add/update unit tests to assert the relevant config setters are invoked when these gestures run (and that they don’t crash in non-fullscreen views).
def toggleFilter() -> None:
	"""Cycle through color filters"""
	magnifier: Magnifier = getMagnifier()
	log.debug(f"Toggling filter for magnifier: {magnifier}")
	if magnifierIsActiveVerify(
		magnifier,
		MagnifierAction.TOGGLE_FILTER,
	):
		assert isinstance(magnifier, FullScreenMagnifier)
		filters = list(Filter)
		idx = filters.index(magnifier.filterType)
		magnifier.filterType = filters[(idx + 1) % len(filters)]
		if magnifier._MAGNIFIED_VIEW == MagnifiedView.FULLSCREEN:
			fullscreenMagnifier: FullScreenMagnifier = magnifier
			fullscreenMagnifier._applyFilter()
		setFilter(magnifier.filterType)

		ui.message(
			pgettext(
				"magnifier",
				# Translators: Message announced when changing the color filter with {filter} being the new color filter.
				"Color filter changed to {filter}",
			).format(filter=magnifier.filterType.displayString),
		)


def cycleMagnifiedView() -> None:
	"""Cycle through magnifier views (full-screen, fixed, docked, lens)"""
	magnifier: Magnifier = getMagnifier()

Comment thread tests/unit/test_magnifier/test_magnifier.py Outdated
Comment thread source/_magnifier/commands.py
Comment thread source/gui/settingsDialogs.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@seanbudd seanbudd requested review from michaelDCurran and removed request for SaschaCowley May 26, 2026 06:29
@seanbudd seanbudd removed the blocked label May 26, 2026
@seanbudd seanbudd merged commit ba9caf1 into beta May 28, 2026
39 checks passed
@seanbudd seanbudd deleted the persistMag branch May 28, 2026 02:54
@CyrilleB79

Copy link
Copy Markdown
Contributor

Hi @seanbudd

I have not been able to test on time before it is merged.
Anyway, many thanks for these fixes: persistent memorization and immediate effect the GUI really improve the UX!

I have opened a fix-up PR (#20236) to solve the case when one presses the Apply button.

Another point:
With this PR, you have probably introduced something similar to #19765 for Magnifier: saving changes in settings dialog while it is not yet validated with OK or Apply creates such side effects.

Though, #19765 is already present for a long time and people do not complain, so I guess it's acceptable to keep things as they are for Magnifier in beta/2026.2.
Moreover, changing config through command gestures while settings dialog is open creates inconsistencies, not only in this panel. It's a known issue and there is no perfect solution.

seanbudd pushed a commit that referenced this pull request May 29, 2026
…ory even if Discard button is then pressed (#20236)

Fixes #20235

Fix-up of #20050
Summary of the issue:

When pressing apply in Magnifier settings panel, the values were not kept in memory. Thus, if dialog was then discarded, the initial values memorized when the dialog was opened were restored instead of the ones after Aply has been pressed.
Description of user facing changes:

When Mag settings dialog is discarded, the values of parameters present in the dialog when Apply was pressed are now restored as expected.
Description of developer facing changes:

N/A
Description of development approach:

Updated the *initially variables when settings panel is saved, i.e. when Apply or OK are pressed.
For OK, this has no impact since the dialog is closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Persist magnification settings (zoom level, filter etc) when modified with gestures

4 participants