Skip to content

Commit b0b80cf

Browse files
committed
Code for entry into panel should only fire on Tab key
1 parent 87b1e8f commit b0b80cf

File tree

1 file changed

+42
-43
lines changed

1 file changed

+42
-43
lines changed

NVDA-addon/addon/globalPlugins/MathCAT/MathCATPreferences.py

Lines changed: 42 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def validate(key1, key2, valid_values, default_value):
171171
return
172172
if (type(valid_values[0]) == int) and (type(valid_values[1]) == int):
173173
#any value between lower and upper bounds is valid
174-
if (user_preferences[key1][key2] >= valid_values[0]) and (user_preferences[key1][key2] <= valid_values[1]):
174+
if (user_preferences[key1][key2] >= valid_values(0)) and (user_preferences[key1][key2] <= valid_values(1)):
175175
return
176176
else:
177177
#any value in the list is valid
@@ -272,48 +272,47 @@ def MathCATPreferencesDialogOnCharHook(self,event):
272272
return
273273
if keyCode == wx.WXK_RETURN:
274274
UserInterface.OnClickOK(self,event)
275-
if keyCode == wx.WXK_TAB and (event.GetModifiers() == wx.MOD_CONTROL):
276-
#cycle the category forward
277-
new_category = self.m_listBoxPreferencesTopic.GetSelection() + 1
278-
if new_category == 3:
279-
new_category = 0
280-
self.m_listBoxPreferencesTopic.SetSelection(new_category)
281-
#update the ui to show the new page
282-
UserInterface.OnListBoxCategories(self,event)
283-
#set the focus into the category list box
284-
self.m_listBoxPreferencesTopic.SetFocus()
285-
#jump out so the tab key is not processed
286-
return
287-
if keyCode == wx.WXK_TAB and (event.GetModifiers() == wx.MOD_CONTROL|wx.MOD_SHIFT):
288-
#cycle the category back
289-
new_category = self.m_listBoxPreferencesTopic.GetSelection() - 1
290-
if new_category == -1:
291-
new_category = 2
292-
self.m_listBoxPreferencesTopic.SetSelection(new_category)
293-
#update the ui to show the new page
294-
UserInterface.OnListBoxCategories(self,event)
295-
#update the ui to show the new page
296-
self.m_listBoxPreferencesTopic.SetFocus()
297-
#jump out so the tab key is not processed
298-
return
299-
if (event.GetModifiers() == wx.MOD_NONE) and (MathCATgui.MathCATPreferencesDialog.FindFocus() == self.m_listBoxPreferencesTopic):
300-
#user tabbed from into the paged content, set the focus on the first control
301-
if self.m_listBoxPreferencesTopic.GetSelection() == 0:
302-
self.m_choiceImpairment.SetFocus()
303-
elif self.m_listBoxPreferencesTopic.GetSelection() == 1:
304-
self.m_choiceNavigationMode.SetFocus()
305-
elif self.m_listBoxPreferencesTopic.GetSelection() == 2:
306-
self.m_choiceBrailleMathCode.SetFocus()
307-
return
308-
if (event.GetModifiers() == wx.MOD_SHIFT) and (MathCATgui.MathCATPreferencesDialog.FindFocus() == self.m_buttonOK):
309-
#user shift+tabbed from into the paged content, set the focus on the last control
310-
if self.m_listBoxPreferencesTopic.GetSelection() == 0:
311-
self.m_choiceSpeechForChemical.SetFocus()
312-
elif self.m_listBoxPreferencesTopic.GetSelection() == 1:
313-
self.m_choiceSpeechAmountNavigation.SetFocus()
314-
elif self.m_listBoxPreferencesTopic.GetSelection() == 2:
315-
self.m_choiceBrailleHighlights.SetFocus()
316-
return
275+
if keyCode == wx.WXK_TAB:
276+
if event.GetModifiers() == wx.MOD_CONTROL:
277+
#cycle the category forward
278+
new_category = self.m_listBoxPreferencesTopic.GetSelection() + 1
279+
if new_category == 3:
280+
new_category = 0
281+
self.m_listBoxPreferencesTopic.SetSelection(new_category)
282+
#update the ui to show the new page
283+
UserInterface.OnListBoxCategories(self,event)
284+
#set the focus into the category list box
285+
self.m_listBoxPreferencesTopic.SetFocus()
286+
#jump out so the tab key is not processed
287+
return
288+
if event.GetModifiers() == wx.MOD_CONTROL|wx.MOD_SHIFT:
289+
#cycle the category back
290+
new_category = self.m_listBoxPreferencesTopic.GetSelection() - 1
291+
if new_category == -1:
292+
new_category = 2
293+
self.m_listBoxPreferencesTopic.SetSelection(new_category)
294+
#update the ui to show the new page
295+
UserInterface.OnListBoxCategories(self,event)
296+
#update the ui to show the new page
297+
self.m_listBoxPreferencesTopic.SetFocus()
298+
#jump out so the tab key is not processed
299+
return
300+
if (event.GetModifiers() == wx.MOD_NONE) and (MathCATgui.MathCATPreferencesDialog.FindFocus() == self.m_listBoxPreferencesTopic):
301+
if self.m_listBoxPreferencesTopic.GetSelection() == 0:
302+
self.m_choiceImpairment.SetFocus()
303+
elif self.m_listBoxPreferencesTopic.GetSelection() == 1:
304+
self.m_choiceNavigationMode.SetFocus()
305+
elif self.m_listBoxPreferencesTopic.GetSelection() == 2:
306+
self.m_choiceBrailleMathCode.SetFocus()
307+
return
308+
if (event.GetModifiers() == wx.MOD_SHIFT) and (MathCATgui.MathCATPreferencesDialog.FindFocus() == self.m_buttonOK):
309+
if self.m_listBoxPreferencesTopic.GetSelection() == 0:
310+
self.m_choiceSpeechForChemical.SetFocus()
311+
elif self.m_listBoxPreferencesTopic.GetSelection() == 1:
312+
self.m_choiceSpeechAmountNavigation.SetFocus()
313+
elif self.m_listBoxPreferencesTopic.GetSelection() == 2:
314+
self.m_choiceBrailleHighlights.SetFocus()
315+
return
317316
#continue handling keyboard event
318317
event.Skip()
319318

0 commit comments

Comments
 (0)