Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1e232cf
fix alignment of the exit dialog
feerrenrut Aug 19, 2016
825864f
fix general settings alignments
feerrenrut Aug 19, 2016
e13351d
fixed alignment in the synthesizer dialog
feerrenrut Aug 19, 2016
81cd171
fix alignment on voice settings dialog
feerrenrut Aug 19, 2016
c3f2a35
fix alignment on keyboard and mouse settings dialogs
feerrenrut Aug 19, 2016
fa3384c
fix alignment on braille settings dialogs
feerrenrut Aug 19, 2016
82b7dbf
fix alignment on the object presentation settings dialogs
feerrenrut Aug 19, 2016
1ba26ac
fix alignment on the dictionary dialog
feerrenrut Aug 19, 2016
dfacc70
fix alignment on the input gestures dialog
feerrenrut Aug 19, 2016
e710892
fix alignment on the configuration profiles dialog
feerrenrut Aug 22, 2016
c64f213
fix alignment on the new config profile dialog
feerrenrut Aug 22, 2016
173879f
fix alignment on the profile triggers dialog
feerrenrut Aug 22, 2016
531aaa9
Pull out common gui patterns into a helper module.
feerrenrut Aug 30, 2016
0cb617b
Show symbols on tree view
feerrenrut Aug 31, 2016
b3a05c4
fixed up alignment and spacing on the elements list dialog
feerrenrut Aug 31, 2016
4b8ab58
WIP
feerrenrut Sep 8, 2016
17e2c3a
Gui helper is now class based
feerrenrut Sep 12, 2016
899358e
Moved more of the code over to the class based approach
feerrenrut Sep 14, 2016
20c88e0
Updated comments for the guiHelper
feerrenrut Sep 15, 2016
108ee95
Fix some errors and remove 'name' parameter
feerrenrut Sep 16, 2016
8e93c71
Fixed up missed part of gui
feerrenrut Sep 17, 2016
a8ca09b
fix alignment on several dialogs
feerrenrut Sep 17, 2016
4b52d5d
Update some remainig dialogs
feerrenrut Sep 18, 2016
86548ae
minor fixes
feerrenrut Sep 19, 2016
ac401a8
Review actions for #6287
feerrenrut Sep 27, 2016
a262092
Fixed up an out of order comment for #6287
feerrenrut Sep 27, 2016
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
36 changes: 20 additions & 16 deletions source/browseMode.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import treeInterceptorHandler
import inputCore
import api
import gui.guiHelper
from NVDAObjects import NVDAObject

REASON_QUICKNAV = "quickNav"
Expand Down Expand Up @@ -669,46 +670,49 @@ def __init__(self, document):
# Translators: The title of the browse mode Elements List dialog.
super(ElementsListDialog, self).__init__(gui.mainFrame, wx.ID_ANY, _("Elements List"))
mainSizer = wx.BoxSizer(wx.VERTICAL)
contentsSizer = wx.BoxSizer(wx.VERTICAL)

# Translators: The label of a group of radio buttons to select the type of element
# in the browse mode Elements List dialog.
child = wx.RadioBox(self, wx.ID_ANY, label=_("Type:"), choices=tuple(et[1] for et in self.ELEMENT_TYPES))
child.SetSelection(self.lastSelectedElementType)
child.Bind(wx.EVT_RADIOBOX, self.onElementTypeChange)
mainSizer.Add(child,proportion=1)
contentsSizer.Add(child, flag=wx.EXPAND)
contentsSizer.AddSpacer(gui.guiHelper.SPACE_BETWEEN_VERTICAL_DIALOG_ITEMS)

self.tree = wx.TreeCtrl(self, wx.ID_ANY, style=wx.TR_HAS_BUTTONS | wx.TR_HIDE_ROOT | wx.TR_SINGLE | wx.TR_EDIT_LABELS)
self.tree = wx.TreeCtrl(self, size=wx.Size(500, 600), style=wx.TR_HAS_BUTTONS | wx.TR_HIDE_ROOT | wx.TR_LINES_AT_ROOT | wx.TR_SINGLE | wx.TR_EDIT_LABELS)
self.tree.Bind(wx.EVT_SET_FOCUS, self.onTreeSetFocus)
self.tree.Bind(wx.EVT_CHAR, self.onTreeChar)
self.tree.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.onTreeLabelEditBegin)
self.tree.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.onTreeLabelEditEnd)
self.treeRoot = self.tree.AddRoot("root")
mainSizer.Add(self.tree,proportion=7,flag=wx.EXPAND)
contentsSizer.Add(self.tree,flag=wx.EXPAND)
contentsSizer.AddSpacer(gui.guiHelper.SPACE_BETWEEN_VERTICAL_DIALOG_ITEMS)

sizer = wx.BoxSizer(wx.HORIZONTAL)
# Translators: The label of an editable text field to filter the elements
# in the browse mode Elements List dialog.
label = wx.StaticText(self, wx.ID_ANY, _("&Filter by:"))
sizer.Add(label)
self.filterEdit = wx.TextCtrl(self, wx.ID_ANY)
filterText = _("&Filter by:")
labeledCtrl = gui.guiHelper.LabeledControlHelper(self, filterText, wx.TextCtrl)
self.filterEdit = labeledCtrl.control
self.filterEdit.Bind(wx.EVT_TEXT, self.onFilterEditTextChange)
sizer.Add(self.filterEdit)
mainSizer.Add(sizer,proportion=1)
contentsSizer.Add(labeledCtrl.sizer)
contentsSizer.AddSpacer(gui.guiHelper.SPACE_BETWEEN_VERTICAL_DIALOG_ITEMS)

sizer = wx.BoxSizer(wx.HORIZONTAL)
bHelper = gui.guiHelper.ButtonHelper(wx.HORIZONTAL)
# Translators: The label of a button to activate an element
# in the browse mode Elements List dialog.
self.activateButton = wx.Button(self, wx.ID_ANY, _("&Activate"))
self.activateButton = bHelper.addButton(self, label=_("&Activate"))
self.activateButton.Bind(wx.EVT_BUTTON, lambda evt: self.onAction(True))
sizer.Add(self.activateButton)

# Translators: The label of a button to move to an element
# in the browse mode Elements List dialog.
self.moveButton = wx.Button(self, wx.ID_ANY, _("&Move to"))
self.moveButton = bHelper.addButton(self, label=_("&Move to"))
self.moveButton.Bind(wx.EVT_BUTTON, lambda evt: self.onAction(False))
sizer.Add(self.moveButton)
sizer.Add(wx.Button(self, wx.ID_CANCEL))
mainSizer.Add(sizer,proportion=1)
bHelper.addButton(self, id=wx.ID_CANCEL)

contentsSizer.Add(bHelper.sizer)

mainSizer.Add(contentsSizer, border=gui.guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL)
mainSizer.Fit(self)
self.SetSizer(mainSizer)

Expand Down
48 changes: 27 additions & 21 deletions source/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import speechViewer
import winUser
import api
import guiHelper

try:
import updateCheck
except RuntimeError:
Expand Down Expand Up @@ -624,20 +626,22 @@ class LauncherDialog(wx.Dialog):
def __init__(self, parent):
super(LauncherDialog, self).__init__(parent, title=versionInfo.name)
mainSizer = wx.BoxSizer(wx.VERTICAL)
sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL)

# Translators: The label of the license text which will be shown when NVDA installation program starts.
sizer = wx.StaticBoxSizer(wx.StaticBox(self, label=_("License Agreement")), wx.VERTICAL)
ctrl = wx.TextCtrl(self, size=(500, 400), style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH)
ctrl.Value = codecs.open(getDocFilePath("copying.txt", False), "r", encoding="UTF-8").read()
sizer.Add(ctrl)
groupLabel = _("License Agreement")
sizer = sHelper.addItem(wx.StaticBoxSizer(wx.StaticBox(self, label=groupLabel), wx.VERTICAL))
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)

# Translators: The label for a checkbox in NvDA installation program to agree to the license agreement.
ctrl = self.licenseAgreeCheckbox = wx.CheckBox(self, label=_("I &agree"))
ctrl.Value = False
sizer.Add(ctrl)
ctrl.Bind(wx.EVT_CHECKBOX, self.onLicenseAgree)
mainSizer.Add(sizer)
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 = wx.GridSizer(rows=2, cols=2)
sizer = sHelper.addItem(wx.GridSizer(rows=2, cols=2))
self.actionButtons = []
# Translators: The label of the button in NVDA installation program to install NvDA on the user's computer.
ctrl = wx.Button(self, label=_("&Install NVDA on this computer"))
Expand All @@ -657,10 +661,11 @@ def __init__(self, parent):
sizer.Add(wx.Button(self, label=_("E&xit"), id=wx.ID_CANCEL))
# If we bind this on the button, it fails to trigger when the dialog is closed.
self.Bind(wx.EVT_BUTTON, self.onExit, id=wx.ID_CANCEL)
mainSizer.Add(sizer)

for ctrl in self.actionButtons:
ctrl.Disable()

mainSizer.Add(sHelper.sizer, border = guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL)
self.Sizer = mainSizer
mainSizer.Fit(self)
self.Center(wx.BOTH | wx.CENTER_ON_SCREEN)
Expand Down Expand Up @@ -708,33 +713,34 @@ def __init__(self, parent):
ExitDialog._instance = weakref.ref(self)
# Translators: The title of the dialog to exit NVDA
super(ExitDialog, self).__init__(parent, title=_("Exit NVDA"))
dialog = self
mainSizer = wx.BoxSizer(wx.VERTICAL)

contentSizerHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL)

if globalVars.appArgs.disableAddons:
# Translators: A message in the exit Dialog shown when all add-ons are disabled.
addonsDisabledLabel=wx.StaticText(self,-1,label=_("All add-ons are now disabled. They will be re-enabled on the next restart unless you choose to disable them again."))
mainSizer.Add(addonsDisabledLabel)
addonsDisabledText = _("All add-ons are now disabled. They will be re-enabled on the next restart unless you choose to disable them again.")
contentSizerHelper.addItem(wx.StaticText(self, wx.ID_ANY, label=addonsDisabledText))

actionSizer=wx.BoxSizer(wx.HORIZONTAL)
# Translators: The label for actions list in the Exit dialog.
actionsLabel=wx.StaticText(self,-1,label=_("What would you like to &do?"))
actionSizer.Add(actionsLabel)
actionsListID=wx.NewId()
labelText=_("What would you like to &do?")
self.actions = [
# Translators: An option in the combo box to choose exit action.
_("Exit"),
# Translators: An option in the combo box to choose exit action.
_("Restart"),
# Translators: An option in the combo box to choose exit action.
_("Restart with add-ons disabled")]
self.actionsList=wx.Choice(self,actionsListID,choices=self.actions)
self.actionsList = contentSizerHelper.addLabeledControl(labelText, wx.Choice, choices=self.actions)
self.actionsList.SetSelection(0)
actionSizer.Add(self.actionsList)
mainSizer.Add(actionSizer,border=10,flag=wx.CENTER)

mainSizer.Add(self.CreateButtonSizer(wx.OK | wx.CANCEL))
contentSizerHelper.addItem( self.CreateButtonSizer(wx.OK | wx.CANCEL))

self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK)
self.Bind(wx.EVT_BUTTON, self.onCancel, id=wx.ID_CANCEL)

mainSizer.Add(contentSizerHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL)
mainSizer.Fit(self)
self.Sizer = mainSizer
self.actionsList.SetFocus()
Expand Down
125 changes: 66 additions & 59 deletions source/gui/configProfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from logHandler import log
import appModuleHandler
import globalVars
import guiHelper

class ProfilesDialog(wx.Dialog):
shouldSuspendConfigProfileTriggers = True
Expand All @@ -28,59 +29,67 @@ def __init__(self, parent):
ProfilesDialog._instance = self
# Translators: The title of the Configuration Profiles dialog.
super(ProfilesDialog, self).__init__(parent, title=_("Configuration Profiles"))
mainSizer = wx.BoxSizer(wx.VERTICAL)

self.currentAppName = (gui.mainFrame.prevFocus or api.getFocusObject()).appModule.appName
self.profileNames = [None]
self.profileNames.extend(config.conf.listProfiles())

sizer = wx.BoxSizer(wx.HORIZONTAL)
# Translators: The label of the profile list in the Configuration Profiles dialog.
sizer.Add(wx.StaticText(self, label=_("&Profile")))
mainSizer = wx.BoxSizer(wx.VERTICAL)
sHelper = guiHelper.BoxSizerHelper(self,orientation=wx.VERTICAL)
profilesListGroupSizer = wx.StaticBoxSizer(wx.StaticBox(self), wx.HORIZONTAL)
profilesListGroupContents = wx.BoxSizer(wx.HORIZONTAL)

#contains the profile list and activation button in vertical arrangement.
changeProfilesSizer = wx.BoxSizer(wx.VERTICAL)
item = self.profileList = wx.ListBox(self,
choices=[self.getProfileDisplay(name, includeStates=True) for name in self.profileNames])
item.Bind(wx.EVT_LISTBOX, self.onProfileListChoice)
item.Selection = self.profileNames.index(config.conf.profiles[-1].name)
sizer.Add(item)
mainSizer.Add(sizer)
changeProfilesSizer.Add(item, proportion=1.0)

sizer = wx.BoxSizer(wx.HORIZONTAL)
item = self.changeStateButton = wx.Button(self)
item.Bind(wx.EVT_BUTTON, self.onChangeState)
sizer.Add(item)
self.AffirmativeId = item.Id
item.SetDefault()
changeProfilesSizer.AddSpacer(guiHelper.SPACE_BETWEEN_BUTTONS_VERTICAL)

self.changeStateButton = wx.Button(self)
self.changeStateButton.Bind(wx.EVT_BUTTON, self.onChangeState)
self.AffirmativeId = self.changeStateButton.Id
self.changeStateButton.SetDefault()
changeProfilesSizer.Add(self.changeStateButton)

profilesListGroupContents.Add(changeProfilesSizer, flag = wx.EXPAND)
profilesListGroupContents.AddSpacer(guiHelper.SPACE_BETWEEN_ASSOCIATED_CONTROL_HORIZONTAL)

buttonHelper = guiHelper.ButtonHelper(wx.VERTICAL)
# Translators: The label of a button to create a new configuration profile.
item = newButton = wx.Button(self, label=_("&New"))
item.Bind(wx.EVT_BUTTON, self.onNew)
sizer.Add(item)
newButton = buttonHelper.addButton(self, label=_("&New"))
newButton.Bind(wx.EVT_BUTTON, self.onNew)

# Translators: The label of a button to rename a configuration profile.
item = self.renameButton = wx.Button(self, label=_("&Rename"))
item.Bind(wx.EVT_BUTTON, self.onRename)
sizer.Add(item)
self.renameButton = buttonHelper.addButton(self, label=_("&Rename"))
self.renameButton.Bind(wx.EVT_BUTTON, self.onRename)

# Translators: The label of a button to delete a configuration profile.
item = self.deleteButton = wx.Button(self, label=_("&Delete"))
item.Bind(wx.EVT_BUTTON, self.onDelete)
sizer.Add(item)
mainSizer.Add(sizer)
self.deleteButton = buttonHelper.addButton(self, label=_("&Delete"))
self.deleteButton.Bind(wx.EVT_BUTTON, self.onDelete)

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

sizer = wx.BoxSizer(wx.HORIZONTAL)
# Translators: The label of a button to manage triggers
# in the Configuration Profiles dialog.
# See the Configuration Profiles section of the User Guide for details.
triggersButton = wx.Button(self, label=_("&Triggers..."))
triggersButton.Bind(wx.EVT_BUTTON, self.onTriggers)
sizer.Add(triggersButton)

# Translators: The label of a checkbox in the Configuration Profiles dialog.
item = self.disableTriggersToggle = wx.CheckBox(self, label=_("Temporarily d&isable all triggers"))
item.Value = not config.conf.profileTriggersEnabled
sizer.Add(item)
mainSizer.Add(sizer)
self.disableTriggersToggle = wx.CheckBox(self, label=_("Temporarily d&isable all triggers"))
self.disableTriggersToggle.Value = not config.conf.profileTriggersEnabled
sHelper.addItem(guiHelper.associateElements(triggersButton,self.disableTriggersToggle))

# Translators: The label of a button to close a dialog.
item = wx.Button(self, wx.ID_CLOSE, label=_("&Close"))
item.Bind(wx.EVT_BUTTON, lambda evt: self.Close())
mainSizer.Add(item)
closeButton = wx.Button(self, wx.ID_CLOSE, label=_("&Close"))
closeButton.Bind(wx.EVT_BUTTON, lambda evt: self.Close())
sHelper.addItem(closeButton)
self.Bind(wx.EVT_CLOSE, self.onClose)
self.EscapeId = wx.ID_CLOSE

Expand All @@ -89,6 +98,7 @@ def __init__(self, parent):
item.Disable()
self.onProfileListChoice(None)

mainSizer.Add(sHelper.sizer, flag=wx.ALL, border=guiHelper.BORDER_FOR_DIALOGS)
mainSizer.Fit(self)
self.Sizer = mainSizer
self.profileList.SetFocus()
Expand Down Expand Up @@ -274,6 +284,7 @@ def __init__(self, parent):
# Translators: The title of the configuration profile triggers dialog.
super(TriggersDialog, self).__init__(parent, title=_("Profile Triggers"))
mainSizer = wx.BoxSizer(wx.VERTICAL)
sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL)

processed = set()
triggers = self.triggers = []
Expand All @@ -298,33 +309,29 @@ def __init__(self, parent):
continue
triggers.append(TriggerInfo(spec, disp, profile))

sizer = wx.BoxSizer(wx.HORIZONTAL)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Extraneous blank line.

# Translators: The label of the triggers list in the Configuration Profile Triggers dialog.
sizer.Add(wx.StaticText(self, label=_("Triggers")))
item = self.triggerList = wx.ListBox(self, choices=[trig.display for trig in triggers])
item.Bind(wx.EVT_LISTBOX, self.onTriggerListChoice)
item.Selection = 0
sizer.Add(item)
mainSizer.Add(sizer)
triggersText = _("Triggers")
triggerChoices = [trig.display for trig in triggers]
self.triggerList = sHelper.addLabeledControl(triggersText, wx.ListBox, choices=triggerChoices)
self.triggerList.Bind(wx.EVT_LISTBOX, self.onTriggerListChoice)
self.triggerList.Selection = 0

sizer = wx.BoxSizer(wx.HORIZONTAL)
# Translators: The label of the profile list in the Configuration Profile Triggers dialog.
sizer.Add(wx.StaticText(self, label=_("Profile")))
item = self.profileList = wx.Choice(self,
choices=[parent.getProfileDisplay(name) for name in parent.profileNames])
item.Bind(wx.EVT_CHOICE, self.onProfileListChoice)
sizer.Add(item)
mainSizer.Add(sizer)

item = wx.Button(self, wx.ID_CLOSE, label=_("&Close"))
item.Bind(wx.EVT_BUTTON, lambda evt: self.Close())
mainSizer.Add(item)
profileText = _("Profile")
profileChoices = [parent.getProfileDisplay(name) for name in parent.profileNames]
self.profileList = sHelper.addLabeledControl(profileText, wx.Choice, choices=profileChoices)
self.profileList.Bind(wx.EVT_CHOICE, self.onProfileListChoice)

closeButton = sHelper.addItem(wx.Button(self, wx.ID_CLOSE, label=_("&Close")))
closeButton.Bind(wx.EVT_BUTTON, lambda evt: self.Close())
self.Bind(wx.EVT_CLOSE, self.onClose)
self.AffirmativeId = wx.ID_CLOSE
item.SetDefault()
closeButton.SetDefault()
self.EscapeId = wx.ID_CLOSE

self.onTriggerListChoice(None)
mainSizer.Add(sHelper.sizer, border = guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL)
mainSizer.Fit(self)
self.Sizer = mainSizer
self.Center(wx.BOTH | wx.CENTER_ON_SCREEN)
Expand Down Expand Up @@ -364,28 +371,28 @@ def __init__(self, parent):
# Translators: The title of the dialog to create a new configuration profile.
super(NewProfileDialog, self).__init__(parent, title=_("New Profile"))
mainSizer = wx.BoxSizer(wx.VERTICAL)
sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL)

sizer = wx.BoxSizer(wx.HORIZONTAL)
# Translators: The label of a field to enter the name of a new configuration profile.
sizer.Add(wx.StaticText(self, label=_("Profile name:")))
item = self.profileName = wx.TextCtrl(self)
sizer.Add(item)
mainSizer.Add(sizer)
profileNameText = _("Profile name:")
self.profileName = sHelper.addLabeledControl(profileNameText, wx.TextCtrl)

# Translators: The label of a radio button to specify that a profile will be used for manual activation
# in the new configuration profile dialog.
self.triggers = triggers = [(None, _("Manual activation"), True)]
triggers.extend(parent.getSimpleTriggers())
item = self.triggerChoice = wx.RadioBox(self, label=_("Use this profile for:"),
choices=[trig[1] for trig in triggers])
item.Bind(wx.EVT_RADIOBOX, self.onTriggerChoice)
self.triggerChoice = sHelper.addItem(wx.RadioBox(self, label=_("Use this profile for:"),
choices=[trig[1] for trig in triggers]))
self.triggerChoice.Bind(wx.EVT_RADIOBOX, self.onTriggerChoice)
self.autoProfileName = ""
self.onTriggerChoice(None)
mainSizer.Add(item)

mainSizer.Add(self.CreateButtonSizer(wx.OK | wx.CANCEL))
sHelper.addItem(self.CreateButtonSizer(wx.OK | wx.CANCEL))
self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK)
self.Bind(wx.EVT_BUTTON, self.onCancel, id=wx.ID_CANCEL)

mainSizer.Add(sHelper.sizer, border = guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL)
mainSizer.Fit(self)
self.Sizer = mainSizer
self.profileName.SetFocus()
Expand Down
Loading