Skip to content

Commit

Permalink
Add a "No message timeout" checkbox to braille settings. Fixes nvacce…
Browse files Browse the repository at this point in the history
  • Loading branch information
dkager committed Jan 21, 2017
1 parent 150add9 commit 3b2bede
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
7 changes: 5 additions & 2 deletions source/braille.py
Expand Up @@ -1612,6 +1612,8 @@ def _resetMessageTimer(self):
"""Reset the message timeout.
@precondition: A message is currently being displayed.
"""
if config.conf["braille"]["noMessageTimeout"]:
return
# Configured timeout is in seconds.
timeout = config.conf["braille"]["messageTimeout"] * 1000
if self._messageCallLater:
Expand All @@ -1626,8 +1628,9 @@ def _dismissMessage(self):
"""
self.buffer.clear()
self.buffer = self.mainBuffer
self._messageCallLater.Stop()
self._messageCallLater = None
if not config.conf["braille"]["noMessageTimeout"]:
self._messageCallLater.Stop()
self._messageCallLater = None
self.update()

def handleGainFocus(self, obj):
Expand Down
1 change: 1 addition & 0 deletions source/config/configSpec.py
Expand Up @@ -57,6 +57,7 @@
cursorBlink = boolean(default=true)
cursorBlinkRate = integer(default=500,min=200,max=2000)
cursorShape = integer(default=192,min=1,max=255)
noMessageTimeout = boolean(default=false)
messageTimeout = integer(default=4,min=0,max=20)
tetherTo = string(default="focus")
readByParagraph = boolean(default=false)
Expand Down
14 changes: 13 additions & 1 deletion source/gui/settingsDialogs.py
Expand Up @@ -1562,11 +1562,19 @@ def makeSettings(self, settingsSizer):
self.shapeList.Disable()

# Translators: The label for a setting in braille settings to change how long a message stays on the braille display (in seconds).
messageTimeoutText = _("Message timeout (sec)")
messageTimeoutText = _("Message &timeout (sec)")
self.messageTimeoutEdit = sHelper.addLabeledControl(messageTimeoutText, nvdaControls.SelectOnFocusSpinCtrl,
min=int(config.conf.getConfigValidationParameter(["braille", "messageTimeout"], "min")),
max=int(config.conf.getConfigValidationParameter(["braille", "messageTimeout"], "max")),
initial=config.conf["braille"]["messageTimeout"])
if self.noMessageTimeoutCheckBox.GetValue():
self.messageTimeoutEdit.Disable()

# Translators: The label for a setting in braille settings to display a message on the braille display indefinitely.
noMessageTimeoutLabelText = _("No &message timeout")
self.noMessageTimeoutCheckBox = sHelper.addItem(wx.CheckBox(self, label=noMessageTimeoutLabelText))
self.noMessageTimeoutCheckBox.Bind(wx.EVT_CHECKBOX, self.onNoMessageTimeoutChange)
self.noMessageTimeoutCheckBox.SetValue(config.conf["braille"]["noMessageTimeout"])

# Translators: The label for a setting in braille settings to set whether braille should be tethered to focus or review cursor.
tetherListText = _("Braille tethered to:")
Expand Down Expand Up @@ -1611,6 +1619,7 @@ def onOk(self, evt):
config.conf["braille"]["cursorBlink"] = self.cursorBlinkCheckBox.GetValue()
config.conf["braille"]["cursorBlinkRate"] = self.cursorBlinkRateEdit.GetValue()
config.conf["braille"]["cursorShape"] = self.cursorShapes[self.shapeList.GetSelection()]
config.conf["braille"]["noMessageTimeout"] = self.noMessageTimeoutCheckBox.GetValue()
config.conf["braille"]["messageTimeout"] = self.messageTimeoutEdit.GetValue()
braille.handler.tether = self.tetherValues[self.tetherList.GetSelection()][0]
config.conf["braille"]["readByParagraph"] = self.readByParagraphCheckBox.Value
Expand Down Expand Up @@ -1650,6 +1659,9 @@ def onShowCursorChange(self, evt):
def onBlinkCursorChange(self, evt):
self.cursorBlinkRateEdit.Enable(evt.IsChecked())

def onNoMessageTimeoutChange(self, evt):
self.messageTimeoutEdit.Enable(not evt.IsChecked())

class AddSymbolDialog(wx.Dialog):

def __init__(self, parent):
Expand Down
3 changes: 3 additions & 0 deletions user_docs/en/userGuide.t2t
Expand Up @@ -931,6 +931,9 @@ The selection indicator is not affected by this option.
This option is a numerical field that controls how long NVDA messages are displayed on the braille display.
Specifying 0 disables displaying of these messages completely.

==== No Message Timeout ====
This option allows NVDA messages to be displayed on the braille display indefinitely.

%kc:setting
==== Braille Tethered to ====[BrailleTether]
Key: NVDA+control+t
Expand Down

0 comments on commit 3b2bede

Please sign in to comment.