Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions source/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,14 +725,9 @@ def __init__(self, parent):
welcomeTextDetail = wx.StaticText(self, wx.ID_ANY, self.WELCOME_MESSAGE_DETAIL)
mainSizer.Add(welcomeTextDetail,border=20,flag=wx.EXPAND|wx.LEFT|wx.RIGHT)

optionsSizer = wx.StaticBoxSizer(
wx.StaticBox(
self,
# Translators: The label for a group box containing the NVDA welcome dialog options.
label=_("Options")
),
wx.VERTICAL
)
# Translators: The label for a group box containing the NVDA welcome dialog options.
optionsLabel = _("Options")
optionsSizer = guiHelper.LTRStaticBoxSizer(wx.VERTICAL, self, label=optionsLabel)
sHelper = guiHelper.BoxSizerHelper(self, sizer=optionsSizer)
# Translators: The label of a combobox in the Welcome dialog.
kbdLabelText = _("&Keyboard layout:")
Expand Down Expand Up @@ -810,7 +805,7 @@ def __init__(self, parent):

# Translators: The label of the license text which will be shown when NVDA installation program starts.
groupLabel = _("License Agreement")
sizer = sHelper.addItem(wx.StaticBoxSizer(wx.StaticBox(self, label=groupLabel), wx.VERTICAL))
sizer = sHelper.addItem(guiHelper.LTRStaticBoxSizer(wx.VERTICAL, self, label=groupLabel))
licenseTextCtrl = wx.TextCtrl(self, size=(500, 400), style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH)
licenseTextCtrl.Value = codecs.open(getDocFilePath("copying.txt", False), "r", encoding="UTF-8").read()
sizer.Add(licenseTextCtrl)
Expand Down
4 changes: 2 additions & 2 deletions source/gui/configProfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(self, parent):

mainSizer = wx.BoxSizer(wx.VERTICAL)
sHelper = guiHelper.BoxSizerHelper(self,orientation=wx.VERTICAL)
profilesListGroupSizer = wx.StaticBoxSizer(wx.StaticBox(self), wx.HORIZONTAL)
profilesListGroupSizer = guiHelper.LTRStaticBoxSizer(wx.HORIZONTAL, self)
profilesListGroupContents = wx.BoxSizer(wx.HORIZONTAL)

#contains the profile list and activation button in vertical arrangement.
Expand Down Expand Up @@ -84,7 +84,7 @@ def __init__(self, parent):

profilesListGroupContents.Add(buttonHelper.sizer)
profilesListGroupSizer.Add(profilesListGroupContents, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL)
sHelper.addItem(profilesListGroupSizer)
sHelper.addItem(profilesListGroupSizer.GetStaticBox())

# Translators: The label of a button to manage triggers
# in the Configuration Profiles dialog.
Expand Down
15 changes: 15 additions & 0 deletions source/gui/guiHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,11 @@ def addItem(self, item, **keywordArgs):
if isinstance(toAdd, (wx.StaticBoxSizer, scrolledpanel.ScrolledPanel)):
keywordArgs["flag"] = keywordArgs.get("flag", 0) | wx.EXPAND

if isinstance(toAdd, wx.StaticBoxSizer):
toAdd = toAdd.GetStaticBox()
if isinstance(toAdd, wx.Box):
toAdd.SetContainingSizer(None)

if shouldAddSpacer:
self.sizer.AddSpacer(SPACE_BETWEEN_VERTICAL_DIALOG_ITEMS)
self.sizer.Add(toAdd, **keywordArgs)
Expand Down Expand Up @@ -367,3 +372,13 @@ class SIPABCMeta(wx.siplib.wrappertype, ABCMeta):
"""Meta class to be used for wx subclasses with abstract methods."""
pass


class LTRStaticBoxSizer(wx.StaticBoxSizer):
"""
An Overridden StaticBoxSizer as the original is buggy for RTL languages
Awaiting bug-fix for issue: https://trac.wxwidgets.org/ticket/19086
This override has a side effect of left alignment of grouping headers (StaticBox labels) for RTL languages
"""
def __init__(self, *args, **kw):
super().__init__(*args, **kw)
# self.StaticBox.SetLayoutDirection(wx.Layout_RightToLeft)
15 changes: 6 additions & 9 deletions source/gui/installerGui.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,10 @@ def __init__(self, parent, isUpdate):
self.bindHelpEvent("InstallWithIncompatibleAddons", self.confirmationCheckbox)
self.confirmationCheckbox.SetFocus()

optionsSizer = guiHelper.BoxSizerHelper(self, sizer=sHelper.addItem(wx.StaticBoxSizer(
wx.StaticBox(
self,
# Translators: The label for a group box containing the NVDA installation dialog options.
label=_("Options")
),
wx.VERTICAL
)))
# Translators: The label for a group box containing the NVDA installation dialog options.
optionsLabel = _("Options")
optionsHelper = sHelper.addItem(guiHelper.LTRStaticBoxSizer(wx.VERTICAL, self, label=optionsLabel))
optionsSizer = guiHelper.BoxSizerHelper(self, sizer=optionsHelper)

# Translators: The label of a checkbox option in the Install NVDA dialog.
startOnLogonText = _("Use NVDA during sign-in")
Expand Down Expand Up @@ -349,7 +345,8 @@ def __init__(self, parent):
# Translators: The label of a grouping containing controls to select the destination directory
# in the Create Portable NVDA dialog.
directoryGroupText = _("Portable &directory:")
groupHelper = sHelper.addItem(gui.guiHelper.BoxSizerHelper(self, sizer=wx.StaticBoxSizer(wx.StaticBox(self, label=directoryGroupText), wx.VERTICAL)))
groupSizer = guiHelper.LTRStaticBoxSizer(wx.VERTICAL, self, label=directoryGroupText)
groupHelper = sHelper.addItem(gui.guiHelper.BoxSizerHelper(self, sizer=groupSizer))
# Translators: The label of a button to browse for a directory.
browseText = _("Browse...")
# Translators: The title of the dialog presented when browsing for the
Expand Down
92 changes: 39 additions & 53 deletions source/gui/settingsDialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -909,9 +909,9 @@ def makeSettings(self, settingsSizer):
settingsSizerHelper = guiHelper.BoxSizerHelper(self, sizer=settingsSizer)
# Translators: A label for the synthesizer on the speech panel.
synthLabel = _("&Synthesizer")
synthBox = wx.StaticBox(self, label=synthLabel)
synthGroup = guiHelper.BoxSizerHelper(self, sizer=wx.StaticBoxSizer(synthBox, wx.HORIZONTAL))
settingsSizerHelper.addItem(synthGroup)
synthBoxSizer = guiHelper.LTRStaticBoxSizer(wx.HORIZONTAL, self, label=synthLabel)
synthGroup = guiHelper.BoxSizerHelper(self, sizer=synthBoxSizer)
settingsSizerHelper.addItem(synthBoxSizer.GetStaticBox())

# Use a ExpandoTextCtrl because even when readonly it accepts focus from keyboard, which
# standard readonly TextCtrl does not. ExpandoTextCtrl is a TE_MULTILINE control, however
Expand Down Expand Up @@ -2116,8 +2116,9 @@ def makeSettings(self, settingsSizer):
# Translators: This is the label for a group of document formatting options in the
# document formatting settings panel
fontGroupText = _("Font")
fontGroup = guiHelper.BoxSizerHelper(self, sizer=wx.StaticBoxSizer(wx.StaticBox(self, label=fontGroupText), wx.VERTICAL))
sHelper.addItem(fontGroup)
fontGroupSizer = guiHelper.LTRStaticBoxSizer(wx.VERTICAL, self, label=fontGroupText)
fontGroup = guiHelper.BoxSizerHelper(self, sizer=fontGroupSizer)
sHelper.addItem(fontGroupSizer.GetStaticBox())

# Translators: This is the label for a checkbox in the
# document formatting settings panel.
Expand Down Expand Up @@ -2178,8 +2179,9 @@ def makeSettings(self, settingsSizer):
# Translators: This is the label for a group of document formatting options in the
# document formatting settings panel
documentInfoGroupText = _("Document information")
docInfoGroup = guiHelper.BoxSizerHelper(self, sizer=wx.StaticBoxSizer(wx.StaticBox(self, label=documentInfoGroupText), wx.VERTICAL))
sHelper.addItem(docInfoGroup)
docInfoSizer = guiHelper.LTRStaticBoxSizer(wx.VERTICAL, self, label=documentInfoGroupText)
docInfoGroup = guiHelper.BoxSizerHelper(self, sizer=docInfoSizer)
sHelper.addItem(docInfoSizer.GetStaticBox())

# Translators: This is the label for a checkbox in the
# document formatting settings panel.
Expand All @@ -2202,8 +2204,9 @@ def makeSettings(self, settingsSizer):
# Translators: This is the label for a group of document formatting options in the
# document formatting settings panel
pageAndSpaceGroupText = _("Pages and spacing")
pageAndSpaceGroup = guiHelper.BoxSizerHelper(self, sizer=wx.StaticBoxSizer(wx.StaticBox(self, label=pageAndSpaceGroupText), wx.VERTICAL))
sHelper.addItem(pageAndSpaceGroup)
pageAndSpaceSizer = guiHelper.LTRStaticBoxSizer(wx.VERTICAL, self, label=pageAndSpaceGroupText)
pageAndSpaceGroup = guiHelper.BoxSizerHelper(self, sizer=pageAndSpaceSizer)
sHelper.addItem(pageAndSpaceSizer.GetStaticBox())

# Translators: This is the label for a checkbox in the
# document formatting settings panel.
Expand Down Expand Up @@ -2260,8 +2263,9 @@ def makeSettings(self, settingsSizer):
# Translators: This is the label for a group of document formatting options in the
# document formatting settings panel
tablesGroupText = _("Table information")
tablesGroup = guiHelper.BoxSizerHelper(self, sizer=wx.StaticBoxSizer(wx.StaticBox(self, label=tablesGroupText), wx.VERTICAL))
sHelper.addItem(tablesGroup)
tablesGroupSizer = guiHelper.LTRStaticBoxSizer(wx.VERTICAL, self, label=tablesGroupText)
tablesGroup = guiHelper.BoxSizerHelper(self, sizer=tablesGroupSizer)
sHelper.addItem(tablesGroupSizer.GetStaticBox())

# Translators: This is the label for a checkbox in the
# document formatting settings panel.
Expand Down Expand Up @@ -2307,7 +2311,8 @@ def makeSettings(self, settingsSizer):
# Translators: This is the label for a group of document formatting options in the
# document formatting settings panel
elementsGroupText = _("Elements")
elementsGroup = guiHelper.BoxSizerHelper(self, sizer=wx.StaticBoxSizer(wx.StaticBox(self, label=elementsGroupText), wx.VERTICAL))
elementsGroupSizer = guiHelper.LTRStaticBoxSizer(wx.VERTICAL, self, label=elementsGroupText)
elementsGroup = guiHelper.BoxSizerHelper(self, sizer=elementsGroupSizer)
sHelper.addItem(elementsGroup, flag=wx.EXPAND, proportion=1)

# Translators: This is the label for a checkbox in the
Expand Down Expand Up @@ -2485,11 +2490,9 @@ def __init__(self, parent):
# Translators: This is the label for a group of advanced options in the
# Advanced settings panel
groupText = _("NVDA Development")
devGroup = guiHelper.BoxSizerHelper(
parent=self,
sizer=wx.StaticBoxSizer(parent=self, label=groupText, orient=wx.VERTICAL)
)
sHelper.addItem(devGroup)
devGroupSizer = guiHelper.LTRStaticBoxSizer(wx.VERTICAL, self, label=groupText)
devGroup = guiHelper.BoxSizerHelper(self, sizer=devGroupSizer)
sHelper.addItem(devGroupSizer.GetStaticBox())

# Translators: This is the label for a checkbox in the
# Advanced settings panel.
Expand Down Expand Up @@ -2517,10 +2520,8 @@ def __init__(self, parent):
# Translators: This is the label for a group of advanced options in the
# Advanced settings panel
label = _("Microsoft UI Automation")
UIAGroup = guiHelper.BoxSizerHelper(
parent=self,
sizer=wx.StaticBoxSizer(parent=self, label=label, orient=wx.VERTICAL)
)
UIASizer = guiHelper.LTRStaticBoxSizer(wx.VERTICAL, self, label=label)
UIAGroup = guiHelper.BoxSizerHelper(self, sizer=UIASizer)
sHelper.addItem(UIAGroup)

# Translators: This is the label for a checkbox in the
Expand Down Expand Up @@ -2586,10 +2587,8 @@ def __init__(self, parent):
# Translators: This is the label for a group of advanced options in the
# Advanced settings panel
label = _("Terminal programs")
terminalsGroup = guiHelper.BoxSizerHelper(
parent=self,
sizer=wx.StaticBoxSizer(parent=self, label=label, orient=wx.VERTICAL)
)
terminalsSizer = guiHelper.LTRStaticBoxSizer(wx.VERTICAL, self, label=label)
terminalsGroup = guiHelper.BoxSizerHelper(self, sizer=terminalsSizer)
sHelper.addItem(terminalsGroup)
# Translators: This is the label for a checkbox in the
# Advanced settings panel.
Expand Down Expand Up @@ -2639,10 +2638,8 @@ def __init__(self, parent):
# Translators: This is the label for a group of advanced options in the
# Advanced settings panel
label = _("Speech")
speechGroup = guiHelper.BoxSizerHelper(
parent=self,
sizer=wx.StaticBoxSizer(parent=self, label=label, orient=wx.VERTICAL)
)
speechSizer = guiHelper.LTRStaticBoxSizer(wx.VERTICAL, self, label=label)
speechGroup = guiHelper.BoxSizerHelper(self, sizer=speechSizer)
sHelper.addItem(speechGroup)

expiredFocusSpeechChoices = [
Expand Down Expand Up @@ -2675,10 +2672,8 @@ def __init__(self, parent):
# Translators: This is the label for a group of advanced options in the
# Advanced settings panel
label = _("Editable Text")
editableTextGroup = guiHelper.BoxSizerHelper(
self,
sizer=wx.StaticBoxSizer(parent=self, label=label, orient=wx.VERTICAL)
)
editableSizer = guiHelper.LTRStaticBoxSizer(wx.VERTICAL, self, label=label)
editableTextGroup = guiHelper.BoxSizerHelper(self, sizer=editableSizer)
sHelper.addItem(editableTextGroup)

# Translators: This is the label for a numeric control in the
Expand All @@ -2697,10 +2692,8 @@ def __init__(self, parent):
# Translators: This is the label for a group of advanced options in the
# Advanced settings panel
label = _("Debug logging")
debugLogGroup = guiHelper.BoxSizerHelper(
self,
sizer=wx.StaticBoxSizer(parent=self, label=label, orient=wx.VERTICAL)
)
debugLogSizer = guiHelper.LTRStaticBoxSizer(wx.VERTICAL, self, label=label)
debugLogGroup = guiHelper.BoxSizerHelper(self, sizer=debugLogSizer)
sHelper.addItem(debugLogGroup)

self.logCategories=[
Expand Down Expand Up @@ -2824,12 +2817,10 @@ def makeSettings(self, settingsSizer):
:type settingsSizer: wx.BoxSizer
"""
sHelper = guiHelper.BoxSizerHelper(self, sizer=settingsSizer)
warningGroup = guiHelper.BoxSizerHelper(
self,
sizer=wx.StaticBoxSizer(wx.StaticBox(self), wx.VERTICAL)
)
sHelper.addItem(warningGroup)
warningSizer = guiHelper.LTRStaticBoxSizer(wx.VERTICAL, self)
warningGroup = guiHelper.BoxSizerHelper(self, sizer=warningSizer)
warningBox = warningGroup.sizer.GetStaticBox() # type: wx.StaticBox
sHelper.addItem(warningBox)

warningText = wx.StaticText(warningBox, label=self.warningHeader)
warningText.SetFont(wx.Font(18, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.BOLD))
Expand Down Expand Up @@ -3102,8 +3093,8 @@ def makeSettings(self, settingsSizer):
# Translators: A label for the braille display on the braille panel.
displayLabel = _("Braille &display")

displayBox = wx.StaticBox(self, label=displayLabel)
displayGroup = guiHelper.BoxSizerHelper(self, sizer=wx.StaticBoxSizer(displayBox, wx.HORIZONTAL))
displaySizer = guiHelper.LTRStaticBoxSizer(wx.HORIZONTAL, self, label=displayLabel)
displayGroup = guiHelper.BoxSizerHelper(self, sizer=displaySizer)
settingsSizerHelper.addItem(displayGroup)
self.displayNameCtrl = ExpandoTextCtrl(self, size=(self.scaleSize(250), -1), style=wx.TE_READONLY)
self.bindHelpEvent("BrailleSettingsChange", self.displayNameCtrl)
Expand Down Expand Up @@ -3712,7 +3703,7 @@ def makeSettings(self, settingsSizer: wx.BoxSizer):

for providerInfo in vision.handler.getProviderList(reloadFromSystem=True):
providerSizer = self.settingsSizerHelper.addItem(
wx.StaticBoxSizer(wx.StaticBox(self, label=providerInfo.displayName), wx.VERTICAL),
guiHelper.LTRStaticBoxSizer(wx.VERTICAL, self, label=providerInfo.displayName),
flag=wx.EXPAND
)
if len(self.providerPanelInstances) > 0:
Expand Down Expand Up @@ -4089,14 +4080,9 @@ def makeSettings(self, settingsSizer):

# Translators: The label for the group of controls in symbol pronunciation dialog to change the pronunciation of a symbol.
changeSymbolText = _("Change selected symbol")
changeSymbolHelper = sHelper.addItem(guiHelper.BoxSizerHelper(
parent=self,
sizer=wx.StaticBoxSizer(
parent=self,
label=changeSymbolText,
orient=wx.VERTICAL,
)
))
changeSymbolSizer = guiHelper.LTRStaticBoxSizer(wx.VERTICAL, self, label=changeSymbolText)
changeSymbolGroup = guiHelper.BoxSizerHelper(self, sizer=changeSymbolSizer)
changeSymbolHelper = sHelper.addItem(changeSymbolGroup)

# Used to ensure that event handlers call Skip(). Not calling skip can cause focus problems for controls. More
# generally the advice on the wx documentation is: "In general, it is recommended to skip all non-command events
Expand Down