Skip to content

Commit

Permalink
WinVersion: introduce winVersion.getWinVerFromVersionText function. Re
Browse files Browse the repository at this point in the history
…nvaccess#11837.

winversion.getWinVerFromVersionText function can be used to construct WinVersion class instance from the Windows version string of the form major.minor.build i.e. '10.0.19041' will return a WinVersion class instance with major=10, minor=0, build=19041. This is the text counterpart to getWinVer function and is meant to prepare for a future scenario where an add-on or other NVDA components can perform actions based on a specific version text given.
  • Loading branch information
josephsl committed Dec 2, 2020
1 parent c3db97c commit 56c8a1a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions source/winVersion.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ def getWinVer():
servicePack=winVersion.service_pack
)

def getWinVerFromVersionText(versionText: str):
major, minor, build = versionText.split(".")
return WinVersion(
major=int(major),
minor=int(minor),
build=int(build)
)

def isSupportedOS():
# NVDA can only run on Windows 7 Service pack 1 and above
return (winVersion.major,winVersion.minor,winVersion.service_pack_major) >= (6,1,1)
Expand Down

0 comments on commit 56c8a1a

Please sign in to comment.