Skip to content

Commit

Permalink
Add Keyboard layout setting to the Welcome dialog.
Browse files Browse the repository at this point in the history
Also:
* Remove empty line at the end of the detail message.
* Clean up translator comments.
* Add mnemonics to the settings controls.
Todo:
* Use guiHelper.
* Bring Keyboard settings dialog in line, i.e. add mnemonics there too.
  • Loading branch information
dkager committed Feb 10, 2017
1 parent aabbbd7 commit c664556
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
35 changes: 27 additions & 8 deletions source/gui/__init__.py
Expand Up @@ -25,6 +25,7 @@
from settingsDialogs import *
import speechDictHandler
import languageHandler
import keyboardHandler
import logViewer
import speechViewer
import winUser
Expand Down Expand Up @@ -564,10 +565,10 @@ class WelcomeDialog(wx.Dialog):
# Translators: The main message for the Welcome dialog when the user starts NVDA for the first time.
WELCOME_MESSAGE_DETAIL = _(
"Most commands for controlling NVDA require you to hold down the NVDA key while pressing other keys.\n"
"By default, the numpad insert and main insert keys may both be used as the NVDA key.\n"
"By default, the numpad Insert and main Insert keys may both be used as the NVDA key.\n"
"You can also configure NVDA to use the CapsLock as the NVDA key.\n"
"Press NVDA+n at any time to activate the NVDA menu.\n"
"From this menu, you can configure NVDA, get help and access other NVDA functions.\n"
"From this menu, you can configure NVDA, get help and access other NVDA functions."
)

def __init__(self, parent):
Expand All @@ -584,17 +585,33 @@ 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, wx.ID_ANY, _("Options")), wx.VERTICAL)
self.capsAsNVDAModifierCheckBox = wx.CheckBox(self, wx.ID_ANY, _("Use CapsLock as an NVDA modifier key"))
kbdSizer = wx.BoxSizer(wx.HORIZONTAL)
# Translators: The label of a combobox in the Welcome dialog.
kbdLabel = wx.StaticText(self, -1, label=_("&Keyboard layout:"))
kbdSizer.Add(kbdLabel)
layouts = keyboardHandler.KeyboardInputGesture.LAYOUTS
self.kbdNames = sorted(layouts)
kbdChoices = [layouts[layout] for layout in self.kbdNames]
self.kbdList = wx.Choice(self, wx.ID_ANY, name=_("Keyboard layout"), choices=kbdChoices)
try:
index = self.kbdNames.index(config.conf["keyboard"]["keyboardLayout"])
self.kbdList.SetSelection(index)
except:
log.debugWarning("Could not set Keyboard layout list to current layout",exc_info=True)
kbdSizer.Add(self.kbdList)
optionsSizer.Add(kbdSizer,flag=wx.TOP|wx.LEFT,border=10)
# Translators: The label of a checkbox in the Welcome dialog.
self.capsAsNVDAModifierCheckBox = wx.CheckBox(self, wx.ID_ANY, _("&Use CapsLock as an NVDA modifier key"))
self.capsAsNVDAModifierCheckBox.SetValue(config.conf["keyboard"]["useCapsLockAsNVDAModifierKey"])
optionsSizer.Add(self.capsAsNVDAModifierCheckBox,flag=wx.TOP|wx.LEFT,border=10)
# Translators: The label of a check box in the Welcome dialog.
# Translators: The label of a checkbox in the Welcome dialog.
self.startAfterLogonCheckBox = wx.CheckBox(self, label=_("&Automatically start NVDA after I log on to Windows"))
self.startAfterLogonCheckBox.Value = config.getStartAfterLogon()
if globalVars.appArgs.secure or not config.isInstalledCopy():
self.startAfterLogonCheckBox.Disable()
optionsSizer.Add(self.startAfterLogonCheckBox,flag=wx.TOP|wx.LEFT,border=10)
# Translators: This is a label for a checkbox in welcome dialog to show welcome dialog at startup.
self.showWelcomeDialogAtStartupCheckBox = wx.CheckBox(self, wx.ID_ANY, _("Show this dialog when NVDA starts"))
# Translators: The label of a checkbox in the Welcome dialog.
self.showWelcomeDialogAtStartupCheckBox = wx.CheckBox(self, wx.ID_ANY, _("&Show this dialog when NVDA starts"))
self.showWelcomeDialogAtStartupCheckBox.SetValue(config.conf["general"]["showWelcomeDialogAtStartup"])
optionsSizer.Add(self.showWelcomeDialogAtStartupCheckBox,flag=wx.TOP|wx.LEFT,border=10)
mainSizer.Add(optionsSizer,flag=wx.LEFT|wx.TOP|wx.RIGHT|wx.EXPAND,border=20)
Expand All @@ -603,18 +620,20 @@ def __init__(self, parent):

self.SetSizer(mainSizer)
mainSizer.Fit(self)
self.capsAsNVDAModifierCheckBox.SetFocus()
self.kbdList.SetFocus()
self.Center(wx.BOTH | wx.CENTER_ON_SCREEN)

def onOk(self, evt):
layout = self.kbdNames[self.kbdList.GetSelection()]
config.conf["keyboard"]["keyboardLayout"] = layout
config.conf["keyboard"]["useCapsLockAsNVDAModifierKey"] = self.capsAsNVDAModifierCheckBox.IsChecked()
if self.startAfterLogonCheckBox.Enabled:
config.setStartAfterLogon(self.startAfterLogonCheckBox.Value)
config.conf["general"]["showWelcomeDialogAtStartup"] = self.showWelcomeDialogAtStartupCheckBox.IsChecked()
try:
config.conf.save()
except:
log.debugWarning("could not save",exc_info=True)
log.debugWarning("Could not save",exc_info=True)
self.EndModal(wx.ID_OK)

@classmethod
Expand Down
5 changes: 3 additions & 2 deletions user_docs/en/userGuide.t2t
Expand Up @@ -147,8 +147,9 @@ Please check out the NVDA website for how to do this.

When NVDA starts for the first time, you will be greeted by a dialog box which provides you with some basic information about the NVDA modifier key and the NVDA menu.
(Please see further sections about these topics.)
The dialog box also contains three checkboxes.
The first lets you control if NVDA should use the capslock as an NVDA modifier key.
The dialog box also contains a combobox and three checkboxes.
The combobox lets you select the keyboard layout.
The first checkbox lets you control if NVDA should use the capslock as an NVDA modifier key.
The second specifies whether NVDA should start automatically after you log on to Windows and is only available for installed copies of NVDA.
The third lets you control if this Welcome dialog should appear each time NVDA starts.

Expand Down

0 comments on commit c664556

Please sign in to comment.