Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
120d7d4
WinVersion: update copyright header, add Bill Dengler as author
josephsl Dec 2, 2020
a00e1b4
WinVersion: introduce WinVersion class. Re #11837.
josephsl Dec 2, 2020
c3db97c
WinVersion: introduce winVersion.getWinVer function. Re #11837.
josephsl Dec 2, 2020
56c8a1a
WinVersion: introduce winVersion.getWinVerFromVersionText function. R…
josephsl Dec 2, 2020
298dd3a
Merge branch 'master' into WinVersionClass
josephsl Dec 7, 2020
e746b02
winVersion.WinVersion: add unit test cases. Re #11837.
josephsl Dec 7, 2020
9194536
winVersion unittests: lint and additional test on operators (specific…
josephsl Dec 7, 2020
7f60f80
winVersion: convert Windows 10 releases to build map into str:int dic…
josephsl Dec 7, 2020
62f6273
winVersion.WinVersion: transfer isWin10 function to WinVersion class.…
josephsl Dec 7, 2020
4826b54
winVersion.isWin10: deprecated, call winVersion.getWinVer().isWin10 i…
josephsl Dec 7, 2020
52c8841
winVersion unittest: test winVersion.WinVersion.isWin10. Re #11837.
josephsl Dec 7, 2020
3107312
winVersion unittest: lint
josephsl Dec 7, 2020
3bd9ba2
winVersion unittest: fix spelling error in comment
josephsl Dec 7, 2020
c3d41f9
winVersion unittests/operator check: test with 'Windows 8' instead of…
josephsl Dec 8, 2020
5ee0dec
Merge branch 'master' into WinVersionClass
josephsl Dec 11, 2020
a917764
winVersion: add module header/description.
josephsl Dec 11, 2020
e2bd2f0
winVersion: record Windows releases to WinVersion instance mappings. …
josephsl Dec 11, 2020
45e33e9
winVersion.getWinVer: call sys.getwindowsversion function inside getW…
josephsl Dec 11, 2020
989d741
winVersion: compare getWinVer with release constants when checking fo…
josephsl Dec 11, 2020
5be0182
Replace winVersion.isWin10 function call with constant checks. Re #11…
josephsl Dec 11, 2020
ee93632
winVersion: remove isWin10 function and test suite for it. Re #11837.
josephsl Dec 11, 2020
1149105
winVersion.WinVersion class: simplify class constructor. Re #11837.
josephsl Dec 12, 2020
b207ef5
winVersion: rename Windows 10 version map to 'release name to builds'…
josephsl Dec 12, 2020
a1dd33d
winVersion.WinVersion class: add two static methods to return WinVers…
josephsl Dec 12, 2020
79db425
winVersion.WinVersion: add repr method. Re #11837.
josephsl Dec 12, 2020
e9d4a10
winVersion unit tests: test WinVersion.fromReleaseName functions.
josephsl Dec 12, 2020
0d44de2
Remove winVersion.winVersion call. Re #11933.
josephsl Dec 12, 2020
ba3ef2f
Update check: transfer winVersion.winversionText construction routine…
josephsl Dec 12, 2020
b23e44d
winVersion.WinVersion: put version major.minor.build inside parentehs…
josephsl Dec 12, 2020
187e8c7
Startup: report winVersion.getWinVer function output for Windows vers…
josephsl Dec 12, 2020
8e681a8
winVersion: remove winVersion.winVersion/winVersionText. Re #11837.
josephsl Dec 12, 2020
117b6b8
winVersion.WinVersion: say 'Windows 10 prerelease' for builds not inc…
josephsl Dec 12, 2020
b76ff33
winVersion.WinVersion: do not include product type string if not defi…
josephsl Dec 12, 2020
4cbcbdf
Merge branch 'master' into WinVersionClass
josephsl Dec 30, 2020
b3102b2
Update copyright year
josephsl Dec 30, 2020
dd5a55a
winVersion/Windows release: shorten unknown Windows release error mes…
josephsl Dec 30, 2020
f2798a8
Merged master, temporarily use master version of NVDAObjects/IAccessi…
josephsl Jan 3, 2021
eb9820e
winVersion: general lint (E302, E305)
josephsl Jan 3, 2021
6683cae
winVersion: remove unused winUser module import
josephsl Jan 3, 2021
83f1da5
NVDAObjects/IAccessible/winConsole: restore getWinVer/WIN10_1607 afte…
josephsl Jan 3, 2021
1996143
Merge branch 'master' into WinVersionClass
josephsl Jan 14, 2021
cea3d97
Modern keyboard: typo.
josephsl Jan 14, 2021
4398293
WinVersion: remove 'canRunVc2010Builds' function as it is no longer u…
josephsl Jan 14, 2021
2f40832
Modern keyboard: lint and update copyright header
josephsl Jan 14, 2021
46256fa
Merge branch 'master' into WinVersionClass
josephsl Jan 27, 2021
74a0e4a
Merge branch 'master' into WinVersionClass
josephsl Feb 5, 2021
81a1046
Edge Sp[artan (classic Edge): pre-gap removal = build < 15048. Re #11795
josephsl Feb 5, 2021
0888963
Modern keyboard/emoji panel: define variables to hold classi emoji pa…
josephsl Feb 5, 2021
e320820
WinVersion: remove fromReleaseName and fromVersionText static methods…
josephsl Feb 5, 2021
55d6231
WinVersion tests: remove tests that relied on removed static methods,…
josephsl Feb 5, 2021
66e1d5e
Merge branch 'master' into WinVersionClass
josephsl Mar 11, 2021
c3e7ae5
Merge branch 'master' into WinVersionClass
josephsl Mar 16, 2021
bcea799
Merge branch 'master' into WinVersionClass
josephsl Mar 25, 2021
abf4a04
Modern keyboard and unit tests: update copyright header
josephsl Mar 25, 2021
d9c2d52
Modern keyboard/emoji panel: use comparisons rather than builds list.
josephsl Mar 25, 2021
6df58da
Unit tests: add comment on Flake8 F841.
josephsl Mar 25, 2021
7a5073f
Update changes file for PR #11909
feerrenrut Mar 25, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/NVDAObjects/UIA/spartanEdge.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def _getTextWithFieldsForUIARange( # noqa: C901

class EdgeNode(web.UIAWeb):

_edgeIsPreGapRemoval = winVersion.winVersion.build < 15048
_edgeIsPreGapRemoval = winVersion.getWinVer().build < 15048

_TextInfo = EdgeTextInfo_preGapRemoval if _edgeIsPreGapRemoval else EdgeTextInfo

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,12 @@ def event_UIA_window_windowOpen(self, obj, nextHandler):
return
# #9104: different aspects of modern input panel are represented by automation iD's.
childAutomationID = obj.firstChild.UIAElement.cachedAutomationID
# Emoji panel for build 16299 and 17134.
# Emoji panel for 1709 (build 16299) and 1803 (17134).
emojiPanelInitial = winVersion.WIN10_1709
# This event is properly raised in build 17134.
emojiPanelWindowOpenEvent = winVersion.WIN10_1803
if (
winVersion.getWinVer().build <= 17134
winVersion.getWinVer() in (emojiPanelInitial, emojiPanelWindowOpenEvent)

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.

I may be misunderstanding (I'm not that familiar with the timeline of the emoji panel), but wouldn't this be more accurate as a comparison for a range of values eg emojiPanelInitial <= winVersion.getWinVer() <= emojiPanelWindowOpenEvent. Or is it actually accurate that only for these two precise builds this alternative behavior was required.

I think generally it would be safer to do these comparisons as ranges with limits where MS made / removed things.

I ask because there are other "release" builds between, but also in case there could have been (or even could still be) people running insider builds that may still benefit from this that don't exactly equal any of the reference build numbers listed in the constants. For instance running 17763: https://blogs.windows.com/windows-insider/2018/09/18/announcing-windows-10-insider-preview-build-17763/

and childAutomationID in (
"TEMPLATE_PART_ExpressiveInputFullViewFuntionBarItemControl",
"TEMPLATE_PART_ExpressiveInputFullViewFuntionBarCloseButton"
Expand Down
40 changes: 0 additions & 40 deletions source/winVersion.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,46 +79,6 @@ def __ge__(self, other):
>= (other.major, other.minor, other.build)
)

@staticmethod
def fromReleaseName(release: str, servicePack: str = ""):
"""Returns Windows version information based on release name.
For example, 6.2.9200 for '8'.
Versions other than 7 do not come with service packs.
On Windows 10, pass in either '10' or the string representing a specific Windows 10 release.
For example, '20H2' will return Windows version 10.0.19042.
"""
if release == "7":
return WIN7 if servicePack == "" else WIN7_SP1
elif release == "8":
return WIN8
elif release == "8.1":
return WIN81
elif release in ("10", "1507"):
return WIN10
elif release in WIN10_RELEASE_NAME_TO_BUILDS:
return WinVersion(
major=10,
minor=0,
build=WIN10_RELEASE_NAME_TO_BUILDS[release]
)
else:
raise ValueError(f"Unknown Windows release: {release}")

@staticmethod
def fromVersionText(versionText: str):
"""Returns a Windows version information based on version string
of the form major.minor.build.
"""
major, minor, build = versionText.split(".")
# Specifically for Windows 7 service pack 1.
servicePack = "1" if versionText == "6.1.7601" else ""
return WinVersion(
major=int(major),
minor=int(minor),
build=int(build),
servicePack=servicePack
)


# Windows releases to WinVersion instances for easing comparisons.
WIN7 = WinVersion(major=6, minor=1, build=7600)
Expand Down
21 changes: 3 additions & 18 deletions tests/unit/test_winVersion.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,10 @@ def test_getWinVer(self):
winVerPython[:3]
)

def test_specificWinVer(self):
# Try detecting Windows 8.1 or later.
win81 = winVersion.WinVersion.fromReleaseName("8.1")
self.assertTupleEqual(
(win81.major, win81.minor, win81.build),
(6, 3, 9600)
)

def test_getWinVerFromVersionText(self):
# Windows 10 1507 is in fact Windows 10 initial release.
winTenInitial = winVersion.WinVersion.fromVersionText("10.0.10240")
self.assertEqual(
winTenInitial, winVersion.WIN10_1507
)

def test_getWinVerFromNonexistentRelease(self):
def test_getWinVerFromNonExistentRelease(self):
# Test the fact that there is no Windows 10 2003 (2004 exists, however).
with self.assertRaises(ValueError):
winVersion.WinVersion.fromReleaseName("2003")
with self.assertRaises(AttributeError):
may2020Update = winVersion.WIN10_2003 # NOQA: F841

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.

Please add a comment above this line to specify what F841 is.


def test_moreRecentWinVer(self):
# Specifically to test operators.
Expand Down