From 6bff723cd6d10cbb25039c7b17baaaeb78c3f290 Mon Sep 17 00:00:00 2001 From: Sean Budd Date: Wed, 8 Jan 2025 17:03:39 +1100 Subject: [PATCH 01/12] Remove contributors file from NVDA, read license as HTML --- source/documentationUtils.py | 26 +++++++++++++++++++--- source/gui/__init__.py | 25 ++++++--------------- source/gui/startupDialogs.py | 42 ++++++++++++++---------------------- source/setup.py | 2 +- user_docs/en/userGuide.md | 6 +++--- 5 files changed, 49 insertions(+), 52 deletions(-) diff --git a/source/documentationUtils.py b/source/documentationUtils.py index 6ffe7cf8826..3ca3bde11db 100644 --- a/source/documentationUtils.py +++ b/source/documentationUtils.py @@ -4,9 +4,12 @@ # This file may be used under the terms of the GNU General Public License, version 2 or later. # For more details see: https://www.gnu.org/licenses/gpl-2.0.html -from typing import Optional +from functools import lru_cache import os +import markdown +import nh3 + import globalVars import languageHandler import NVDAState @@ -16,7 +19,7 @@ import wx -def getDocFilePath(fileName: str, localized: bool = True) -> Optional[str]: +def getDocFilePath(fileName: str, localized: bool = True) -> str | None: if not getDocFilePath.rootPath: if NVDAState.isRunningAsSource(): getDocFilePath.rootPath = os.path.join(globalVars.appDir, "..", "user_docs") @@ -47,7 +50,7 @@ def getDocFilePath(fileName: str, localized: bool = True) -> Optional[str]: return None else: # Not localized. - if NVDAState.isRunningAsSource() and fileName in ("copying.txt", "contributors.txt"): + if NVDAState.isRunningAsSource() and fileName in ("copying.txt"): # If running from source, these two files are in the root dir. return os.path.join(globalVars.appDir, "..", fileName) else: @@ -75,3 +78,20 @@ def reportNoDocumentation(fileName: str, useMsgBox: bool = False) -> None: ) else: queueHandler.queueFunction(queueHandler.eventQueue, ui.message, noDocMessage) + + +@lru_cache(maxsize=1) +def _getSanitizedHtmlLicense() -> str: + licenseFilename: str = getDocFilePath("copying.txt", False) + with open(licenseFilename, "r", encoding="utf-8") as licenseFile: + htmlLicense = markdown.markdown(licenseFile.read()) + return nh3.clean(htmlLicense) + + +def displayLicense(): + ui.browseableMessage( + _getSanitizedHtmlLicense(), + # Translators: The title of the dialog to show the NVDA License. + _("NVDA License"), + isHtml=True, + ) diff --git a/source/gui/__init__.py b/source/gui/__init__.py index 9c5c12b7561..48012634f3d 100644 --- a/source/gui/__init__.py +++ b/source/gui/__init__.py @@ -1,6 +1,6 @@ # -*- coding: UTF-8 -*- # A part of NonVisual Desktop Access (NVDA) -# Copyright (C) 2006-2024 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Mesar Hameed, Joseph Lee, +# Copyright (C) 2006-2025 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Mesar Hameed, Joseph Lee, # Thomas Stivers, Babbage B.V., Accessolutions, Julien Cochuyt, Cyrille Bougot, Luke Davis # This file is covered by the GNU General Public License. # See the file COPYING for more details. @@ -15,7 +15,7 @@ import globalVars import tones import ui -from documentationUtils import getDocFilePath, reportNoDocumentation +from documentationUtils import getDocFilePath, displayLicense, reportNoDocumentation from logHandler import log import config import versionInfo @@ -804,23 +804,6 @@ def _appendHelpSubMenu(self, frame: MainFrame) -> None: self.helpMenu.AppendSeparator() - # Translators: The label for the menu item to view NVDA License document. - item = self.helpMenu.Append(wx.ID_ANY, _("L&icense")) - self.Bind( - wx.EVT_MENU, - lambda evt: systemUtils._displayTextFileWorkaround(getDocFilePath("copying.txt", False)), - item, - ) - # Translators: The label for the menu item to view NVDA Contributors list document. - item = self.helpMenu.Append(wx.ID_ANY, _("C&ontributors")) - self.Bind( - wx.EVT_MENU, - lambda evt: systemUtils._displayTextFileWorkaround(getDocFilePath("contributors.txt", False)), - item, - ) - - self.helpMenu.AppendSeparator() - # Translators: The label for the menu item to open NVDA Welcome Dialog. item = self.helpMenu.Append(wx.ID_ANY, _("We&lcome dialog...")) self.Bind(wx.EVT_MENU, lambda evt: WelcomeDialog.run(), item) @@ -834,6 +817,10 @@ def _appendHelpSubMenu(self, frame: MainFrame) -> None: item = self.helpMenu.Append(wx.ID_ABOUT, _("&About..."), _("About NVDA")) self.Bind(wx.EVT_MENU, frame.onAboutCommand, item) + # Translators: The label for the menu item to view NVDA License document. + item = self.helpMenu.Append(wx.ID_ANY, _("L&icense")) + self.Bind(wx.EVT_MENU, lambda evt: displayLicense(), item) + # Translators: The label for the Help submenu in NVDA menu. self.menu.AppendSubMenu(self.helpMenu, _("&Help")) diff --git a/source/gui/startupDialogs.py b/source/gui/startupDialogs.py index bf3d236a6c7..4d5012a413e 100644 --- a/source/gui/startupDialogs.py +++ b/source/gui/startupDialogs.py @@ -1,6 +1,6 @@ # -*- coding: UTF-8 -*- # A part of NonVisual Desktop Access (NVDA) -# Copyright (C) 2006-2023 NV Access Limited, Łukasz Golonka, Cyrille Bougot +# Copyright (C) 2006-2025 NV Access Limited, Łukasz Golonka, Cyrille Bougot # This file may be used under the terms of the GNU General Public License, version 2 or later. # For more details see: https://www.gnu.org/licenses/gpl-2.0.html @@ -11,10 +11,11 @@ import config from config.configFlags import NVDAKey import core -from documentationUtils import getDocFilePath +from documentationUtils import displayLicense import globalVars import gui from gui.dpiScalingHelper import DpiScalingHelperMixinWithoutInit +import gui.guiHelper import keyboardHandler from logHandler import log import versionInfo @@ -184,12 +185,6 @@ def __init__(self, parent): sHelper.addItem(self._createLicenseAgreementGroup()) - # Translators: The label for a checkbox in NvDA installation program to agree to the license agreement. - agreeText = _("I &agree") - self.licenseAgreeCheckbox = sHelper.addItem(wx.CheckBox(self, label=agreeText)) - self.licenseAgreeCheckbox.Value = False - self.licenseAgreeCheckbox.Bind(wx.EVT_CHECKBOX, self.onLicenseAgree) - sizer = sHelper.addItem(wx.GridSizer(2, 2, 0, 0)) self.actionButtons = [] # Translators: The label of the button in NVDA installation program to install NvDA on the user's computer. @@ -225,24 +220,19 @@ def _createLicenseAgreementGroup(self) -> wx.StaticBoxSizer: # Translators: The label of the license text which will be shown when NVDA installation program starts. groupLabel = _("License Agreement") sizer = wx.StaticBoxSizer(wx.VERTICAL, self, label=groupLabel) - # Create a fake text control to determine appropriate width of license text box - _fakeTextCtrl = wx.StaticText( - self, - label="a" * 80, # The GPL2 text of copying.txt wraps sentences at 80 characters - ) - widthOfLicenseText = _fakeTextCtrl.Size[0] - _fakeTextCtrl.Destroy() - licenseTextCtrl = wx.TextCtrl( - self, - size=(widthOfLicenseText, self.scaleSize(300)), - style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH, - ) - licenseTextCtrl.Value = open(getDocFilePath("copying.txt", False), "r", encoding="UTF-8").read() - sizer.Add( - licenseTextCtrl, - flag=wx.EXPAND, - proportion=1, - ) + + # Translators: The label of a button in NVDA installation process to view the license agreement. + viewLicenseButton = wx.Button(self, label=_("&View License")) + viewLicenseButton.Bind(wx.EVT_BUTTON, lambda evt: displayLicense()) + sizer.Add(viewLicenseButton, border=gui.guiHelper.SPACE_BETWEEN_BUTTONS_VERTICAL) + + # Translators: The label for a checkbox in NVDA installation process to agree to the license agreement. + agreeText = _("I have read and &agree to the license agreement") + self.licenseAgreeCheckbox = wx.CheckBox(self, label=agreeText) + self.licenseAgreeCheckbox.SetValue(False) + self.licenseAgreeCheckbox.Bind(wx.EVT_CHECKBOX, self.onLicenseAgree) + sizer.Add(self.licenseAgreeCheckbox, border=gui.guiHelper.SPACE_BETWEEN_ASSOCIATED_CONTROL_VERTICAL) + return sizer def onLicenseAgree(self, evt): diff --git a/source/setup.py b/source/setup.py index b31ecec65fa..dcb67529d2e 100755 --- a/source/setup.py +++ b/source/setup.py @@ -250,7 +250,7 @@ def _genManifestTemplate(shouldHaveUIAccess: bool) -> tuple[int, int, bytes]: }, data_files=[ (".", glob("*.dll") + glob("*.manifest") + ["builtin.dic"]), - ("documentation", ["../copying.txt", "../contributors.txt"]), + ("documentation", ["../copying.txt"]), ("lib/%s" % version, glob("lib/*.dll") + glob("lib/*.manifest")), ("lib64/%s" % version, glob("lib64/*.dll") + glob("lib64/*.exe")), ("libArm64/%s" % version, glob("libArm64/*.dll") + glob("libArm64/*.exe")), diff --git a/user_docs/en/userGuide.md b/user_docs/en/userGuide.md index 8b5ef0d340b..c270b06b2fa 100644 --- a/user_docs/en/userGuide.md +++ b/user_docs/en/userGuide.md @@ -135,8 +135,8 @@ The year and version changes between updates to reflect the current release. 1. Run the downloaded file. You may need to wait a few seconds while a temporary copy of NVDA loads. Once loaded, NVDA will speak throughout the rest of the process. -1. The NVDA Launcher window appears with the license agreement. -Press `downArrow` to read the license agreement if desired. +1. The NVDA Launcher window appears with the license agreement button. +Active the "View license" button and `downArrow` to read the license agreement. 1. Press `tab` to move to the "I agree" checkbox, then press the `spacebar` to check it. 1. Press `tab` to move through the options, then press `enter` on the desired option. @@ -5202,7 +5202,7 @@ Secure mode disables: * The [NVDA Python console](#PythonConsole) * The [Log Viewer](#LogViewer) and logging * The [Braille Viewer](#BrailleViewer) and [Speech Viewer](#SpeechViewer) -* Opening external documents from the NVDA menu, such as the user guide or contributors file. +* Opening external documents from the NVDA menu, such as the user guide file. Installed copies of NVDA store their configuration including add-ons in `%APPDATA%\nvda`. To prevent NVDA users from modifying their configuration or add-ons directly, user access to this folder must also be restricted. From ff3576f44ec1039377258768e54450a70e2e9a92 Mon Sep 17 00:00:00 2001 From: Sean Budd Date: Wed, 8 Jan 2025 17:16:54 +1100 Subject: [PATCH 02/12] update docs --- contributors.txt | 6 ++++-- source/gui/__init__.py | 2 +- user_docs/en/changes.md | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/contributors.txt b/contributors.txt index 24fb181b977..e79112bc23c 100644 --- a/contributors.txt +++ b/contributors.txt @@ -1,5 +1,7 @@ -This is a list of people and organizations that contributed to the NVDA project in various ways since the beginning of the project. For an overview of code contributors, see also -https://github.com/nvaccess/nvda/graphs/contributors +This is a list of people and organizations that contributed to the NVDA project in various ways since the beginning of the project. +For an overview of code contributors, see also https://github.com/nvaccess/nvda/graphs/contributors. +For a list of active contributors, see the experts list https://github.com/nvaccess/nvda/blob/master/projectDocs/community/expertsList.md +This list is now archived. NV Access Limited Michael Curran diff --git a/source/gui/__init__.py b/source/gui/__init__.py index 48012634f3d..2bb88881fa2 100644 --- a/source/gui/__init__.py +++ b/source/gui/__init__.py @@ -817,7 +817,7 @@ def _appendHelpSubMenu(self, frame: MainFrame) -> None: item = self.helpMenu.Append(wx.ID_ABOUT, _("&About..."), _("About NVDA")) self.Bind(wx.EVT_MENU, frame.onAboutCommand, item) - # Translators: The label for the menu item to view NVDA License document. + # Translators: The label for the menu item to view the NVDA License. item = self.helpMenu.Append(wx.ID_ANY, _("L&icense")) self.Bind(wx.EVT_MENU, lambda evt: displayLicense(), item) diff --git a/user_docs/en/changes.md b/user_docs/en/changes.md index e7bbe509074..ab485f3df9c 100644 --- a/user_docs/en/changes.md +++ b/user_docs/en/changes.md @@ -50,6 +50,8 @@ To use this feature, "allow NVDA to control the volume of other applications" mu * Updated CLDR to version 46.0. (#17484, @OzancanKaratas) * Short versions of the most commonly used command line options have been added: `-d` for `--disable-addons` and `-n` for `--lang`. Prefix matching on command line flags, e.g. using `--di` for `--disable-addons` is no longer supported. (#11644, @CyrilleB79) +* The "Contributors" file was removed from the NVDA menu. (#16922) +* The NVDA license is now formatted as an HTML browseable message. (#17600) ### Bug Fixes From 60c0a72bf3e1047aabbcb0372731be142a520fab Mon Sep 17 00:00:00 2001 From: Sean Budd Date: Wed, 8 Jan 2025 17:25:10 +1100 Subject: [PATCH 03/12] fix changes --- user_docs/en/changes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_docs/en/changes.md b/user_docs/en/changes.md index ab485f3df9c..8bc078435cf 100644 --- a/user_docs/en/changes.md +++ b/user_docs/en/changes.md @@ -51,7 +51,7 @@ To use this feature, "allow NVDA to control the volume of other applications" mu * Short versions of the most commonly used command line options have been added: `-d` for `--disable-addons` and `-n` for `--lang`. Prefix matching on command line flags, e.g. using `--di` for `--disable-addons` is no longer supported. (#11644, @CyrilleB79) * The "Contributors" file was removed from the NVDA menu. (#16922) -* The NVDA license is now formatted as an HTML browseable message. (#17600) +* The NVDA license is now formatted as an HTML browseable message to improve readability. (#17600) ### Bug Fixes From 6e035d98685571a5b45c3511229b955d77b6602b Mon Sep 17 00:00:00 2001 From: Sean Budd Date: Wed, 8 Jan 2025 18:44:02 +1100 Subject: [PATCH 04/12] Apply suggestions from code review Co-authored-by: Cyrille Bougot --- source/documentationUtils.py | 4 ++-- user_docs/en/userGuide.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/documentationUtils.py b/source/documentationUtils.py index 3ca3bde11db..5fd078684c1 100644 --- a/source/documentationUtils.py +++ b/source/documentationUtils.py @@ -50,8 +50,8 @@ def getDocFilePath(fileName: str, localized: bool = True) -> str | None: return None else: # Not localized. - if NVDAState.isRunningAsSource() and fileName in ("copying.txt"): - # If running from source, these two files are in the root dir. + if NVDAState.isRunningAsSource() and fileName == "copying.txt": + # If running from source, this file is in the root dir. return os.path.join(globalVars.appDir, "..", fileName) else: return os.path.join(getDocFilePath.rootPath, fileName) diff --git a/user_docs/en/userGuide.md b/user_docs/en/userGuide.md index c270b06b2fa..c03e5df4d49 100644 --- a/user_docs/en/userGuide.md +++ b/user_docs/en/userGuide.md @@ -136,7 +136,7 @@ The year and version changes between updates to reflect the current release. You may need to wait a few seconds while a temporary copy of NVDA loads. Once loaded, NVDA will speak throughout the rest of the process. 1. The NVDA Launcher window appears with the license agreement button. -Active the "View license" button and `downArrow` to read the license agreement. +Press the "View license" button and `downArrow` to read the license agreement. 1. Press `tab` to move to the "I agree" checkbox, then press the `spacebar` to check it. 1. Press `tab` to move through the options, then press `enter` on the desired option. From 30ab607d4931599628532cbfef9565c22c1b23ab Mon Sep 17 00:00:00 2001 From: Sean Budd Date: Wed, 8 Jan 2025 19:01:13 +1100 Subject: [PATCH 05/12] fix markdown readibility --- copying.txt | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/copying.txt b/copying.txt index d8f34d9c992..70d9fc6bf5c 100644 --- a/copying.txt +++ b/copying.txt @@ -3,7 +3,7 @@ NVDA is available under the GNU General Public License version 2, with two special exceptions. The exceptions are outlined in the sections "Non-GPL Components in Plugins and Drivers" and "Microsoft Distributable Code". NVDA also includes and uses components which are made available under different free and open source licenses. -Information about how to obtain and build the code for yourself is available at http://community.nvda-project.org/wiki/AccessingAndRunningSourceCode +Information about how to obtain and build the code for yourself is available at http://community.nvda-project.org/wiki/AccessingAndRunningSourceCode. All applicable licenses are included below. ## GNU GENERAL PUBLIC LICENSE @@ -306,8 +306,10 @@ DAMAGES. Plugins and drivers, including those provided by third parties, are considered derivative works of NVDA and must therefore be licensed under the terms of the GNU General Public License version 2. As a special exception, an NVDA plugin or driver (as defined in the NVDA Developer Guide) may use components under other licenses provided that: -a) Any such component does not prevent the NVDA plugin or driver from being licensed under the terms of the GNU General Public License version 2; and -b) Any such component does not directly use and is not directly used by any portion of NVDA outside of that plugin or driver. + +a. Any such component does not prevent the NVDA plugin or driver from being licensed under the terms of the GNU General Public License version 2; and + +b. Any such component does not directly use and is not directly used by any portion of NVDA outside of that plugin or driver. For example, a speech synthesizer driver may use a speech synthesiser under a proprietary license. In contrast, in a plugin providing support for an application, the code which implements any interface provided by NVDA must be licensed under the GNU General Public License version 2. @@ -315,22 +317,31 @@ In contrast, in a plugin providing support for an application, the code which im ## Microsoft Distributable Code This applies to the following files: -- mfc*.dll -- Microsoft.VC*.manifest -- msvc*.dll + +* mfc*.dll +* Microsoft.VC*.manifest +* msvc*.dll As a special exception to the GNU General Public License version 2, these components may be included with binary distributions of NVDA without being subject to the terms of that license. Microsoft Distributable Code is covered by the following terms: You may not -a) alter any copyright, trademark or patent notice in the Distributable Code; -b) use Microsoft's trademarks in your programs' names or in a way that suggests your programs come from or are endorsed by Microsoft; -c) distribute Distributable Code to run on a platform other than the Windows platform; -d) include Distributable Code in malicious, deceptive or unlawful programs; or -e) modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that - i) the code be disclosed or distributed in source code form; or - ii) others have the right to modify it. + +a. alter any copyright, trademark or patent notice in the Distributable Code; + +b. use Microsoft's trademarks in your programs' names or in a way that suggests your programs come from or are endorsed by Microsoft; + +c. distribute Distributable Code to run on a platform other than the Windows platform; + +d. include Distributable Code in malicious, deceptive or unlawful programs; or + +e. modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. +An Excluded License is one that requires, as a condition of use, modification or distribution, that + + i. the code be disclosed or distributed in source code form; or + + ii others have the right to modify it. ## Third-Party Dependencies From 97ec6949a9781784a52cf85a0d7bab5d5e8bb35f Mon Sep 17 00:00:00 2001 From: Sean Budd Date: Wed, 8 Jan 2025 19:03:42 +1100 Subject: [PATCH 06/12] fix changes --- copying.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copying.txt b/copying.txt index 70d9fc6bf5c..3326687f33f 100644 --- a/copying.txt +++ b/copying.txt @@ -341,7 +341,7 @@ An Excluded License is one that requires, as a condition of use, modification or i. the code be disclosed or distributed in source code form; or - ii others have the right to modify it. + ii. others have the right to modify it. ## Third-Party Dependencies From 0215d3fba177e26a7b3de13c7ed447831602db68 Mon Sep 17 00:00:00 2001 From: Sean Budd Date: Thu, 9 Jan 2025 10:45:39 +1100 Subject: [PATCH 07/12] use embedded view --- source/gui/startupDialogs.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/source/gui/startupDialogs.py b/source/gui/startupDialogs.py index 4d5012a413e..75ea7b18452 100644 --- a/source/gui/startupDialogs.py +++ b/source/gui/startupDialogs.py @@ -7,11 +7,12 @@ from typing import Set import weakref import wx +import wx.html2 import config from config.configFlags import NVDAKey import core -from documentationUtils import displayLicense +from documentationUtils import _getSanitizedHtmlLicense import globalVars import gui from gui.dpiScalingHelper import DpiScalingHelperMixinWithoutInit @@ -174,7 +175,7 @@ class LauncherDialog( helpId = "InstallingNVDA" - def __init__(self, parent): + def __init__(self, parent: wx.Window | None): super().__init__( parent, title=f"{versionInfo.name} {_('Launcher')}", @@ -216,15 +217,17 @@ def __init__(self, parent): mainSizer.Fit(self) self.CentreOnScreen() - def _createLicenseAgreementGroup(self) -> wx.StaticBoxSizer: + def _createLicenseAgreementGroup(self) -> wx.BoxSizer: + sizer = wx.BoxSizer(wx.VERTICAL) + # Translators: The label of the license text which will be shown when NVDA installation program starts. groupLabel = _("License Agreement") - sizer = wx.StaticBoxSizer(wx.VERTICAL, self, label=groupLabel) + groupText = wx.StaticText(self, label=groupLabel) + sizer.Add(groupText, border=gui.guiHelper.SPACE_BETWEEN_ASSOCIATED_CONTROL_VERTICAL) - # Translators: The label of a button in NVDA installation process to view the license agreement. - viewLicenseButton = wx.Button(self, label=_("&View License")) - viewLicenseButton.Bind(wx.EVT_BUTTON, lambda evt: displayLicense()) - sizer.Add(viewLicenseButton, border=gui.guiHelper.SPACE_BETWEEN_BUTTONS_VERTICAL) + licenseView: wx.html2.WebView = wx.html2.WebView.New(self, size=self.scaleSize((500, 400))) + sizer.Add(licenseView, border=gui.guiHelper.SPACE_BETWEEN_ASSOCIATED_CONTROL_VERTICAL) + licenseView.SetPage(_getSanitizedHtmlLicense(), "") # Translators: The label for a checkbox in NVDA installation process to agree to the license agreement. agreeText = _("I have read and &agree to the license agreement") From d12a774c66881e2b657b379e7dc5e92668de2a5d Mon Sep 17 00:00:00 2001 From: Sean Budd Date: Thu, 9 Jan 2025 12:20:18 +1100 Subject: [PATCH 08/12] fix installer --- source/gui/startupDialogs.py | 2 +- source/setup.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/source/gui/startupDialogs.py b/source/gui/startupDialogs.py index 75ea7b18452..6b240377a08 100644 --- a/source/gui/startupDialogs.py +++ b/source/gui/startupDialogs.py @@ -225,7 +225,7 @@ def _createLicenseAgreementGroup(self) -> wx.BoxSizer: groupText = wx.StaticText(self, label=groupLabel) sizer.Add(groupText, border=gui.guiHelper.SPACE_BETWEEN_ASSOCIATED_CONTROL_VERTICAL) - licenseView: wx.html2.WebView = wx.html2.WebView.New(self, size=self.scaleSize((500, 400))) + licenseView: wx.html2.WebView = wx.html2.WebView.New(self, size=self.scaleSize((550, 400))) sizer.Add(licenseView, border=gui.guiHelper.SPACE_BETWEEN_ASSOCIATED_CONTROL_VERTICAL) licenseView.SetPage(_getSanitizedHtmlLicense(), "") diff --git a/source/setup.py b/source/setup.py index dcb67529d2e..68f1cf755ff 100755 --- a/source/setup.py +++ b/source/setup.py @@ -239,6 +239,8 @@ def _genManifestTemplate(shouldHaveUIAccess: bool) -> tuple[int, int, bytes]: "brailleDisplayDrivers.dotPad", "synthDrivers", "visionEnhancementProviders", + # Required for markdown, markdown implicitly imports this so it isn't picked up + "html.parser", ], "includes": [ "nvdaBuiltin", From bdbcff013ac9f722f9b2424dc1d0cda24528fa5a Mon Sep 17 00:00:00 2001 From: Sean Budd Date: Thu, 9 Jan 2025 14:11:40 +1100 Subject: [PATCH 09/12] Apply suggestions from code review --- user_docs/en/changes.md | 2 +- user_docs/en/userGuide.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/user_docs/en/changes.md b/user_docs/en/changes.md index 8bc078435cf..2d033343c86 100644 --- a/user_docs/en/changes.md +++ b/user_docs/en/changes.md @@ -51,7 +51,7 @@ To use this feature, "allow NVDA to control the volume of other applications" mu * Short versions of the most commonly used command line options have been added: `-d` for `--disable-addons` and `-n` for `--lang`. Prefix matching on command line flags, e.g. using `--di` for `--disable-addons` is no longer supported. (#11644, @CyrilleB79) * The "Contributors" file was removed from the NVDA menu. (#16922) -* The NVDA license is now formatted as an HTML browseable message to improve readability. (#17600) +* The NVDA license is now formatted in HTML to improve readability. (#17600) ### Bug Fixes diff --git a/user_docs/en/userGuide.md b/user_docs/en/userGuide.md index c03e5df4d49..17ac3cd2ace 100644 --- a/user_docs/en/userGuide.md +++ b/user_docs/en/userGuide.md @@ -135,8 +135,8 @@ The year and version changes between updates to reflect the current release. 1. Run the downloaded file. You may need to wait a few seconds while a temporary copy of NVDA loads. Once loaded, NVDA will speak throughout the rest of the process. -1. The NVDA Launcher window appears with the license agreement button. -Press the "View license" button and `downArrow` to read the license agreement. +1. The NVDA Launcher window appears with the license agreement. +Press the `downArrow` to read the license agreement. 1. Press `tab` to move to the "I agree" checkbox, then press the `spacebar` to check it. 1. Press `tab` to move through the options, then press `enter` on the desired option. From e40448b489ee004125453da2cb44aeb9b0161ece Mon Sep 17 00:00:00 2001 From: Sean Budd Date: Tue, 14 Jan 2025 13:47:23 +1100 Subject: [PATCH 10/12] address review comments --- copying.txt | 20 ++++++++++---------- source/documentationUtils.py | 2 +- source/gui/startupDialogs.py | 3 +++ source/setup.py | 2 +- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/copying.txt b/copying.txt index 3326687f33f..8367542d7cf 100644 --- a/copying.txt +++ b/copying.txt @@ -3,20 +3,20 @@ NVDA is available under the GNU General Public License version 2, with two special exceptions. The exceptions are outlined in the sections "Non-GPL Components in Plugins and Drivers" and "Microsoft Distributable Code". NVDA also includes and uses components which are made available under different free and open source licenses. -Information about how to obtain and build the code for yourself is available at http://community.nvda-project.org/wiki/AccessingAndRunningSourceCode. +Information about how to obtain and build the code for yourself is available at . All applicable licenses are included below. ## GNU GENERAL PUBLIC LICENSE -https://www.gnu.org/licenses/old-licenses/gpl-2.0.html +This might be a security risk from secure mode? + Version 2, June 1991 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - +Copyright (C) 1989, 1991 Free Software Foundation, Inc. + - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. ### Preamble @@ -318,9 +318,9 @@ In contrast, in a plugin providing support for an application, the code which im This applies to the following files: -* mfc*.dll -* Microsoft.VC*.manifest -* msvc*.dll +* `mfc*.dll` +* `Microsoft.VC*.manifest` +* `msvc*.dll` As a special exception to the GNU General Public License version 2, these components may be included with binary distributions of NVDA without being subject to the terms of that license. @@ -360,4 +360,4 @@ In addition to these dependencies, the following are also included in NVDA: Furthermore, NVDA also utilises some static/binary dependencies, details of which can be found at the following URL: -https://github.com/nvaccess/nvda-misc-deps/tree/master + diff --git a/source/documentationUtils.py b/source/documentationUtils.py index 5fd078684c1..3f4989203e7 100644 --- a/source/documentationUtils.py +++ b/source/documentationUtils.py @@ -1,6 +1,6 @@ # -*- coding: UTF-8 -*- # A part of NonVisual Desktop Access (NVDA) -# Copyright (C) 2006-2024 NV Access Limited, Łukasz Golonka +# Copyright (C) 2006-2025 NV Access Limited, Łukasz Golonka # This file may be used under the terms of the GNU General Public License, version 2 or later. # For more details see: https://www.gnu.org/licenses/gpl-2.0.html diff --git a/source/gui/startupDialogs.py b/source/gui/startupDialogs.py index 6b240377a08..4a0d2eb99b3 100644 --- a/source/gui/startupDialogs.py +++ b/source/gui/startupDialogs.py @@ -225,6 +225,9 @@ def _createLicenseAgreementGroup(self) -> wx.BoxSizer: groupText = wx.StaticText(self, label=groupLabel) sizer.Add(groupText, border=gui.guiHelper.SPACE_BETWEEN_ASSOCIATED_CONTROL_VERTICAL) + # Arbitrary size which fills the dialog and is readable. + # Note that a webview doesn't expand with wx.EXPAND and being added to the sizer, + # a minimum size is needed to make it readable. licenseView: wx.html2.WebView = wx.html2.WebView.New(self, size=self.scaleSize((550, 400))) sizer.Add(licenseView, border=gui.guiHelper.SPACE_BETWEEN_ASSOCIATED_CONTROL_VERTICAL) licenseView.SetPage(_getSanitizedHtmlLicense(), "") diff --git a/source/setup.py b/source/setup.py index 68f1cf755ff..f1eed778a95 100755 --- a/source/setup.py +++ b/source/setup.py @@ -1,6 +1,6 @@ # -*- coding: UTF-8 -*- # A part of NonVisual Desktop Access (NVDA) -# Copyright (C) 2006-2024 NV Access Limited, Peter Vágner, Joseph Lee +# Copyright (C) 2006-2025 NV Access Limited, Peter Vágner, Joseph Lee # This file is covered by the GNU General Public License. # See the file COPYING for more details. From 3f2f2f12895f6b1d874c343ca20efe7f334aed58 Mon Sep 17 00:00:00 2001 From: Sean Budd Date: Tue, 14 Jan 2025 13:55:40 +1100 Subject: [PATCH 11/12] fixups --- contributors.txt | 2 +- copying.txt | 1 - source/documentationUtils.py | 4 ++++ source/gui/__init__.py | 8 ++++---- user_docs/en/changes.md | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/contributors.txt b/contributors.txt index e79112bc23c..ce4ffcedd08 100644 --- a/contributors.txt +++ b/contributors.txt @@ -1,7 +1,7 @@ This is a list of people and organizations that contributed to the NVDA project in various ways since the beginning of the project. +This list was archived in January 2025, and is no longer being maintained. For an overview of code contributors, see also https://github.com/nvaccess/nvda/graphs/contributors. For a list of active contributors, see the experts list https://github.com/nvaccess/nvda/blob/master/projectDocs/community/expertsList.md -This list is now archived. NV Access Limited Michael Curran diff --git a/copying.txt b/copying.txt index 8367542d7cf..73a01041066 100644 --- a/copying.txt +++ b/copying.txt @@ -8,7 +8,6 @@ All applicable licenses are included below. ## GNU GENERAL PUBLIC LICENSE -This might be a security risk from secure mode? Version 2, June 1991 diff --git a/source/documentationUtils.py b/source/documentationUtils.py index 3f4989203e7..0b5515ab67b 100644 --- a/source/documentationUtils.py +++ b/source/documentationUtils.py @@ -11,6 +11,7 @@ import nh3 import globalVars +from gui import blockAction import languageHandler import NVDAState from logHandler import log @@ -88,7 +89,10 @@ def _getSanitizedHtmlLicense() -> str: return nh3.clean(htmlLicense) +@blockAction.when(blockAction.Context.SECURE_MODE) def displayLicense(): + # HTML includes links which shouldn't be accessible + # in secure contexts as it opens a browser. ui.browseableMessage( _getSanitizedHtmlLicense(), # Translators: The title of the dialog to show the NVDA License. diff --git a/source/gui/__init__.py b/source/gui/__init__.py index 2bb88881fa2..010ac2b4285 100644 --- a/source/gui/__init__.py +++ b/source/gui/__init__.py @@ -804,6 +804,10 @@ def _appendHelpSubMenu(self, frame: MainFrame) -> None: self.helpMenu.AppendSeparator() + # Translators: The label for the menu item to view the NVDA License. + item = self.helpMenu.Append(wx.ID_ANY, _("L&icense")) + self.Bind(wx.EVT_MENU, lambda evt: displayLicense(), item) + # Translators: The label for the menu item to open NVDA Welcome Dialog. item = self.helpMenu.Append(wx.ID_ANY, _("We&lcome dialog...")) self.Bind(wx.EVT_MENU, lambda evt: WelcomeDialog.run(), item) @@ -817,10 +821,6 @@ def _appendHelpSubMenu(self, frame: MainFrame) -> None: item = self.helpMenu.Append(wx.ID_ABOUT, _("&About..."), _("About NVDA")) self.Bind(wx.EVT_MENU, frame.onAboutCommand, item) - # Translators: The label for the menu item to view the NVDA License. - item = self.helpMenu.Append(wx.ID_ANY, _("L&icense")) - self.Bind(wx.EVT_MENU, lambda evt: displayLicense(), item) - # Translators: The label for the Help submenu in NVDA menu. self.menu.AppendSubMenu(self.helpMenu, _("&Help")) diff --git a/user_docs/en/changes.md b/user_docs/en/changes.md index 01745e4f0b5..400ff3febef 100644 --- a/user_docs/en/changes.md +++ b/user_docs/en/changes.md @@ -51,7 +51,7 @@ To use this feature, "allow NVDA to control the volume of other applications" mu * Updated CLDR to version 46.0. (#17484, @OzancanKaratas) * Short versions of the most commonly used command line options have been added: `-d` for `--disable-addons` and `-n` for `--lang`. Prefix matching on command line flags, e.g. using `--di` for `--disable-addons` is no longer supported. (#11644, @CyrilleB79) -* The "Contributors" file was removed from the NVDA menu. (#16922) +* The "Contributors" file has been removed from the NVDA menu. (#16922) * The NVDA license is now formatted in HTML to improve readability. (#17600) * Microsoft Speech API version 5 and Microsoft Speech Platform voices now use WASAPI for audio output, which may improve the responsiveness of those voices. (#13284, @gexgd0419) From 04f2242b47e364a6ab0d7dc6b242b59103f64ec6 Mon Sep 17 00:00:00 2001 From: Sean Budd Date: Tue, 21 Jan 2025 13:18:15 +1100 Subject: [PATCH 12/12] remove _displayTextFileWorkaround --- source/systemUtils.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/source/systemUtils.py b/source/systemUtils.py index 3d6bbf85dbe..1549d6a5449 100644 --- a/source/systemUtils.py +++ b/source/systemUtils.py @@ -1,6 +1,6 @@ # -*- coding: UTF-8 -*- # A part of NonVisual Desktop Access (NVDA) -# Copyright (C) 2020-2023 NV Access Limited, Łukasz Golonka, Luke Davis +# Copyright (C) 2020-2025 NV Access Limited, Łukasz Golonka, Luke Davis # This file may be used under the terms of the GNU General Public License, version 2 or later. # For more details see: https://www.gnu.org/licenses/gpl-2.0.html @@ -35,7 +35,6 @@ import winUser import functools import shlobj -from os import startfile from logHandler import log from NVDAState import WritePaths @@ -188,15 +187,6 @@ def _getDesktopName() -> str: return name.value -def _displayTextFileWorkaround(file: str) -> None: - # os.startfile does not currently (NVDA 2023.1, Python 3.7) work reliably to open .txt files in Notepad under - # Windows 11, if relying on the default behavior (i.e. `operation="open"`). (#14725) - # Using `operation="edit"`, however, has the desired effect--opening the text file in Notepad. (#14816) - # Since this may be a bug in Python 3.7's os.startfile, or the underlying Win32 function, it may be - # possible to deprecate this workaround after a Python upgrade. - startfile(file, operation="edit") - - def _isSystemClockSecondsVisible() -> bool: """ Query the value of 'ShowSecondsInSystemClock' DWORD32 value in the Windows registry under