Skip to content

Commit 3180e60

Browse files
authored
Merge 0ae9c7f into 3894e25
2 parents 3894e25 + 0ae9c7f commit 3180e60

3 files changed

Lines changed: 29 additions & 32 deletions

File tree

source/buildVersion.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def formatVersionForGUI(year, major, minor):
7070
version_minor = 0
7171
version_build = 0 # Should not be set manually. Set in 'sconscript' provided by 'appVeyor.yml'
7272
version=_formatDevVersionString()
73+
version_detailed = formatBuildVersionString()
7374
publisher="unknown"
7475
updateVersionType=None
7576
try:

source/installer.py

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import easeOfAccess
2222
import COMRegistrationFixes
2323
import winKernel
24+
from typing import Dict, Union
2425

2526
_wsh=None
2627
def _getWSH():
@@ -227,16 +228,23 @@ def removeOldProgramFiles(destPath):
227228
log.warning(f"Couldn't remove file: {path!r}")
228229

229230

230-
uninstallerRegInfo={
231-
"DisplayName":versionInfo.name,
232-
"DisplayVersion":versionInfo.version,
233-
"DisplayIcon":u"{installDir}\\images\\nvda.ico",
234-
"InstallDir":u"{installDir}",
235-
"Publisher":versionInfo.publisher,
236-
"UninstallDirectory":u"{installDir}",
237-
"UninstallString":u"{installDir}\\uninstall.exe",
238-
"URLInfoAbout":versionInfo.url,
239-
}
231+
def getUninstallerRegInfo(installDir: str) -> Dict[str, Union[str, int]]:
232+
"""
233+
Constructs a dictionary that is written to the registry for NVDA to show up
234+
in the Windows' Aps and Features overview.
235+
"""
236+
return dict(
237+
DisplayName=f"{versionInfo.name} {versionInfo.version}",
238+
DisplayVersion=versionInfo.version_detailed,
239+
DisplayIcon=os.path.join(installDir, "images", "nvda.ico"),
240+
# EstimatedSize is in KiB
241+
EstimatedSize=getDirectorySize(installDir) // 1024,
242+
InstallDir=installDir,
243+
Publisher=versionInfo.publisher,
244+
UninstallDirectory=installDir,
245+
UninstallString=os.path.join(installDir, "uninstall.exe"),
246+
URLInfoAbout=versionInfo.url,
247+
)
240248

241249

242250
def getDirectorySize(path: str) -> int:
@@ -259,34 +267,22 @@ def registerInstallation(
259267
startOnLogonScreen: bool,
260268
configInLocalAppData: bool = False
261269
) -> None:
262-
calculatedUninstallerRegInfo = uninstallerRegInfo.copy()
263-
# EstimatedSize is in KiB
264-
estimatedSize = getDirectorySize(installDir)
265-
log.debug(f"Estimated install size {estimatedSize}")
266-
calculatedUninstallerRegInfo.update(EstimatedSize=estimatedSize // 1024)
270+
calculatedUninstallerRegInfo = getUninstallerRegInfo(installDir)
271+
log.debug(f"Estimated install size {calculatedUninstallerRegInfo.get('EstimatedSize')}")
267272
with winreg.CreateKeyEx(
268273
winreg.HKEY_LOCAL_MACHINE,
269274
r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\NVDA",
270275
0,
271276
winreg.KEY_WRITE
272277
) as k:
273278
for name, value in calculatedUninstallerRegInfo.items():
274-
if isinstance(value, int):
275-
winreg.SetValueEx(
276-
k,
277-
name,
278-
None,
279-
winreg.REG_DWORD,
280-
value
281-
)
282-
else:
283-
winreg.SetValueEx(
284-
k,
285-
name,
286-
None,
287-
winreg.REG_SZ,
288-
value.format(installDir=installDir)
289-
)
279+
winreg.SetValueEx(
280+
k,
281+
name,
282+
None,
283+
winreg.REG_DWORD if isinstance(value, int) else winreg.REG_SZ,
284+
value
285+
)
290286
with winreg.CreateKeyEx(winreg.HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\nvda.exe",0,winreg.KEY_WRITE) as k:
291287
winreg.SetValueEx(k,"",None,winreg.REG_SZ,os.path.join(installDir,"nvda.exe"))
292288
with winreg.CreateKeyEx(winreg.HKEY_LOCAL_MACHINE, config.RegistryKey.NVDA.value, 0, winreg.KEY_WRITE) as k:

source/versionInfo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
aboutMessage = _(
2222
# Translators: "About NVDA" dialog box message
2323
u"""{longName} ({name})
24-
Version: {version}
24+
Version: {version} ({version_detailed})
2525
URL: {url}
2626
{copyright}
2727

0 commit comments

Comments
 (0)