Skip to content

Commit de830fa

Browse files
authored
Merge 23ed95e into 52bf1ed
2 parents 52bf1ed + 23ed95e commit de830fa

File tree

5 files changed

+152
-132
lines changed

5 files changed

+152
-132
lines changed

source/gui/__init__.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -725,14 +725,10 @@ def __init__(self, parent):
725725
welcomeTextDetail = wx.StaticText(self, wx.ID_ANY, self.WELCOME_MESSAGE_DETAIL)
726726
mainSizer.Add(welcomeTextDetail,border=20,flag=wx.EXPAND|wx.LEFT|wx.RIGHT)
727727

728-
optionsSizer = wx.StaticBoxSizer(
729-
wx.StaticBox(
730-
self,
731-
# Translators: The label for a group box containing the NVDA welcome dialog options.
732-
label=_("Options")
733-
),
734-
wx.VERTICAL
735-
)
728+
# Translators: The label for a group box containing the NVDA welcome dialog options.
729+
optionsLabel = _("Options")
730+
optionsSizer = wx.StaticBoxSizer(wx.VERTICAL, self, label=optionsLabel)
731+
optionsBox = optionsSizer.GetStaticBox()
736732
sHelper = guiHelper.BoxSizerHelper(self, sizer=optionsSizer)
737733
# Translators: The label of a combobox in the Welcome dialog.
738734
kbdLabelText = _("&Keyboard layout:")
@@ -747,17 +743,17 @@ def __init__(self, parent):
747743
log.error("Could not set Keyboard layout list to current layout",exc_info=True)
748744
# Translators: The label of a checkbox in the Welcome dialog.
749745
capsAsNVDAModifierText = _("&Use CapsLock as an NVDA modifier key")
750-
self.capsAsNVDAModifierCheckBox = sHelper.addItem(wx.CheckBox(self, label=capsAsNVDAModifierText))
746+
self.capsAsNVDAModifierCheckBox = sHelper.addItem(wx.CheckBox(optionsBox, label=capsAsNVDAModifierText))
751747
self.capsAsNVDAModifierCheckBox.SetValue(config.conf["keyboard"]["useCapsLockAsNVDAModifierKey"])
752748
# Translators: The label of a checkbox in the Welcome dialog.
753749
startAfterLogonText = _("St&art NVDA after I sign in")
754-
self.startAfterLogonCheckBox = sHelper.addItem(wx.CheckBox(self, label=startAfterLogonText))
750+
self.startAfterLogonCheckBox = sHelper.addItem(wx.CheckBox(optionsBox, label=startAfterLogonText))
755751
self.startAfterLogonCheckBox.Value = config.getStartAfterLogon()
756752
if globalVars.appArgs.secure or config.isAppX or not config.isInstalledCopy():
757753
self.startAfterLogonCheckBox.Disable()
758754
# Translators: The label of a checkbox in the Welcome dialog.
759755
showWelcomeDialogAtStartupText = _("&Show this dialog when NVDA starts")
760-
self.showWelcomeDialogAtStartupCheckBox = sHelper.addItem(wx.CheckBox(self, label=showWelcomeDialogAtStartupText))
756+
self.showWelcomeDialogAtStartupCheckBox = sHelper.addItem(wx.CheckBox(optionsBox, label=showWelcomeDialogAtStartupText))
761757
self.showWelcomeDialogAtStartupCheckBox.SetValue(config.conf["general"]["showWelcomeDialogAtStartup"])
762758
mainSizer.Add(optionsSizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL)
763759
mainSizer.Add(self.CreateButtonSizer(wx.OK), border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL|wx.ALIGN_RIGHT)
@@ -810,7 +806,8 @@ def __init__(self, parent):
810806

811807
# Translators: The label of the license text which will be shown when NVDA installation program starts.
812808
groupLabel = _("License Agreement")
813-
sizer = sHelper.addItem(wx.StaticBoxSizer(wx.StaticBox(self, label=groupLabel), wx.VERTICAL))
809+
sizer = wx.StaticBoxSizer(wx.VERTICAL, self, label=groupLabel)
810+
sHelper.addItem(sizer)
814811
licenseTextCtrl = wx.TextCtrl(self, size=(500, 400), style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH)
815812
licenseTextCtrl.Value = codecs.open(getDocFilePath("copying.txt", False), "r", encoding="UTF-8").read()
816813
sizer.Add(licenseTextCtrl)

source/gui/configProfiles.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@ def __init__(self, parent):
4242

4343
mainSizer = wx.BoxSizer(wx.VERTICAL)
4444
sHelper = guiHelper.BoxSizerHelper(self,orientation=wx.VERTICAL)
45-
profilesListGroupSizer = wx.StaticBoxSizer(wx.StaticBox(self), wx.HORIZONTAL)
45+
profilesListGroupSizer = wx.StaticBoxSizer(wx.HORIZONTAL, self)
46+
profilesListBox = profilesListGroupSizer.GetStaticBox()
4647
profilesListGroupContents = wx.BoxSizer(wx.HORIZONTAL)
4748

4849
#contains the profile list and activation button in vertical arrangement.
4950
changeProfilesSizer = wx.BoxSizer(wx.VERTICAL)
50-
item = self.profileList = wx.ListBox(self,
51+
item = self.profileList = wx.ListBox(profilesListBox,
5152
choices=[self.getProfileDisplay(name, includeStates=True) for name in self.profileNames])
5253
self.bindHelpEvent("ProfilesBasicManagement", self.profileList)
5354
item.Bind(wx.EVT_LISTBOX, self.onProfileListChoice)
@@ -56,7 +57,7 @@ def __init__(self, parent):
5657

5758
changeProfilesSizer.AddSpacer(guiHelper.SPACE_BETWEEN_BUTTONS_VERTICAL)
5859

59-
self.changeStateButton = wx.Button(self)
60+
self.changeStateButton = wx.Button(profilesListBox)
6061
self.bindHelpEvent("ConfigProfileManual", self.changeStateButton)
6162
self.changeStateButton.Bind(wx.EVT_BUTTON, self.onChangeState)
6263
self.AffirmativeId = self.changeStateButton.Id
@@ -68,17 +69,17 @@ def __init__(self, parent):
6869

6970
buttonHelper = guiHelper.ButtonHelper(wx.VERTICAL)
7071
# Translators: The label of a button to create a new configuration profile.
71-
newButton = buttonHelper.addButton(self, label=_("&New"))
72+
newButton = buttonHelper.addButton(profilesListBox, label=_("&New"))
7273
self.bindHelpEvent("ProfilesCreating", newButton)
7374
newButton.Bind(wx.EVT_BUTTON, self.onNew)
7475

7576
# Translators: The label of a button to rename a configuration profile.
76-
self.renameButton = buttonHelper.addButton(self, label=_("&Rename"))
77+
self.renameButton = buttonHelper.addButton(profilesListBox, label=_("&Rename"))
7778
self.bindHelpEvent("ProfilesBasicManagement", self.renameButton)
7879
self.renameButton.Bind(wx.EVT_BUTTON, self.onRename)
7980

8081
# Translators: The label of a button to delete a configuration profile.
81-
self.deleteButton = buttonHelper.addButton(self, label=_("&Delete"))
82+
self.deleteButton = buttonHelper.addButton(profilesListBox, label=_("&Delete"))
8283
self.bindHelpEvent("ProfilesBasicManagement", self.deleteButton)
8384
self.deleteButton.Bind(wx.EVT_BUTTON, self.onDelete)
8485

source/gui/guiHelper.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,10 @@ def addLabeledControl(self, labelText, wxCtrlClass, **kwargs):
324324
Relies on guiHelper.LabeledControlHelper and thus guiHelper.associateElements, and therefore inherits any
325325
limitations from there.
326326
"""
327-
labeledControl = LabeledControlHelper(self._parent, labelText, wxCtrlClass, **kwargs)
327+
parent = self._parent
328+
if isinstance(self.sizer, wx.StaticBoxSizer):
329+
parent = self.sizer.GetStaticBox()
330+
labeledControl = LabeledControlHelper(parent, labelText, wxCtrlClass, **kwargs)
328331
if(isinstance(labeledControl.control, (wx.ListCtrl,wx.ListBox,wx.TreeCtrl))):
329332
self.addItem(labeledControl.sizer, flag=wx.EXPAND, proportion=1)
330333
else:
@@ -345,6 +348,9 @@ def addDialogDismissButtons(self, buttons, separated=False):
345348
Should be set to L{False} for message or single input dialogs, L{True} otherwise.
346349
@type separated: L{bool}
347350
"""
351+
parent = self._parent
352+
if isinstance(self.sizer, wx.StaticBoxSizer):
353+
parent = self.sizer.GetStaticBox()
348354
if self.sizer.GetOrientation() != wx.VERTICAL:
349355
raise NotImplementedError(
350356
"Adding dialog dismiss buttons to a horizontal BoxSizerHelper is not implemented."
@@ -354,16 +360,15 @@ def addDialogDismissButtons(self, buttons, separated=False):
354360
elif isinstance(buttons, (wx.Sizer, wx.Button)):
355361
toAdd = buttons
356362
elif isinstance(buttons, int):
357-
toAdd = self._parent.CreateButtonSizer(buttons)
363+
toAdd = parent.CreateButtonSizer(buttons)
358364
else:
359365
raise NotImplementedError("Unknown type: {}".format(buttons))
360366
if separated:
361-
self.addItem(wx.StaticLine(self._parent), flag=wx.EXPAND)
367+
self.addItem(wx.StaticLine(parent), flag=wx.EXPAND)
362368
self.addItem(toAdd, flag=wx.ALIGN_RIGHT)
363369
self.dialogDismissButtonsAdded = True
364370
return buttons
365371

366372
class SIPABCMeta(wx.siplib.wrappertype, ABCMeta):
367373
"""Meta class to be used for wx subclasses with abstract methods."""
368374
pass
369-

source/gui/installerGui.py

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -175,18 +175,15 @@ def __init__(self, parent, isUpdate):
175175
self.bindHelpEvent("InstallWithIncompatibleAddons", self.confirmationCheckbox)
176176
self.confirmationCheckbox.SetFocus()
177177

178-
optionsSizer = guiHelper.BoxSizerHelper(self, sizer=sHelper.addItem(wx.StaticBoxSizer(
179-
wx.StaticBox(
180-
self,
181-
# Translators: The label for a group box containing the NVDA installation dialog options.
182-
label=_("Options")
183-
),
184-
wx.VERTICAL
185-
)))
178+
# Translators: The label for a group box containing the NVDA installation dialog options.
179+
optionsLabel = _("Options")
180+
optionsHelper = sHelper.addItem(wx.StaticBoxSizer(wx.VERTICAL, self, label=optionsLabel))
181+
optionsSizer = guiHelper.BoxSizerHelper(self, sizer=optionsHelper)
182+
optionsBox = optionsSizer.GetStaticBox()
186183

187184
# Translators: The label of a checkbox option in the Install NVDA dialog.
188185
startOnLogonText = _("Use NVDA during sign-in")
189-
self.startOnLogonCheckbox = optionsSizer.addItem(wx.CheckBox(self, label=startOnLogonText))
186+
self.startOnLogonCheckbox = optionsSizer.addItem(wx.CheckBox(optionsBox, label=startOnLogonText))
190187
self.bindHelpEvent("StartAtWindowsLogon", self.startOnLogonCheckbox)
191188
if globalVars.appArgs.enableStartOnLogon is not None:
192189
self.startOnLogonCheckbox.Value = globalVars.appArgs.enableStartOnLogon
@@ -197,19 +194,22 @@ def __init__(self, parent, isUpdate):
197194
if self.isUpdate and shortcutIsPrevInstalled:
198195
# Translators: The label of a checkbox option in the Install NVDA dialog.
199196
keepShortCutText = _("&Keep existing desktop shortcut")
200-
self.createDesktopShortcutCheckbox = optionsSizer.addItem(wx.CheckBox(self, label=keepShortCutText))
197+
keepShortCutBox = wx.CheckBox(optionsBox, label=keepShortCutText)
198+
self.createDesktopShortcutCheckbox = optionsSizer.addItem(keepShortCutBox)
201199
else:
202200
# Translators: The label of the option to create a desktop shortcut in the Install NVDA dialog.
203201
# If the shortcut key has been changed for this locale,
204202
# this change must also be reflected here.
205203
createShortcutText = _("Create &desktop icon and shortcut key (control+alt+n)")
206-
self.createDesktopShortcutCheckbox = optionsSizer.addItem(wx.CheckBox(self, label=createShortcutText))
204+
createShortcutBox = wx.CheckBox(optionsBox, label=createShortcutText)
205+
self.createDesktopShortcutCheckbox = optionsSizer.addItem(createShortcutBox)
207206
self.bindHelpEvent("CreateDesktopShortcut", self.createDesktopShortcutCheckbox)
208207
self.createDesktopShortcutCheckbox.Value = shortcutIsPrevInstalled if self.isUpdate else True
209208

210209
# Translators: The label of a checkbox option in the Install NVDA dialog.
211210
createPortableText = _("Copy &portable configuration to current user account")
212-
self.copyPortableConfigCheckbox = optionsSizer.addItem(wx.CheckBox(self, label=createPortableText))
211+
createPortableBox = wx.CheckBox(optionsBox, label=createPortableText)
212+
self.copyPortableConfigCheckbox = optionsSizer.addItem(createPortableBox)
213213
self.bindHelpEvent("CopyPortableConfigurationToCurrentUserAccount", self.copyPortableConfigCheckbox)
214214
self.copyPortableConfigCheckbox.Value = bool(globalVars.appArgs.copyPortableConfig)
215215
if globalVars.appArgs.copyPortableConfig is None:
@@ -220,12 +220,12 @@ def __init__(self, parent, isUpdate):
220220
bHelper = sHelper.addDialogDismissButtons(guiHelper.ButtonHelper(wx.HORIZONTAL))
221221
if shouldAskAboutAddons:
222222
# Translators: The label of a button to launch the add-on compatibility review dialog.
223-
reviewAddonButton = bHelper.addButton(self, label=_("&Review add-ons..."))
223+
reviewAddonButton = bHelper.addButton(optionsBox, label=_("&Review add-ons..."))
224224
self.bindHelpEvent("InstallWithIncompatibleAddons", reviewAddonButton)
225225
reviewAddonButton.Bind(wx.EVT_BUTTON, self.onReviewAddons)
226226

227227
# Translators: The label of a button to continue with the operation.
228-
continueButton = bHelper.addButton(self, label=_("&Continue"), id=wx.ID_OK)
228+
continueButton = bHelper.addButton(optionsBox, label=_("&Continue"), id=wx.ID_OK)
229229
continueButton.SetDefault()
230230
continueButton.Bind(wx.EVT_BUTTON, self.onInstall)
231231
if shouldAskAboutAddons:
@@ -235,7 +235,7 @@ def __init__(self, parent, isUpdate):
235235
)
236236
continueButton.Enable(False)
237237

238-
bHelper.addButton(self, id=wx.ID_CANCEL)
238+
bHelper.addButton(optionsBox, id=wx.ID_CANCEL)
239239
# If we bind this using button.Bind, it fails to trigger when the dialog is closed.
240240
self.Bind(wx.EVT_BUTTON, self.onCancel, id=wx.ID_CANCEL)
241241

@@ -349,35 +349,38 @@ def __init__(self, parent):
349349
# Translators: The label of a grouping containing controls to select the destination directory
350350
# in the Create Portable NVDA dialog.
351351
directoryGroupText = _("Portable &directory:")
352-
groupHelper = sHelper.addItem(gui.guiHelper.BoxSizerHelper(self, sizer=wx.StaticBoxSizer(wx.StaticBox(self, label=directoryGroupText), wx.VERTICAL)))
352+
groupSizer = wx.StaticBoxSizer(wx.VERTICAL, self, label=directoryGroupText)
353+
groupHelper = sHelper.addItem(gui.guiHelper.BoxSizerHelper(self, sizer=groupSizer))
354+
groupBox = groupSizer.GetStaticBox()
353355
# Translators: The label of a button to browse for a directory.
354356
browseText = _("Browse...")
355357
# Translators: The title of the dialog presented when browsing for the
356358
# destination directory when creating a portable copy of NVDA.
357359
dirDialogTitle = _("Select portable directory")
358-
directoryEntryControl = groupHelper.addItem(gui.guiHelper.PathSelectionHelper(self, browseText, dirDialogTitle))
360+
directoryPathHelper = gui.guiHelper.PathSelectionHelper(groupBox, browseText, dirDialogTitle)
361+
directoryEntryControl = groupHelper.addItem(directoryPathHelper)
359362
self.portableDirectoryEdit = directoryEntryControl.pathControl
360363
if globalVars.appArgs.portablePath:
361364
self.portableDirectoryEdit.Value = globalVars.appArgs.portablePath
362365

363366
# Translators: The label of a checkbox option in the Create Portable NVDA dialog.
364367
copyConfText = _("Copy current &user configuration")
365-
self.copyUserConfigCheckbox = sHelper.addItem(wx.CheckBox(self, label=copyConfText))
368+
self.copyUserConfigCheckbox = sHelper.addItem(wx.CheckBox(groupBox, label=copyConfText))
366369
self.copyUserConfigCheckbox.Value = False
367370
if globalVars.appArgs.launcher:
368371
self.copyUserConfigCheckbox.Disable()
369372
# Translators: The label of a checkbox option in the Create Portable NVDA dialog.
370373
startAfterCreateText = _("&Start the new portable copy after creation")
371-
self.startAfterCreateCheckbox = sHelper.addItem(wx.CheckBox(self, label=startAfterCreateText))
374+
self.startAfterCreateCheckbox = sHelper.addItem(wx.CheckBox(groupBox, label=startAfterCreateText))
372375
self.startAfterCreateCheckbox.Value = False
373376

374377
bHelper = sHelper.addDialogDismissButtons(gui.guiHelper.ButtonHelper(wx.HORIZONTAL), separated=True)
375378

376-
continueButton = bHelper.addButton(self, label=_("&Continue"), id=wx.ID_OK)
379+
continueButton = bHelper.addButton(groupBox, label=_("&Continue"), id=wx.ID_OK)
377380
continueButton.SetDefault()
378381
continueButton.Bind(wx.EVT_BUTTON, self.onCreatePortable)
379382

380-
bHelper.addButton(self, id=wx.ID_CANCEL)
383+
bHelper.addButton(groupBox, id=wx.ID_CANCEL)
381384
# If we bind this using button.Bind, it fails to trigger when the dialog is closed.
382385
self.Bind(wx.EVT_BUTTON, self.onCancel, id=wx.ID_CANCEL)
383386

0 commit comments

Comments
 (0)