def test_identifiers(self):
		"""Checks whether all defined braille display gestures contain valid braille display key identifiers."""
		for name, description in braille.getDisplayList(excludeNegativeChecks=False):
			driver=braille._getDisplayDriver(name)
			gmap=driver.gestureMap
			if not gmap:
				continue
			for cls, gesture, scriptName in gmap.getScriptsForAllGestures():
				if gesture.startswith("br"):
					self.assertRegexpMatches(gesture, braille.BrailleDisplayGesture.ID_PARTS_REGEX)
 def test_identifiers(self):
     """Checks whether all defined braille display gestures contain valid braille display key identifiers."""
     for name, description in braille.getDisplayList(
             excludeNegativeChecks=False):
         driver = braille._getDisplayDriver(name)
         gmap = driver.gestureMap
         if not gmap:
             continue
         for cls, gesture, scriptName in gmap.getScriptsForAllGestures():
             if gesture.startswith("br"):
                 self.assertRegexpMatches(
                     gesture, braille.BrailleDisplayGesture.ID_PARTS_REGEX)
示例#3
0
def getValidBrailleDisplayPrefered():
    l = braille.getDisplayList()
    l.append(("last", _("last known")))
    return l
示例#4
0
 def onSave(self, evt):
     postTableID = self.reading.postTable.GetSelection()
     postTable = "None" if postTableID == 0 else configBE.tablesFN[
         postTableID]
     restartNVDA = False if not restartNVDA_ else True
     if ((self.reading.tabSpace.GetValue() or postTable != "None")
             and not configBE.conf["patch"]["updateBraille"]):
         log.debug("Enabling patch for update braille function")
         configBE.conf["patch"]["updateBraille"] = True
         restartNVDA = True
     if ((self.reading.speakScroll.GetValue()
          or self.reading.alwaysSpeakScroll.GetValue())
             and not configBE.conf["patch"]["scrollBraille"]):
         log.debug("Enabling patch for scroll braille functions")
         configBE.conf["patch"]["scrollBraille"] = True
         restartNVDA = True
     if (not restartNVDA and
         (configBE.conf['general']['tabSize'] != int(
             self.reading.tabSize.GetValue())
          or configBE.conf['general']['tabSpace'] !=
          self.reading.tabSpace.GetValue()
          or configBE.conf['general']['postTable'] != postTable or
          (configBE.gesturesFileExists and
           configBE.conf['general']['keyboardLayout_%s' % configBE.curBD] !=
           configBE.iniProfile['keyboardLayouts'].keys()[
               self.keyboard.KBMode.GetSelection()]))):
         restartNVDA = True
     configBE.conf['general']['postTable'] = postTable
     configBE.conf['general'][
         'autoCheckUpdate'] = self.general.autoCheckUpdate.GetValue()
     configBE.conf['general'][
         'channelUpdate'] = 'dev' if self.general.channelUpdate.GetValue(
         ) else 'stable'
     configBE.conf['general'][
         'showConstructST'] = self.general.assistS.GetValue()
     configBE.conf['general'][
         'reportVolumeBraille'] = self.general.reportVolumeBraille.GetValue(
         )
     configBE.conf['general'][
         'reportVolumeSpeech'] = self.general.reportVolumeSpeech.GetValue()
     configBE.conf['general'][
         'hourDynamic'] = self.general.hourDynamic.GetValue()
     if configBE.conf['general'][
             'reverseScroll'] != self.reading.reverseScroll.GetValue():
         if self.reading.reverseScroll.GetValue():
             instanceGP.reverseScrollBtns()
         else:
             instanceGP.reverseScrollBtns(None, True)
         configBE.conf['general'][
             'reverseScroll'] = self.reading.reverseScroll.GetValue()
     configBE.conf['general'][
         'delayScroll_' +
         configBE.curBD] = self.reading.delayScroll.GetValue()
     try:
         if int(self.general.limitCells.GetValue()
                ) > configBE.backupDisplaySize or int(
                    self.general.limitCells.GetValue()) < 0:
             configBE.conf['general']['limitCells_' + configBE.curBD] = 0
         else:
             if configBE.conf['general'][
                     'limitCells_' + configBE.curBD] != 0 and int(
                         self.general.limitCells.GetValue()) == 0:
                 braille.handler.displaySize = configBE.backupDisplaySize
             configBE.conf['general']['limitCells_' + configBE.curBD] = int(
                 self.general.limitCells.GetValue())
     except BaseException:
         configBE.conf['general']['limitCells_' + configBE.curBD] = 0
     configBE.conf['general'][
         'smartDelayScroll'] = self.reading.smartDelayScroll.GetValue()
     configBE.conf['general'][
         'speakScroll'] = self.reading.speakScroll.GetValue()
     configBE.conf['general'][
         'alwaysSpeakScroll'] = self.reading.alwaysSpeakScroll.GetValue()
     configBE.conf['general'][
         'speakRoutingTo'] = self.reading.speakRoutingTo.GetValue()
     configBE.conf['general']['tabSpace'] = self.reading.tabSpace.GetValue()
     configBE.conf['general']['tabSize'] = self.reading.tabSize.GetValue()
     configBE.conf['general'][
         'attribra'] = self.attribra.attribraEnabled.GetValue()
     configBE.conf['general'][
         'reviewModeApps'] = self.general.reviewModeApps.GetValue()
     if not configBE.noUnicodeTable:
         configBE.conf['general']['iTableShortcuts'] = configBE.tablesUFN[
             self.keyboard.iTableShortcuts.GetSelection() -
             1] if self.keyboard.iTableShortcuts.GetSelection() > 0 else '?'
     if not self.reading.smartDelayScroll.GetValue():
         configBE.conf['general'][
             'ignoreBlankLineScroll'] = self.reading.ignoreBlankLineScroll.GetValue(
             )
     if configBE.gesturesFileExists:
         configBE.conf['general'][
             'keyboardLayout_%s' %
             configBE.curBD] = configBE.iniProfile['keyboardLayouts'].keys(
             )[self.keyboard.KBMode.GetSelection()]
     if configBE.curBD != 'noBraille':
         configBE.conf['general'][
             'quickLaunchGestures_%s' % configBE.curBD] = ';'.join(
                 self.quickLaunches.quickLaunchGestures)
         configBE.conf['general'][
             'quickLaunchLocations_%s' % configBE.curBD] = '; '.join(
                 self.quickLaunches.quickLaunchLocations)
     configBE.conf['general']['iTables'] = ','.join(self.keyboard.iTables)
     configBE.conf['general']['oTables'] = ','.join(self.reading.oTables)
     configBE.conf['general']['brailleDisplay1'] = braille.getDisplayList()[
         self.general.brailleDisplay1.GetSelection()][0]
     configBE.conf['general']['brailleDisplay2'] = braille.getDisplayList()[
         self.general.brailleDisplay2.GetSelection()][0]
     self.buttonC.SetFocus()
     configBE.saveSettingsAttribra()
     configBE.saveSettings()
     if restartNVDA:
         gui.messageBox(
             _(u"You have made a change that requires you restart NVDA"),
             '%s – %s' % (configBE._addonName, _(u"Restart required")),
             wx.OK | wx.ICON_INFORMATION)
         self.onClose(None)
         queueHandler.queueFunction(queueHandler.eventQueue, core.restart)
     return instanceGP.onReload(None, True)
示例#5
0
 def getIdBD(name):
     return [k[0]
             for k in braille.getDisplayList()].index(name) if name in [
                 k[0] for k in braille.getDisplayList()
             ] else len(braille.getDisplayList()) - 1
示例#6
0
 def __init__(self, parent):
     wx.Panel.__init__(self, parent)
     settings = wx.BoxSizer(wx.VERTICAL)
     loadBDs = wx.BoxSizer(wx.VERTICAL)
     self.autoCheckUpdate = wx.CheckBox(
         self, label=_('Check for updates automatically'))
     if configBE.conf['general']['autoCheckUpdate']:
         self.autoCheckUpdate.SetValue(True)
     self.channelUpdate = wx.CheckBox(
         self, label=_('Download development versions'))
     if configBE.conf['general']['channelUpdate'] == 'dev':
         self.channelUpdate.SetValue(True)
     self.assistS = wx.CheckBox(
         self,
         label=_(
             'Detail the progress of a keyboard shortcut when it is typed'))
     if configBE.conf['general']['showConstructST']:
         self.assistS.SetValue(True)
     settings.Add(self.assistS)
     self.reportVolumeBraille = wx.CheckBox(
         self, label=_('Report of the new volume in braille'))
     if configBE.conf['general']['reportVolumeBraille']:
         self.reportVolumeBraille.SetValue(True)
     settings.Add(self.reportVolumeBraille)
     self.reportVolumeSpeech = wx.CheckBox(
         self, label=_('Report of the new volume in speech'))
     if configBE.conf['general']['reportVolumeSpeech']:
         self.reportVolumeSpeech.SetValue(True)
     settings.Add(self.reportVolumeSpeech)
     self.hourDynamic = wx.CheckBox(
         self, label=_('Display time and date infinitely'))
     if configBE.conf['general']['hourDynamic']:
         self.hourDynamic.SetValue(True)
     settings.Add(self.hourDynamic)
     settings.Add(wx.StaticText(self, -1, label=_('Re&view mode in')))
     self.reviewModeApps = wx.TextCtrl(self,
                                       -1,
                                       value=str(', '.join(
                                           configBE.reviewModeApps)))
     settings.Add(self.reviewModeApps)
     self.reviewModeApps.Bind(wx.EVT_CHAR, self.onReviewModeApps)
     settings.Add(
         wx.StaticText(
             self,
             -1,
             label=_('&Limit number of cells to (0 for no limit)')))
     self.limitCells = wx.TextCtrl(
         self,
         -1,
         value=str(configBE.conf['general']['limitCells_' +
                                            configBE.curBD]))
     settings.Add(self.limitCells)
     self.limitCells.Bind(wx.EVT_CHAR, self.onLimitCells)
     lb = braille.getDisplayList()
     lbl = []
     for l in lb:
         if l[0] == 'noBraille': lbl.append(_('Last known'))
         else: lbl.append(l[1])
     loadBDs.Add(
         wx.StaticText(self,
                       -1,
                       label=_('Braille display to load on NVDA+&k')))
     self.brailleDisplay1 = wx.Choice(self, pos=(-1, -1), choices=lbl)
     if configBE.conf['general']['brailleDisplay1'] == -1:
         self.brailleDisplay1.SetSelection(len(lbl) - 1)
     else:
         self.brailleDisplay1.SetSelection(
             self.getIdBD(configBE.conf['general']['brailleDisplay1']))
     loadBDs.Add(
         wx.StaticText(self,
                       -1,
                       label=_('Braille display to load on NVDA+Shift+k')))
     self.brailleDisplay2 = wx.Choice(self, pos=(-1, -1), choices=lbl)
     if configBE.conf['general']['brailleDisplay2'] == -1:
         self.brailleDisplay2.SetSelection(len(lbl) - 1)
     else:
         self.brailleDisplay2.SetSelection(
             self.getIdBD(configBE.conf['general']['brailleDisplay2']))
     loadBDs.Add(self.brailleDisplay1)
     loadBDs.Add(self.brailleDisplay2)
     settings.Add(loadBDs)