diff --git a/source/gui/__init__.py b/source/gui/__init__.py index befb788fd4c..e5f83c02a71 100644 --- a/source/gui/__init__.py +++ b/source/gui/__init__.py @@ -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 @@ -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): @@ -578,35 +580,50 @@ 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.error("Could not set Keyboard layout list to current layout",exc_info=True) + # 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) @@ -614,7 +631,7 @@ def onOk(self, evt): 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 diff --git a/user_docs/en/userGuide.t2t b/user_docs/en/userGuide.t2t index 8919d9d844e..e41ff8cacdc 100644 --- a/user_docs/en/userGuide.t2t +++ b/user_docs/en/userGuide.t2t @@ -148,8 +148,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.