Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Keyboard layout setting to the Welcome dialog #6868

Merged
merged 3 commits into from May 30, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
51 changes: 34 additions & 17 deletions source/gui/__init__.py
Expand Up @@ -22,9 +22,11 @@
import speech
import queueHandler
import core
import guiHelper
from settingsDialogs import *
import speechDictHandler
import languageHandler
import keyboardHandler
import logViewer
import speechViewer
import winUser
Expand Down Expand Up @@ -564,10 +566,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 @@ -578,43 +580,58 @@ def __init__(self, parent):
# bold lettering
welcomeTextHeader = wx.StaticText(self, label=_("Welcome to NVDA!"))
welcomeTextHeader.SetFont(wx.Font(18, wx.NORMAL, wx.NORMAL, wx.BOLD))
mainSizer.AddSpacer(10)
mainSizer.AddSpacer(guiHelper.SPACE_BETWEEN_VERTICAL_DIALOG_ITEMS)
mainSizer.Add(welcomeTextHeader,border=20,flag=wx.EXPAND|wx.LEFT|wx.RIGHT)
mainSizer.AddSpacer(10)
mainSizer.AddSpacer(guiHelper.SPACE_BETWEEN_VERTICAL_DIALOG_ITEMS)
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"))
sHelper = guiHelper.BoxSizerHelper(self, sizer=optionsSizer)
# Translators: The label of a combobox in the Welcome dialog.
kbdLabelText = _("&Keyboard layout:")
layouts = keyboardHandler.KeyboardInputGesture.LAYOUTS
self.kbdNames = sorted(layouts)
kbdChoices = [layouts[layout] for layout in self.kbdNames]
self.kbdList = sHelper.addLabeledControl(kbdLabelText, wx.Choice, 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)
Copy link
Contributor

Choose a reason for hiding this comment

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

log.debugWarning does not produce a sound in NVDA. If this is hit I would suggest that it is a serious enough error that users should be notified. I would propose changing this to log.error

Copy link
Contributor

Choose a reason for hiding this comment

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

Updated my comment, debugWarning never produces a sound. error sounds are purposefully omitted from the release.

# Translators: The label of a checkbox in the Welcome dialog.
capsAsNVDAModifierText = _("&Use CapsLock as an NVDA modifier key")
self.capsAsNVDAModifierCheckBox = sHelper.addItem(wx.CheckBox(self, label=capsAsNVDAModifierText))
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.
self.startAfterLogonCheckBox = wx.CheckBox(self, label=_("&Automatically start NVDA after I log on to Windows"))
# Translators: The label of a checkbox in the Welcome dialog.
startAfterLogonText = _("&Automatically start NVDA after I log on to Windows")
self.startAfterLogonCheckBox = sHelper.addItem(wx.CheckBox(self, label=startAfterLogonText))
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.
showWelcomeDialogAtStartupText = _("&Show this dialog when NVDA starts")
self.showWelcomeDialogAtStartupCheckBox = sHelper.addItem(wx.CheckBox(self, label=showWelcomeDialogAtStartupText))
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)
mainSizer.Add(self.CreateButtonSizer(wx.OK),flag=wx.TOP|wx.BOTTOM|wx.ALIGN_CENTER_HORIZONTAL,border=20)
mainSizer.Add(optionsSizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL)
mainSizer.Add(self.CreateButtonSizer(wx.OK), border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL|wx.ALIGN_RIGHT)
self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK)

self.SetSizer(mainSizer)
mainSizer.Fit(self)
self.capsAsNVDAModifierCheckBox.SetFocus()
self.SetSizer(mainSizer)
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