Skip to content

restore controlTypes aliases#13588

Merged
feerrenrut merged 4 commits into
betafrom
restoreControlTypesAliases
Apr 12, 2022
Merged

restore controlTypes aliases#13588
feerrenrut merged 4 commits into
betafrom
restoreControlTypesAliases

Conversation

@feerrenrut

Copy link
Copy Markdown
Contributor

Link to issue number:

#13583

Summary of the issue:

ControlTypes was refactored, aliases were left in place deprecated and marked for removal in the 2022.1 release.
During the beta NV Access received feedback from add-on authors that updating usages of these aliases is difficult and feels unnecessary.

Description of how this pull request fixes the issue:

Upon reconsideration, assessing the maintenance cost as low, these aliases can be reintroduced.
Note, these aliases remain deprecated, and will be removed if maintenance cost becomes high.

It is still recommended that add-on authors use the new controlTypes.Role and controlTypes.State symbols instead for consistency with the NVDA core code.

Testing strategy:

Tested with a global plugin in developer scratch pad.

import globalPluginHandler
import controlTypes
from logHandler import log

log.debug("Trying to access controlTypes.ROLE_UNKNOWN")
log.debug(f"Value of controlTypes.ROLE_UNKNOWN: {controlTypes.ROLE_UNKNOWN}")

log.debug("Trying to import all")
from controlTypes import *

log.debug("Trying to access ROLE_UNKNOWN")
log.debug(f"Value of ROLE_UNKNOWN: {ROLE_UNKNOWN}")


class GlobalPlugin(globalPluginHandler.GlobalPlugin):
	# nothing required. Just ensure imports work as expected.
	pass

Known issues with pull request:

This code exposes the deprecated symbols to IDEs. Due to use of from .deprecatedAliases import *
This may be considered a feature (ease of determining the underlaying type for the alias) or a bug (the deprecated nature is not obvious from an IDEs code suggestions)

It would be possible to programmatically import the symbols, making them less likely to be exposed to the IDE.
The current approach prefers to value simplicity and the discoverability of the alias type.

Change log entries:

Adjustments required to the For Developers section.

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

@feerrenrut feerrenrut requested a review from a team as a code owner April 7, 2022 03:30
@feerrenrut feerrenrut requested review from seanbudd and removed request for a team April 7, 2022 03:30
@AppVeyorBot

This comment was marked as outdated.

@feerrenrut

Copy link
Copy Markdown
Contributor Author

Chrome system tests are failing on all builds and being investigated separately. This PR probably should be blocked until that is addressed.

@AppVeyorBot

This comment was marked as outdated.

Fix unit tests
@AppVeyorBot

This comment was marked as outdated.

seanbudd
seanbudd previously approved these changes Apr 8, 2022
michaelDCurran
michaelDCurran previously approved these changes Apr 8, 2022
@feerrenrut feerrenrut dismissed stale reviews from michaelDCurran and seanbudd via 281544f April 12, 2022 04:02
@AppVeyorBot

This comment was marked as outdated.

@AppVeyorBot

This comment was marked as outdated.

@feerrenrut feerrenrut merged commit 673a4eb into beta Apr 12, 2022
@feerrenrut feerrenrut deleted the restoreControlTypesAliases branch April 12, 2022 08:41
@nvaccessAuto nvaccessAuto added this to the 2022.2 milestone Apr 12, 2022
feerrenrut added a commit that referenced this pull request Apr 14, 2022
… (PR #13603)

Related to #13588
Based on conversation in https://nvda-addons.groups.io/g/nvda-addons/topic/90329930

Summary of the issue:
- Some add-ons depend on the legacy values of controlTypes.Roles (and possibly controlTypes.States)
- These were removed in commit d4586a5 via PR #13414.
- While HAS_ARIA_DETAILS isn't used internally, add-ons may indirectly depend on it.
This enum value was initially added to controlTypes.py in commit
d6787b8
and removed in
aa351c5
which introduced a replacement approach:
Use instead NVDAObject.hasDetails

Description of change:
Restore the values using more developer friendly definitions, use unit tests to ensure values match and can be constructed from and compared with integer values, or constructed from the enum value name.
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.

5 participants