Repository: nvaccess/nvda

Issue:
Add keyboard layout setting to the welcome dialog
I was writing a basic explanation on how to install NVDA today, and was wondering if the keyboard layout shouldn't be part of the welcome dialog. This is a setting that impacts your experience a lot when misconfigured.


Discussion:
I could not agree more.

Yeah, agree.

On Thu, Feb 9, 2017 at 8:49 AM, Leonard de Ruijter <notifications@github.com
> wrote:

> I could not agree more.
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/nvaccess/nvda/issues/6863#issuecomment-278681760>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/AFGivYjXk0V5_JjYYkAjCgXI-sxTxfjvks5razWDgaJpZM4L8QpP>
> .
>



-- 

Derek Riemer: Improving the world one byte at a time!

   - University of Colorado Boulder Department of computer science, 4th
   year undergraduate student.
   - Accessibility enthusiast.
   - Proud user of the NVDA screen reader.
   - Open source enthusiast.
   - Skier.

Personal website <http://derekriemer.com>

I originally didn't do this because I wanted to keep the information and
settings in that dialog to essentials. There's nothing worse than being
presented with a massive dialog on first launch where you feel overwhelmed
by the welcome experience itself before you can even start using the
product. It's really important to set the NVDA key because otherwise you
might not be able to get into the NVDA menu, but with the NVDA key set, you
can always get in there to change the layout (and the Welcome dialog
instructs you as to how to do this). Having said that, I do think keyboard
layout is pretty fundamental, so I'd be happy to have this in the Welcome
dialog.

As a compromise, what if caps-lock was set when laptop was selected, by
default.

On Thu, Feb 9, 2017 at 3:18 PM, James Teh <notifications@github.com> wrote:

> I originally didn't do this because I wanted to keep the information and
> settings in that dialog to essentials. There's nothing worse than being
> presented with a massive dialog on first launch where you feel overwhelmed
> by the welcome experience itself before you can even start using the
> product. It's really important to set the NVDA key because otherwise you
> might not be able to get into the NVDA menu, but with the NVDA key set, you
> can always get in there to change the layout (and the Welcome dialog
> instructs you as to how to do this). Having said that, I do think keyboard
> layout is pretty fundamental, so I'd be happy to have this in the Welcome
> dialog.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <https://github.com/nvaccess/nvda/issues/6863#issuecomment-278792593>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/AFGivfK1toBawMJLkC9mAxM4oQ67_qVbks5ra5CdgaJpZM4L8QpP>
> .
>



-- 

Derek Riemer: Improving the world one byte at a time!

   - University of Colorado Boulder Department of computer science, 4th
   year undergraduate student.
   - Accessibility enthusiast.
   - Proud user of the NVDA screen reader.
   - Open source enthusiast.
   - Skier.

Personal website <http://derekriemer.com>

I don't follow why that's a compromise. I wasn't suggesting we remove the
caps lock setting. Also, if we do keep the caps lock setting, I think that
confuses things, since a user won't necessarily realise that changing the
layout also toggled the check box.

I guess we could get rid of the caps lock option and just have
desktop/laptop, but it would need to be clear that this wasn't just
adjusting the layout. Also, I'm concerned that there might be desktop users
who want caps lock or laptop users who don't.

Basically, if you're on a laptop, your NVDA key is most likely caps lock.
That's all, just making life for the user possibly easier.

On Thu, Feb 9, 2017 at 4:14 PM, James Teh <notifications@github.com> wrote:

> I don't follow why that's a compromise. I wasn't suggesting we remove the
> caps lock setting. Also, if we do keep the caps lock setting, I think that
> confuses things, since a user won't necessarily realise that changing the
> layout also toggled the check box.
>
> I guess we could get rid of the caps lock option and just have
> desktop/laptop, but it would need to be clear that this wasn't just
> adjusting the layout. Also, I'm concerned that there might be desktop users
> who want caps lock or laptop users who don't.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <https://github.com/nvaccess/nvda/issues/6863#issuecomment-278805973>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/AFGivU6GBY6lW6XOzz1LAq4x06e7Oplxks5ra52_gaJpZM4L8QpP>
> .
>



-- 

Derek Riemer: Improving the world one byte at a time!

   - University of Colorado Boulder Department of computer science, 4th
   year undergraduate student.
   - Accessibility enthusiast.
   - Proud user of the NVDA screen reader.
   - Open source enthusiast.
   - Skier.

Personal website <http://derekriemer.com>

That may be true for many, but it's not a definite. I don't use caps lock
for NVDA, for example. That said, I also use the desktop layout with the fn
key for the numpad, so I'm probably an exceptional case. :)

Hi, I think one way to clarify this could be to place the keyboard layout combo box right after the caps lock key checkbox. I for one use caps lock as the modifier key under desktop layout. Thanks.

 

From: James Teh [mailto:notifications@github.com] 
Sent: Thursday, February 9, 2017 3:48 PM
To: nvaccess/nvda <nvda@noreply.github.com>
Cc: Subscribed <subscribed@noreply.github.com>
Subject: Re: [nvaccess/nvda] Add keyboard layout setting to the welcome dialog (#6863)

 

That may be true for many, but it's not a definite. I don't use caps lock
for NVDA, for example. That said, I also use the desktop layout with the fn
key for the numpad, so I'm probably an exceptional case. :)



—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <https://github.com/nvaccess/nvda/issues/6863#issuecomment-278813392> , or mute the thread <https://github.com/notifications/unsubscribe-auth/AHgLkBybSDm88Dzdh-iZrdHs27H619rXks5ra6XBgaJpZM4L8QpP> .


I use laptop layout with capslock on both laptops and desktops. With my previous screen reader I did the desktop layout with Fn-key thing.
I suppose people want one layout to work in both scenarios, but they don't have a strict NVDA key preference.

Resolving patch:
diff --git a/source/gui/__init__.py b/source/gui/__init__.py
--- 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


Test patch: