Skip to content

Commit

Permalink
BrailleSettingsDialog: When automatic detection is configured, show t…
Browse files Browse the repository at this point in the history
…his as the active choice. Show the name of the current display in brackets if it isn't noBraille.
  • Loading branch information
jcsteh committed Dec 23, 2013
1 parent 6bb6602 commit 7f1021f
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions source/gui/settingsDialogs.py
Expand Up @@ -1286,15 +1286,28 @@ def makeSettings(self, settingsSizer):
sizer = wx.BoxSizer(wx.HORIZONTAL)
# Translators: The label for a setting in braille settings to choose a braille display.
label = wx.StaticText(self, wx.ID_ANY, label=_("Braille &display:"))
# Translators: An option in the braille display list in the Braille Settings dialog
# to automatically detect and use a braille display.
driverList = [(braille.AUTO_DISPLAY_NAME, _("Automatic"))]
curDispName = braille.handler.display.name
detectionEnabled = config.conf["braille"]["display"] == braille.AUTO_DISPLAY_NAME
driverList = []
if not detectionEnabled or curDispName == "noBraille":
# Translators: An option in the braille display list in the Braille Settings dialog
# to automatically detect and use a braille display.
driverList.append((braille.AUTO_DISPLAY_NAME, _("Automatic")))
else:
# Translators: An option in the braille display list in the Braille Settings dialog
# to automatically detect and use a braille display.
# %s will be replace dwith the name of the display that is currently being used.
driverList.append((braille.AUTO_DISPLAY_NAME,
_("Automatic (%s)") % braille.handler.display.description))
driverList.extend(braille.getDisplayList())
self.displayNames = [driver[0] for driver in driverList]
self.displayList = wx.Choice(self, wx.ID_ANY, choices=[driver[1] for driver in driverList])
self.Bind(wx.EVT_CHOICE, self.onDisplayNameChanged, self.displayList)
try:
selection = self.displayNames.index(braille.handler.display.name)
if detectionEnabled:
selection = 0
else:
selection = self.displayNames.index(curDispName)
self.displayList.SetSelection(selection)
except:
pass
Expand Down

0 comments on commit 7f1021f

Please sign in to comment.