|
1 | 1 | # -*- coding: UTF-8 -*- |
2 | 2 | # A part of NonVisual Desktop Access (NVDA) |
3 | | -# Copyright (C) 2006-2023 NV Access Limited, Łukasz Golonka, Cyrille Bougot |
| 3 | +# Copyright (C) 2006-2025 NV Access Limited, Łukasz Golonka, Cyrille Bougot |
4 | 4 | # This file may be used under the terms of the GNU General Public License, version 2 or later. |
5 | 5 | # For more details see: https://www.gnu.org/licenses/gpl-2.0.html |
6 | 6 |
|
|
11 | 11 | import config |
12 | 12 | from config.configFlags import NVDAKey |
13 | 13 | import core |
14 | | -from documentationUtils import getDocFilePath |
| 14 | +from documentationUtils import displayLicense |
15 | 15 | import globalVars |
16 | 16 | import gui |
17 | 17 | from gui.dpiScalingHelper import DpiScalingHelperMixinWithoutInit |
| 18 | +import gui.guiHelper |
18 | 19 | import keyboardHandler |
19 | 20 | from logHandler import log |
20 | 21 | import versionInfo |
@@ -184,12 +185,6 @@ def __init__(self, parent): |
184 | 185 |
|
185 | 186 | sHelper.addItem(self._createLicenseAgreementGroup()) |
186 | 187 |
|
187 | | - # Translators: The label for a checkbox in NvDA installation program to agree to the license agreement. |
188 | | - agreeText = _("I &agree") |
189 | | - self.licenseAgreeCheckbox = sHelper.addItem(wx.CheckBox(self, label=agreeText)) |
190 | | - self.licenseAgreeCheckbox.Value = False |
191 | | - self.licenseAgreeCheckbox.Bind(wx.EVT_CHECKBOX, self.onLicenseAgree) |
192 | | - |
193 | 188 | sizer = sHelper.addItem(wx.GridSizer(2, 2, 0, 0)) |
194 | 189 | self.actionButtons = [] |
195 | 190 | # 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: |
225 | 220 | # Translators: The label of the license text which will be shown when NVDA installation program starts. |
226 | 221 | groupLabel = _("License Agreement") |
227 | 222 | sizer = wx.StaticBoxSizer(wx.VERTICAL, self, label=groupLabel) |
228 | | - # Create a fake text control to determine appropriate width of license text box |
229 | | - _fakeTextCtrl = wx.StaticText( |
230 | | - self, |
231 | | - label="a" * 80, # The GPL2 text of copying.txt wraps sentences at 80 characters |
232 | | - ) |
233 | | - widthOfLicenseText = _fakeTextCtrl.Size[0] |
234 | | - _fakeTextCtrl.Destroy() |
235 | | - licenseTextCtrl = wx.TextCtrl( |
236 | | - self, |
237 | | - size=(widthOfLicenseText, self.scaleSize(300)), |
238 | | - style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH, |
239 | | - ) |
240 | | - licenseTextCtrl.Value = open(getDocFilePath("copying.txt", False), "r", encoding="UTF-8").read() |
241 | | - sizer.Add( |
242 | | - licenseTextCtrl, |
243 | | - flag=wx.EXPAND, |
244 | | - proportion=1, |
245 | | - ) |
| 223 | + |
| 224 | + # Translators: The label of a button in NVDA installation process to view the license agreement. |
| 225 | + viewLicenseButton = wx.Button(self, label=_("&View License")) |
| 226 | + viewLicenseButton.Bind(wx.EVT_BUTTON, lambda evt: displayLicense()) |
| 227 | + sizer.Add(viewLicenseButton, border=gui.guiHelper.SPACE_BETWEEN_BUTTONS_VERTICAL) |
| 228 | + |
| 229 | + # Translators: The label for a checkbox in NVDA installation process to agree to the license agreement. |
| 230 | + agreeText = _("I have read and &agree to the license agreement") |
| 231 | + self.licenseAgreeCheckbox = wx.CheckBox(self, label=agreeText) |
| 232 | + self.licenseAgreeCheckbox.SetValue(False) |
| 233 | + self.licenseAgreeCheckbox.Bind(wx.EVT_CHECKBOX, self.onLicenseAgree) |
| 234 | + sizer.Add(self.licenseAgreeCheckbox, border=gui.guiHelper.SPACE_BETWEEN_ASSOCIATED_CONTROL_VERTICAL) |
| 235 | + |
246 | 236 | return sizer |
247 | 237 |
|
248 | 238 | def onLicenseAgree(self, evt): |
|
0 commit comments