Skip to content

appModules/calculatorapp: add support for Windows 11 Calculator#13215

Merged
feerrenrut merged 8 commits into
nvaccess:masterfrom
josephsl:win11calculator
Feb 16, 2022
Merged

appModules/calculatorapp: add support for Windows 11 Calculator#13215
feerrenrut merged 8 commits into
nvaccess:masterfrom
josephsl:win11calculator

Conversation

@josephsl

@josephsl josephsl commented Jan 4, 2022

Copy link
Copy Markdown
Contributor

Link to issue number:

Closes #13212

Summary of the issue:

Adds support for Windows 11 Calculator (calculatorapp.exe), consisting of an alias app module and responding to UI changes via Windows 10 Calculator app module.

Description of how this pull request fixes the issue:

In Windows 11, Calculator not only saw UI changes, but it comes with a renamed executable (calculator.exe -> calculatorapp.exe). To take care of these changes:

  1. Windows 11 Calculator app module was created as an alias for Windows 10 Calculator to follow precedence set by other apps such as emoji panel, Windows Search, and Mail.
  2. Windows 10 Calculator, the base app module, provides detection of Windows 11 UI (if Windows 11 version is in use, UIA notification event handler's results detection code must descend one more level to locate display element).

An alternative is a dedicated Windows 11 Calculator app module that inherits from Windows 10 Calculator's AppModule class and tweaks UIA notification event handler. Although this makes it easy to identify which app module is which, it introduces code duplication which might be an issue from maintenance point of view. Therefore, an alias app module and a tweaked base app module is more suitable for this situation.

Testing strategy:

Manual testing: requires Windows 11, make sure NVDA performs as expected while using Calculator app just as in Windows 10 (namely not nanouncing display text unless Enter/Escape/Delete is pressed, unit converter results are announced, and others).

Known issues with pull request:

None

Change log entries:

New features:

Added support for Windows 11 Calculator. (#13212)

Code Review Checklist:

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

…ication event in Windows 11 version. Re nvaccess#13212.

In Windows 11 Calculator, due to UI redesign, app interface lives inside the last child of the foreground window (foregroundObject.children[1].lastChild.firstChild), therefore check product version and descend one more level if this is Windows 11 version. This is only one of several changes introduced in Windows 11 Calculator.
…alias for Windows 10 Calculator. Re nvaccess#13212.

The biggest change between Windows 10 and 11 Calculator app is renamed executabel - calculator.exe -> calculatorapp.exe. Following precedence from other Windows apps, add Windows 11 Calculator as an alias for Windows 10 version, with the latter also adding version checks for Windows 11 version (similar in arrangemenet to emoji panel support in Windows 10/11).
@josephsl josephsl requested a review from a team as a code owner January 4, 2022 05:51
@josephsl josephsl requested a review from seanbudd January 4, 2022 05:51
Comment thread source/appModules/calculator.py
@josephsl

josephsl commented Jan 4, 2022 via email

Copy link
Copy Markdown
Contributor Author

…remove legacy try/except statements.

Reviewed by Reef Turner (NV Access): A try/AttributeError exception check was present in order to support older Windows 10 Calculator releases, mostly to detect notifications coming from unit converters. As of January 2022, this legacy code is no longer needed as legacy code is used in Calculator releases in older Windows 10 feature updates such as Version 1709 which is unsupported (the latest version of Windows 10 is 10.2103). Besides, version variable was defined in attribute error exception handler, which isn't ideal and makes the code harder to read. Therefore remove the redundant try/except statements and fetch results screen as part of 'DisplayUpdated' activity Id handling (after all, results screen is fetched when this activity Id is used).
@josephsl

Copy link
Copy Markdown
Contributor Author

@seanbudd, ping, milestone update please i.e. when do you expect this will be merged into master. Thanks.

Comment thread source/appModules/calculator.py
@josephsl

josephsl commented Feb 15, 2022 via email

Copy link
Copy Markdown
Contributor Author

Comment thread source/appModules/calculator.py
@josephsl

josephsl commented Feb 15, 2022 via email

Copy link
Copy Markdown
Contributor Author

Reviewed by Reef Turner (NV Access): 'DisplayUpdated' activity Id is responsible for displaying calculator content and is updated when numbers are entered (pressing Enter and Delete key does update display content, but for purposes of handling UIA notification event, deal with number entry). Therefore add a comment that notes other activity Id's that are present but not handled in the event handler.

@feerrenrut feerrenrut 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.

Thanks @josephsl

@feerrenrut feerrenrut merged commit 2b9320e into nvaccess:master Feb 16, 2022
@nvaccessAuto nvaccessAuto added this to the 2022.1 milestone Feb 16, 2022
@josephsl josephsl deleted the win11calculator branch April 21, 2022 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Windows 11 Calculator

4 participants