Esempio n. 1
0
	def inTrackView(self, obj, notify = True):
		if obj.role in [ROLE_TRACK, ROLE_TRACKVIEW]:
			return True
		if notify:
			# Translators: message to the user when object is not in tracks view
			speech.speakMessage(_("Not in tracks view"))
		return False
Esempio n. 2
0
 def __init__(self, port):
     global mbCellsMap, mbBaud, mbDll
     super(BrailleDisplayDriver, self).__init__()
     mbCellsMap = [convertMbCells(x) for x in rangeFunc(256)]
     if mbBaud:
         log.info("Try MDV on port %s at saved baud %d" % (port, mbBaud))
     else:
         log.info("Try MDV on port %s at baud 38400 and 19200" % port)
     mbPort = bytes(port.encode("mbcs"))
     mbFound = False
     bauds = (mbBaud, ) if mbBaud else (38400, 19200)
     if not mbBaud:
         args = (
             _("Please wait"),
             Spri.NOW,
         ) if py3 else (_("Please wait"), )
         speakMessage(*args)
     for baud in bauds:
         log.info("Trying baud %d" % baud)
         loadDll(baud)
         if mbDll.BrlInit(mbPort, baud):
             mbBaud = baud
             mbFound = True
             log.info("Found MDV on port %s at baud %d" % (port, baud))
             break
     if not mbFound:
         resetBaud()
         loadDll(mbBaud)
         raise RuntimeError("No MB408 display found")
     else:
         self._keyCheckTimer = wx.PyTimer(self._handleKeyPresses)
         self._keyCheckTimer.Start(KEY_CHECK_INTERVAL)
         saveBaud()
Esempio n. 3
0
    def _handleInputHelp(self, gesture, onlyLog=False):
        textList = [gesture.displayName]
        script = gesture.script
        runScript = False
        logMsg = "Input help: gesture %s" % gesture.identifiers[0]
        if script:
            scriptName = scriptHandler.getScriptName(script)
            logMsg += ", bound to script %s" % scriptName
            scriptLocation = scriptHandler.getScriptLocation(script)
            if scriptLocation:
                logMsg += " on %s" % scriptLocation
            if scriptName == "toggleInputHelp":
                runScript = True
            else:
                desc = script.__doc__
                if desc:
                    textList.append(desc)

        log.info(logMsg)
        if onlyLog:
            return

        import braille
        braille.handler.message("\t\t".join(textList))
        # Punctuation must be spoken for the gesture name (the first chunk) so that punctuation keys are spoken.
        speech.speakText(textList[0],
                         reason=controlTypes.REASON_MESSAGE,
                         symbolLevel=characterProcessing.SYMLVL_ALL)
        for text in textList[1:]:
            speech.speakMessage(text)

        if runScript:
            script(gesture)
Esempio n. 4
0
 def announceColumnContent(self,
                           colNumber,
                           header=None,
                           individualColumns=False):
     if not header:
         # #72: directly fetch on-screen column header (not the in-memory one) by probing column order array from the list (parent).
         # #65 (18.08): use column header method (at least the method body) provided by the class itself.
         # This will work properly if the list (parent) is (or recognized as) SysListView32.List.
         header = self._getColumnHeaderRaw(
             self.parent._columnOrderArray[colNumber])
         # LTS: Studio 5.10 data structure change is also seen in Creator, so don't rely on column headers alone.
         internalHeaders = indexOf(self.appModule.productVersion)
         if internalHeaders[colNumber] != header:
             colNumber = internalHeaders.index(header)
     columnContent = self._getColumnContentRaw(colNumber)
     if columnContent:
         if py3:
             ui.message(
                 str(_("{header}: {content}")).format(
                     header=header, content=columnContent))
         else:
             ui.message(
                 unicode(_("{header}: {content}")).format(
                     header=header, content=columnContent))
     else:
         if individualColumns:
             # Translators: Presented when some info is not defined for a track in Track Tool (example: cue not found)
             ui.message(_("{header} not found").format(header=header))
         else:
             import speech, braille
             speech.speakMessage(_("{header}: blank").format(header=header))
             braille.handler.message(
                 _("{header}: ()").format(header=header))
Esempio n. 5
0
 def script_moveto(self, gesture, fromQuickNav=False, fromSpeak=False):
     reason = nodeHandler.REASON_FOCUS
     if not fromQuickNav:
         reason = nodeHandler.REASON_SHORTCUT
     if fromSpeak:
         # Translators: Speak rule name on "Move to" action
         speech.speakMessage(_("Move to %s") % self.markerQuery.name)
     elif self.markerQuery.sayName:
         speech.speakMessage(self.markerQuery.name)
     if self.markerQuery.createWidget:
         self.node.moveto(reason)
         return
     treeInterceptor = html.getTreeInterceptor()
     if not treeInterceptor or not treeInterceptor.isReady:
         return
     focusObject = api.getFocusObject()
     try:
         nodeObject = self.node.getTextInfo().NVDAObjectAtStart
     except:
         nodeObject = None
     treeInterceptor.passThrough = self.markerQuery.formMode
     browseMode.reportPassThrough.last = treeInterceptor.passThrough
     self.node.moveto(reason)
     if not self.markerQuery.formMode:
         speechOff()
         html.speakLine()
         speechOn()
         #info = html.getCaretInfo()
         #info.expand(textInfos.UNIT_LINE)
         #speech.speakTextInfo(info, reason=controlTypes.REASON_FOCUS, unit=textInfos.UNIT_LINE)
         sleep(0.3)
         #log.info(u"trace")
         html.speakLine()
     elif nodeObject == focusObject and focusObject is not None:
         focusObject.reportFocus()
Esempio n. 6
0
 def script_copyToClipboard(self, gesture):
     info = self.makeTextInfo(textInfos.POSITION_SELECTION)
     if info.isCollapsed:
         speech.speakMessage(_("no selection"))
         return
     if info.copyToClipboard():
         speech.speakMessage(_("copied to clipboard"))
Esempio n. 7
0
	def _handleInputHelp(self, gesture, onlyLog=False):
		textList = [gesture.displayName]
		script = gesture.script
		runScript = False
		logMsg = "Input help: gesture %s"%gesture.logIdentifier
		if script:
			scriptName = scriptHandler.getScriptName(script)
			logMsg+=", bound to script %s" % scriptName
			scriptLocation = scriptHandler.getScriptLocation(script)
			if scriptLocation:
				logMsg += " on %s" % scriptLocation
			if scriptName == "toggleInputHelp":
				runScript = True
			else:
				desc = script.__doc__
				if desc:
					textList.append(desc)

		log.info(logMsg)
		if onlyLog:
			return

		import braille
		braille.handler.message("\t\t".join(textList))
		# Punctuation must be spoken for the gesture name (the first chunk) so that punctuation keys are spoken.
		speech.speakText(textList[0], reason=controlTypes.REASON_MESSAGE, symbolLevel=characterProcessing.SYMLVL_ALL)
		for text in textList[1:]:
			speech.speakMessage(text)

		if runScript:
			script(gesture)
Esempio n. 8
0
	def script_copyToClipboard(self,gesture):
		info=self.makeTextInfo(textInfos.POSITION_SELECTION)
		if info.isCollapsed:
			speech.speakMessage(_("no selection"))
			return
		if info.copyToClipboard():
			speech.speakMessage(_("copied to clipboard"))
 def script_controlPageUp(self, gesture):
     if lib.searchTag("button", func=self.isBoutonPagePrecedente):
         speech.speakMessage(u"page précédente")
         obj = lib.getCaretObject()
         obj.doAction()
     else:
         speech.speakMessage(u"pas de page précédente")
 def reportMenubarState(self):
     menubar = Menubar(self)
     if menubar is None:
         return
     if not menubar.isVisible():
         # Translators: message to user to report menubar is not visible
         speech.speakMessage(_("Menu bar is hidden"))
 def reportViewState(self):
     if self.isVisible():
         # Translators: message to user to report state of anchored playlist.
         speech.speakMessage(_("Anchored playlist shown"))
     else:
         # Translators: message to user to report state of anchored playlist.
         speech.speakMessage(_("Anchored playlist hidden"))
 def reportMediaStates(self):
     (muteState, level) = self.getVolumeMuteStateAndLevel()
     if not self.hasMedia():
         if muteState:
             # Translators: message to the user to say volume is muted.
             speech.speakMessage(_("volume muted"))
         return
     isPlaying = self.isPlaying()
     printDebug(
         "MainWindow: reportMediaStates playing= %s, oldPlaying= %s, mute = %s"
         % (isPlaying, self._curMediaState, muteState))
     if self._curMediaState is not None and (isPlaying
                                             == self._curMediaState):
         return
     if muteState:
         # Translators: message to user when volume is muted
         msg = _("volume muted")
         if isPlaying:
             # Translators: message to the user to say playing with muted volume.
             msg = _("Playing,%s") % msg
         else:
             # translators: message to the user to say pause with muted volume.
             msg = _("Pause,%s") % msg
         queueHandler.queueFunction(queueHandler.eventQueue,
                                    speech.speakMessage, msg)
     elif not isPlaying:
         # Translators: message to the user to say media is paused.
         speech.speakMessage(_("Pause"))
     self._curMediaState = isPlaying
    def script_reportChangeSelection(self, gesture):
        global _GB_taskTimer

        def callback():
            global _GB_taskTimer
            _GB_taskTimer = None

            text = self.getSelectionInfo()
            if text != "":
                queueHandler.queueFunction(queueHandler.eventQueue,
                                           speech.speakText,
                                           text,
                                           symbolLevel=SYMLVL_SOME)

        if _GB_taskTimer:
            _GB_taskTimer.Stop()
            _GB_taskTimer = None
        gesture.send()
        try:
            msg = self.__changeSelectionGestures[
                "+".join(gesture.modifierNames) + "+" + gesture.mainKeyName]
        except:  # noqa:E722
            msg = None
        if msg:
            speech.speakMessage(msg)
        _GB_taskTimer = core.callLater(800, callback)
Esempio n. 14
0
 def speakActiveLineIfChanged(self, gesture):
     old = self.makeTextInfo(textInfos.POSITION_CARET)
     gesture.send()
     new = self.makeTextInfo(textInfos.POSITION_CARET)
     if new.bookmark.startOffset != old.bookmark.startOffset:
         new.expand(textInfos.UNIT_LINE)
         speech.speakMessage(new.text)
	def input(self, dots: int):
		"""Handle one cell of braille input.
		"""
		# Insert the newly entered cell into the buffer at the cursor position.
		pos = self.untranslatedStart + self.untranslatedCursorPos
		self.bufferBraille.insert(pos, dots)
		self.untranslatedCursorPos += 1
		# Space ends the word.
		endWord = dots == 0
		# For uncontracted braille, translate the buffer for each cell added.
		# Any new characters produced are then sent immediately.
		# For contracted braille, translate the buffer only when a word is ended (i.e. a space is typed).
		# This is because later cells can change characters produced by previous cells.
		# For example, in English grade 2, "tg" produces just "tg",
		# but "tgr" produces "together".
		if not self.useContractedForCurrentFocus or endWord:
			if self._translate(endWord):
				if not endWord:
					self.cellsWithText.add(pos)
			elif self.bufferText and not self.useContractedForCurrentFocus:
				# Translators: Reported when translation didn't succeed due to unsupported input.
				speech.speakMessage(_("Unsupported input"))
				self.flushBuffer()
			else:
				# This cell didn't produce any text; e.g. number sign.
				self._reportUntranslated(pos)
		else:
			self._reportUntranslated(pos)
Esempio n. 16
0
	def script_reportCurrentLine (self, gesture):
		"""
		This script reports the line that the current navigator object is focused on, and speaks/brailles it appropriately depending on the state of l{processMaths}.  If pressed twice quickly, the current line is spelt out.
		@param gesture: the gesture to be passed through to NVDA (in this case, a keypress).
		@type gesture: l{inputCore.InputGesture}.
		"""

		obj=api.getFocusObject()
		treeInterceptor=obj.treeInterceptor
		if hasattr(treeInterceptor,'TextInfo') and not treeInterceptor.passThrough:
			obj=treeInterceptor
		try:
			info=obj.makeTextInfo(textInfos.POSITION_CARET)
		except (NotImplementedError, RuntimeError):
			info=obj.makeTextInfo(textInfos.POSITION_FIRST)
		info.expand(textInfos.UNIT_LINE)
		if getLastScriptRepeatCount()==0:
			if EditableText.processMaths:
				spokenLine = GetLine ()
				brailledLine = GetLine ()
				if not spokenLine and not brailledLine:# Is it a blank line?
					spokenLine = _("blank")
					brailledLine = _("")
				else:
					spokenLine = EditableText.latex_access.speech (spokenLine)
					brailledLine = EditableText.latex_access.nemeth (brailledLine)
				speech.speakMessage (spokenLine)
				braille.handler.message (brailledLine)
			else:
				speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason=controlTypes.REASON_CARET)
		else:
			speech.speakSpelling(info.text)
Esempio n. 17
0
	def input(self, dots):
		"""Handle one cell of braille input.
		"""
		# Insert the newly entered cell into the buffer at the cursor position.
		pos = self.untranslatedStart + self.untranslatedCursorPos
		self.bufferBraille.insert(pos, dots)
		self.untranslatedCursorPos += 1
		# Space ends the word.
		endWord = dots == 0
		# For uncontracted braille, translate the buffer for each cell added.
		# Any new characters produced are then sent immediately.
		# For contracted braille, translate the buffer only when a word is ended (i.e. a space is typed).
		# This is because later cells can change characters produced by previous cells.
		# For example, in English grade 2, "tg" produces just "tg",
		# but "tgr" produces "together".
		if not self.useContractedForCurrentFocus or endWord:
			if self._translate(endWord):
				if not endWord:
					self.cellsWithText.add(pos)
			elif self.bufferText and not self.useContractedForCurrentFocus:
				# Translators: Reported when translation didn't succeed due to unsupported input.
				speech.speakMessage(_("Unsupported input"))
				self.flushBuffer()
			else:
				# This cell didn't produce any text; e.g. number sign.
				self._reportUntranslated(pos)
		else:
			self._reportUntranslated(pos)
def _getActiveChild(obj):
	# QT doesn't do accFocus properly, so find the active child ourselves.
	if obj.childCount == 0:
		return None
	child = None
	oIA = obj.IAccessibleObject
	step = 1
	if obj.role == ROLE_TREEVIEW:
		step = getColumnHeaderCount(oIA)
		if step > 1 and obj.childCount > 20000:
			speech.speakMessage(_("Please wait"))
	for i in range(0, obj.childCount, step):
		if i > 20000\
			and obj.role in [ROLE_TREEVIEW, ROLE_LIST]:
			break
		oldChild = child
		child = oIA.accChild(i + 1)
		# my modification to remove an NVDA error
		if child is None:
			break
		try:
			states = child.accState(0)
		except Exception:
			continue
		if states & oleacc.STATE_SYSTEM_FOCUSED\
			or states & oleacc.STATE_SYSTEM_SELECTED:
			return obj.getChild(i)
		# 9202: In Virtualbox 5.2 and above, accNavigate is severely broken,
		# returning the current object when calling next, causing an endless loop.
		if oldChild == child:
			break
	printDebug("_getActiveChild end with no child:i= %s" % i)
	return None
	def speakActiveLineIfChanged(self, gesture):
		old = self.makeTextInfo(textInfos.POSITION_CARET)
		gesture.send()
		new = self.makeTextInfo(textInfos.POSITION_CARET)
		if new.bookmark.startOffset != old.bookmark.startOffset:
			new.expand(textInfos.UNIT_LINE)
			speech.speakMessage(new.text)
Esempio n. 20
0
    def reportFocus(self):
        global activePannel
        if activePannel == 1:
            # Translators: this text is added as a description of the objects in the corresponding panel.
            self.description = _("Left pannel")
        else:
            # Translators: this text is added as a description of the objects in the corresponding panel.
            self.description = _("Right pannel")

        if self.name:
            speakList = []
            if controlTypes.STATE_SELECTED in self.states:
                speakList.append(
                    controlTypes.stateLabels[controlTypes.STATE_SELECTED])
            speakList.append(self.name.split("\\")[-1])
            if config.conf['presentation'][
                    'reportObjectPositionInformation'] == True and tcApi.isApiSupported(
                    ):
                positionInfo = self.positionInfo
                template = _('{current} of {all}').format(
                    current=positionInfo['indexInGroup'],
                    all=positionInfo['similarItemsInGroup'])
                if self.name.split("\t")[0] != '..':
                    speakList.append(' ' + template)
            if self.hasFocus:
                speech.speakMessage(" ".join(speakList))
        else:
            super(TCFileList, self).reportFocus()
Esempio n. 21
0
 def increaseColWidth(self):
     c = self.getCell()
     c.colHeader.width += 1
     speech.speakMessage(u"largeur %d" % c.colHeader.width)
     key = "width_%s" % c.colHeader.id
     self.setTableConfig(key, c.colHeader.width)
     self.displayBraille()
Esempio n. 22
0
	def _caretScriptPostMovedHelper(self, speakUnit, gesture, info = None):
		"""
This method ensures that LaTeX translation occurs when the system caret moves, and also makes sure that normal behaviour occurs when l{processMaths} is off.
		"""

		if isScriptWaiting ():
			return

		if not info:
			try:
				info = self.makeTextInfo (textInfos.POSITION_CARET)
			except:
				return
		review.handleCaretMove(info)
		if speakUnit == textInfos.UNIT_LINE and EditableText.processMaths and not willSayAllResume(gesture):
			spokenLine = GetLine ()
			brailledLine = GetLine ()
			if not spokenLine and not brailledLine:# Is it a blank line?
				spokenLine = _("blank")
				brailledLine = _("")
			else:
				spokenLine = EditableText.latex_access.speech (spokenLine)
				brailledLine = EditableText.latex_access.nemeth (brailledLine)
			speech.speakMessage (spokenLine)
			braille.handler.message (brailledLine)
		else:
			if speakUnit and not willSayAllResume(gesture):
				info.expand(speakUnit)
				speech.speakTextInfo(info, unit=speakUnit, reason=controlTypes.REASON_CARET)
		braille.handler.handleCaretMove(self)
Esempio n. 23
0
	def script_connect(self, gesture):
		if self.connector or self.control_connector : # a connection is already established
			speech.speakMessage(_("You can't open that dialog, a connection is already established"))
		elif self.connector is None and self.control_connector is None: # A connection doesn't yet exist, open the dialog
			self.do_connect('gesture')
		else:
			speech.speakMessage(_("Error, connection state can't be determined!"))
Esempio n. 24
0
 def script_readDoc(self, gesture):
     obj = self.getEditor()
     if not obj:
         return ui.message(_("Editor not found"))
     obj = obj.simpleNext
     if not obj:
         return ui.message(_("Nothing"))
     else:
         msgs = []
         while obj:
             if obj.role in [
                     controlTypes.ROLE_TOOLTIP, controlTypes.ROLE_STATICTEXT
             ]:
                 if obj.role == controlTypes.ROLE_TOOLTIP:
                     obj = obj.simpleFirstChild
                 if obj.name.strip() and obj.name != '':
                     if obj.description:
                         msgs.append(f"{obj.name} {obj.description}")
                     else:
                         msgs.append(obj.name)
             obj = obj.simpleNext
         scriptCount = getLastScriptRepeatCount()
         if scriptCount == 0:
             braille.handler.message("  ".join(msgs))
             for e in msgs:
                 speech.speakMessage(e,
                                     speech.priorities.SpeechPriority.NEXT)
         else:
             ui.browseableMessage('\n'.join(msgs))
Esempio n. 25
0
	def connected_to_relay(self):
		log.info("Control connector connected")
		beep_sequence.beep_sequence((720, 100), 50, (720, 100), 50, (720, 100))
		# Translators: Presented in direct (client to server) remote connection when the controlled computer is ready.
		speech.speakMessage(_("Connected to control server"))
		self.push_clipboard_item.Enable(True)
		write_connection_to_config(self.control_connector.address)
 def script_spellingCheckerHelper(self, gesture):
     global GB_scriptTimer
     if not self.isSupportedVersion():
         # Translators: message to the user when word version is not supported.
         speech.speakMessage(_("Not available for this Word version"))
         return
     stopScriptTimer()
     focus = api.getFocusObject()
     from .ww_spellingChecker import SpellingChecker
     sc = SpellingChecker(focus, self.WinwordVersion)
     if not sc.inSpellingChecker():
         # Translators: message to  indicate the focus is not in spellAndGrammar checker.
         queueHandler.queueFunction(
             queueHandler.eventQueue, speech.speakMessage,
             _("You are Not in the spelling checker"))
         return
     if focus.role == controlTypes.ROLE_PANE:
         # focus on the pane not  not on an object of the pane
         # Translators: message to ask user to hit tab key.
         queueHandler.queueFunction(
             queueHandler.eventQueue, speech.speakMessage,
             _("Hit tab to move focus in the spelling checker pane"))
         return
     count = scriptHandler.getLastScriptRepeatCount()
     count = scriptHandler.getLastScriptRepeatCount()
     if count == 0:
         GB_scriptTimer = core.callLater(_delay,
                                         sc.sayErrorAndSuggestion,
                                         spell=False)
     elif count == 1:
         GB_scriptTimer = core.callLater(_delay,
                                         sc.sayErrorAndSuggestion,
                                         spell=True)
     else:
         wx.CallAfter(sc.sayHelpText)
 def script_toggleSkipEmptyParagraphsOption(self, gesture):
     if _addonConfigManager.toggleSkipEmptyParagraphsOption():
         # Translators: message to report skipping of empty paragraph when moving by paragraph.
         speech.speakMessage(_("Skip empty paragraphs"))
     else:
         # Translators: message to report no skipping empty paragraph when moving by paragraph.
         speech.speakMessage(_("Don't skip empty paragraphs"))
    def getElementsInCollection(self):
        printDebug("Collection getElementsInCollection")
        objectsInCollection = self.getCollection()
        if objectsInCollection == None:
            return None

        elements = []
        startTime = time.time()
        count = len(objectsInCollection)
        for item in objectsInCollection:
            startTime = self.sayPercentage(objectsInCollection.index(item),
                                           count, startTime)
            if self.parent and self.parent.canceled:
                return []
            (obj, elementClass) = item
            element = elementClass(self, obj)
            try:
                element = elementClass(self, obj)
                elements.append(element)

            except:
                printDebug(
                    "getElementsInCollection:  except on element = elementClass"
                )
                speech.speakMessage(
                    _("Sorry, There are too  many elements to be treated "))
                time.sleep(2.0)
                return None

        return elements
	def reportFocus(self):
		if self.appModule.outlookVersion>=13 and self.appModule.nativeOm:
			e=self.appModule.nativeOm.activeExplorer()
			s=e.selection
			if s.count>0:
				p=s.item(1)
				try:
					start=p.start
					end=p.end
				except COMError:
					return super(CalendarView,self).reportFocus()
				t=self._generateTimeRangeText(start,end)
				# Translators: A message reported when on a calendar appointment in Microsoft Outlook
				speech.speakMessage(_("Appointment {subject}, {time}").format(subject=p.subject,time=t))
			else:
				v=e.currentView
				try:
					selectedStartTime=v.selectedStartTime
					selectedEndTime=v.selectedEndTime
				except COMError:
					return super(CalendarView,self).reportFocus()
				timeSlotText=self._generateTimeRangeText(selectedStartTime,selectedEndTime)
				startLimit=u"%s %s"%(winKernel.GetDateFormat(winKernel.LOCALE_USER_DEFAULT, winKernel.DATE_LONGDATE, selectedStartTime, None),winKernel.GetTimeFormat(winKernel.LOCALE_USER_DEFAULT, winKernel.TIME_NOSECONDS, selectedStartTime, None))
				endLimit=u"%s %s"%(winKernel.GetDateFormat(winKernel.LOCALE_USER_DEFAULT, winKernel.DATE_LONGDATE, selectedEndTime, None),winKernel.GetTimeFormat(winKernel.LOCALE_USER_DEFAULT, winKernel.TIME_NOSECONDS, selectedEndTime, None))
				query=u'[Start] < "{endLimit}" And [End] > "{startLimit}"'.format(startLimit=startLimit,endLimit=endLimit)
				i=e.currentFolder.items
				i.sort('[Start]')
				i.IncludeRecurrences =True
				if i.find(query):
					# Translators: a message when the current time slot on an Outlook Calendar has an appointment
					timeSlotText=_("has appointment")+" "+timeSlotText
				speech.speakMessage(timeSlotText)
		else:
			self.event_valueChange()
 def event_gainFocus(self, obj, nextHandler):
     printDebug(
         "Word: event_gainFocus: %s, %s" %
         (controlTypes.roleLabels.get(obj.role), obj.windowClassName))
     if not hasattr(self, "WinwordWindowObject"):
         try:
             self.WinwordWindowObject = obj.WinwordWindowObject
             self.WinwordVersion = obj.WinwordVersion
         except:  # noqa:E722
             pass
     if not self.hasFocus:
         nextHandler()
         return
     if obj.windowClassName == "OpusApp":
         # to suppress double announce of document window title
         return
     # for spelling and grammar check ending window
     if obj.role == controlTypes.ROLE_BUTTON and obj.name.lower() == "ok":
         foreground = api.getForegroundObject()
         if foreground.windowClassName == "#32770"\
          and foreground.name == "Microsoft Word":
             lastChild = foreground.getChild(foreground.childCount - 1)
             if lastChild.windowClassName == "MSOUNISTAT":
                 speech.speakMessage(foreground.description)
     nextHandler()
Esempio n. 31
0
 def handlePossibleProfileSwitch(cls):
     from gui.settingsDialogs import NvdaSettingsDialogActiveConfigProfile as newProfile
     if (cls.oldProfile and newProfile and newProfile != cls.oldProfile):
         # Translators: A message announcing what configuration profile is currently being edited.
         speech.speakMessage(
             _("Editing profile {profile}").format(profile=newProfile))
     cls.oldProfile = newProfile
Esempio n. 32
0
 def connected_to_relay(self):
     log.info("Control connector connected")
     beep_sequence.beep_sequence((720, 100), 50, (720, 100), 50, (720, 100))
     # Transaltors: Presented in direct (client to server) remote connection when the controlled computer is ready.
     speech.speakMessage(_("Connected to control server"))
     self.push_clipboard_item.Enable(True)
     write_connection_to_config(self.control_connector.address)
Esempio n. 33
0
 def script_controlDownarrow(self, gesture):
     speech.speakMessage(u"Sortie du tableau")
     focus = api.getFocusObject()
     focus = focus.treeInterceptor
     focus.script_movePastEndOfContainer(None)
     self.exitMode()
     self.execute("forceSortieTableau", params="ignore tableau")
Esempio n. 34
0
 def onEnter(self):
     type, name, text1 = self.sibi.tool_edit.getTextInfo()
     if text1 != "":
         type, name, text2 = self.sibi.tool_edit2.getTextInfo()
         speech.cancelSpeech()
         speech.speakMessage(text1 + " " + text2)
     return True
Esempio n. 35
0
 def _backspaceScriptHelper(self, unit, gesture):
     try:
         oldInfo = self.makeTextInfo(textInfos.POSITION_CARET)
     except:
         gesture.send()
         return
     oldBookmark = oldInfo.bookmark
     testInfo = oldInfo.copy()
     res = testInfo.move(textInfos.UNIT_CHARACTER, -1)
     if res < 0:
         testInfo.expand(unit)
         delChunk = testInfo.text
     else:
         delChunk = ""
     gesture.send()
     caretMoved, newInfo = self._hasCaretMoved(oldBookmark)
     if not caretMoved:
         return
     delChunk = delChunk.replace(
         "\r\n", "\n")  # Occurs with at least with Scintilla
     if len(delChunk) > 1:
         speech.speakMessage(delChunk)
     else:
         speech.speakSpelling(delChunk)
     self._caretScriptPostMovedHelper(None, gesture, newInfo)
    def script_tab(self, gesture):
        gesture.send()
        selectionObj = self.WinwordSelectionObject
        inTable = selectionObj.tables.count > 0 if selectionObj else False
        info = self.makeTextInfo(textInfos.POSITION_SELECTION)
        isCollapsed = info.isCollapsed
        if inTable and isCollapsed:
            info.expand(textInfos.UNIT_PARAGRAPH)
            isCollapsed = info.isCollapsed
        if not isCollapsed:
            self.doc = self.WinwordDocumentObject
            start = self.WinwordSelectionObject.Start

            r = self.doc.range(start, start)
            cell = ww_tables.Cell(self, r.Cells[0])
            table = ww_tables.Table(self, r.Tables[0])
            if table.isLastCellOfTable(cell):
                speech.speakMessage(_("Last cell"))
            elif table.isFirstCellOfTable(cell):
                speech.speakMessage(_("First cell"))
            speech.speakTextInfo(info, reason=controlTypes.REASON_FOCUS)
            braille.handler.handleCaretMove(self)
        if selectionObj and isCollapsed:
            offset = selectionObj.information(
                wdHorizontalPositionRelativeToPage)
            msg = self.getLocalizedMeasurementTextForPointSize(offset)
            ui.message(msg)
            if selectionObj.paragraphs[1].range.start == selectionObj.start:
                info.expand(textInfos.UNIT_LINE)
                speech.speakTextInfo(info,
                                     unit=textInfos.UNIT_LINE,
                                     reason=controlTypes.REASON_CARET)
    def getCollectionInRange(self, theRange):
        printDebug("Collection getCollectionInRange: %s" % theRange)
        collection = []
        for item in self._propertyName:
            (property, elementClass) = item
            col = getattr(theRange, property)
            try:
                col = getattr(theRange, property)
            except:
                # no collection for the range
                printDebug("No collection for the range")
                continue

            #try:
            if True:
                count = col.count
                startTime = time.time()
                for i in range(1, count + 1):
                    startTime = self.sayPercentage(i, count, startTime)
                    # stopped by user?
                    if self.parent and self.parent.canceled:
                        return []
                    collection.append((col[i], elementClass))
            #except:
            else:
                speech.speakMessage(
                    _("Sorry, There are too  many elements to be treated "))
                speech.speakMessage(_("Select smaller part of document"))
                time.sleep(3.0)
                return None

        return collection
Esempio n. 38
0
	def script_navigatorObject_current(self,gesture):
		curObject=api.getNavigatorObject()
		if not isinstance(curObject,NVDAObject):
			speech.speakMessage(_("no navigator object"))
			return
		if scriptHandler.getLastScriptRepeatCount()>=1:
			if curObject.TextInfo!=NVDAObjectTextInfo:
				textList=[]
				if curObject.name and isinstance(curObject.name, basestring) and not curObject.name.isspace():
					textList.append(curObject.name)
				try:
					info=curObject.makeTextInfo(textInfos.POSITION_SELECTION)
					if not info.isCollapsed:
						textList.append(info.text)
					else:
						info.expand(textInfos.UNIT_LINE)
						if not info.isCollapsed:
							textList.append(info.text)
				except (RuntimeError, NotImplementedError):
					# No caret or selection on this object.
					pass
			else:
				textList=[prop for prop in (curObject.name, curObject.value) if prop and isinstance(prop, basestring) and not prop.isspace()]
			text=" ".join(textList)
			if len(text)>0 and not text.isspace():
				if scriptHandler.getLastScriptRepeatCount()==1:
					speech.speakSpelling(text)
				else:
					if api.copyToClip(text):
						speech.speakMessage(_("%s copied to clipboard")%text)
		else:
			speech.speakObject(curObject,reason=speech.REASON_QUERY)
Esempio n. 39
0
 def script_toggleScreenLayout(self, gesture):
     config.conf["virtualBuffers"]["useScreenLayout"] = not config.conf["virtualBuffers"]["useScreenLayout"]
     if config.conf["virtualBuffers"]["useScreenLayout"]:
         # Translators: Presented when use screen layout option is toggled.
         speech.speakMessage(_("use screen layout on"))
     else:
         # Translators: Presented when use screen layout option is toggled.
         speech.speakMessage(_("use screen layout off"))
Esempio n. 40
0
File: ui.py Progetto: MarcoZehe/nvda
def message(text):
	"""Present a message to the user.
	The message will be presented in both speech and braille.
	@param text: The text of the message.
	@type text: str
	"""
	speech.speakMessage(text)
	braille.handler.message(text)
Esempio n. 41
0
	def on_connected_as_slave(self):
		log.info("Control connector connected")
		beep_sequence.beep_sequence_async((720, 100), 50, (720, 100), 50, (720, 100))
		# Translators: Presented in direct (client to server) remote connection when the controlled computer is ready.
		speech.speakMessage(_("Connected to control server"))
		self.push_clipboard_item.Enable(True)
		self.copy_link_item.Enable(True)
		configuration.write_connection_to_config(self.slave_transport.address)
Esempio n. 42
0
	def script_review_startOfLine(self,gesture):
		info=api.getReviewPosition().copy()
		info.expand(textInfos.UNIT_LINE)
		info.collapse()
		api.setReviewPosition(info.copy())
		info.expand(textInfos.UNIT_CHARACTER)
		speech.speakMessage(_("left"))
		speech.speakTextInfo(info,unit=textInfos.UNIT_CHARACTER,reason=speech.REASON_CARET)
Esempio n. 43
0
	def script_reportCurrentFocus(self,gesture):
		focusObject=api.getFocusObject()
		if isinstance(focusObject,NVDAObject):
			if scriptHandler.getLastScriptRepeatCount()==0:
				speech.speakObject(focusObject, reason=speech.REASON_QUERY)
			else:
				speech.speakSpelling(focusObject.name)
		else:
			speech.speakMessage(_("no focus"))
Esempio n. 44
0
	def script_navigatorObject_toFocus(self,gesture):
		obj=api.getFocusObject()
		try:
			pos=obj.makeTextInfo(textInfos.POSITION_CARET)
		except (NotImplementedError,RuntimeError):
			pos=obj.makeTextInfo(textInfos.POSITION_FIRST)
		api.setReviewPosition(pos)
		speech.speakMessage(_("move to focus"))
		speech.speakObject(obj,reason=speech.REASON_QUERY)
	def script_goToFirstOverflowingCharacter(self, gesture):
		info = self.makeTextInfo(textInfos.POSITION_CARET)
		info.expand(textInfos.UNIT_LINE)
		if len(info.text) > config.conf["notepadPp"]["maxLineLength"]:
			info.move(textInfos.UNIT_CHARACTER, config.conf["notepadPp"]["maxLineLength"], "start")
			info.updateCaret()
			info.collapse()
			info.expand(textInfos.UNIT_CHARACTER)
			speech.speakMessage(info.text)
Esempio n. 46
0
	def script_copyToClipboard(self,gesture):
		info=self.makeTextInfo(textInfos.POSITION_SELECTION)
		if info.isCollapsed:
			# Translators: Reported when there is no text selected (for copying).
			speech.speakMessage(_("no selection"))
			return
		if info.copyToClipboard():
			# Translators: Message presented when text has been copied to clipboard.
			speech.speakMessage(_("copied to clipboard"))
Esempio n. 47
0
File: ui.py Progetto: MarcoZehe/nvda
def reviewMessage(text):
	"""Present a message from review or object navigation to the user.
	The message will always be presented in speech, and also in braille if it is tethered to review or when auto tethering is on.
	@param text: The text of the message.
	@type text: str
	"""
	speech.speakMessage(text)
	if braille.handler.shouldAutoTether or braille.handler.getTether() == braille.handler.TETHER_REVIEW:
		braille.handler.message(text)
Esempio n. 48
0
	def reportFocus(self):
		if self.name:
			speakList=[]
			if controlTypes.STATE_SELECTED in self.states:
				speakList.append(controlTypes.speechStateLabels[controlTypes.STATE_SELECTED])
			speakList.append(self.name.split("\\")[-1])
			speech.speakMessage(" ".join(speakList))
		else:
			super(TCList,self).reportFocus()
	def script_reportFindResult(self, gesture):
		old = self.makeTextInfo(textInfos.POSITION_SELECTION)
		gesture.send()
		new = self.makeTextInfo(textInfos.POSITION_SELECTION)
		if new.bookmark.startOffset != old.bookmark.startOffset:
			new.expand(textInfos.UNIT_LINE)
			speech.speakMessage(new.text)
		else:
			#Translators: Message shown when there are no more search results in this direction using the notepad++ find command.
			speech.speakMessage(_("No more search results in this direction"))
Esempio n. 50
0
	def script_review_previousLine(self,gesture):
		info=api.getReviewPosition().copy()
		info.expand(textInfos.UNIT_LINE)
		info.collapse()
		res=info.move(textInfos.UNIT_LINE,-1)
		api.setReviewPosition(info.copy())
		info.expand(textInfos.UNIT_LINE)
		if res==0:
			speech.speakMessage(_("top"))
		speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason=speech.REASON_CARET)
Esempio n. 51
0
	def script_review_nextWord(self,gesture):
		info=api.getReviewPosition().copy()
		info.expand(textInfos.UNIT_WORD)
		info.collapse()
		res=info.move(textInfos.UNIT_WORD,1)
		api.setReviewPosition(info.copy())
		info.expand(textInfos.UNIT_WORD)
		if res==0:
			speech.speakMessage(_("bottom"))
		speech.speakTextInfo(info,reason=speech.REASON_CARET,unit=textInfos.UNIT_WORD)
Esempio n. 52
0
	def event_stateChange(self, obj, nextHandler):
		if obj.role == controlTypes.ROLE_DOCUMENT and controlTypes.STATE_BUSY in obj.states and winUser.isWindowVisible(obj.windowHandle) and obj.isInForeground:
			statusBar = api.getStatusBar()
			if statusBar:
				statusText = api.getStatusBarText(statusBar)
				speech.cancelSpeech()
				speech.speakMessage(controlTypes.speechStateLabels[controlTypes.STATE_BUSY])
				speech.speakMessage(statusText)
				return
		nextHandler()
Esempio n. 53
0
	def script_previousColumn(self,gesture):
		info=self.makeTextInfo("caret")
		if not info._rangeObj.Information(wdWithInTable):
 			speech.speakMessage(_("not in table"))
			return
		if info._moveInTable(-1,0):
			info.updateCaret()
			info.expand(textInfos.UNIT_CELL)
			speech.speakTextInfo(info,reason=speech.REASON_CARET)
		else:
			speech.speakMessage(_("edge of table"))
Esempio n. 54
0
 def script_shuffleToggle(self, gesture):
     gesture.send()
     if not isScriptWaiting():
         api.processPendingEvents()
         if getShuffle():
             # Translators: the user has pressed the shuffle tracks toggle in winamp, shuffle is now on.
             onOff = pgettext("shuffle", "on")
         else:
             # Translators: the user has pressed the shuffle tracks toggle in winamp, shuffle is now off.
             onOff = pgettext("shuffle", "off")
         speech.speakMessage(onOff)
Esempio n. 55
0
 def script_repeatToggle(self, gesture):
     gesture.send()
     if not isScriptWaiting():
         api.processPendingEvents()
         if getRepeat():
             # Translators: the user has pressed the repeat track toggle in winamp, repeat is now on.
             onOff = pgettext("repeat", "on")
         else:
             # Translators: the user has pressed the repeat track toggle in winamp, repeat is now off.
             onOff = pgettext("repeat", "off")
         speech.speakMessage(onOff)
Esempio n. 56
0
	def script_navigatorObject_moveToObjectAtFlatReviewPosition(self,gesture):
		pos=api.getReviewPosition()
		try:
			obj=pos.NVDAObjectAtStart
		except NotImplementedError:
			obj=None
		if obj and obj!=pos.obj:
			api.setNavigatorObject(obj)
			speech.speakObject(obj)
		else:
			speech.speakMessage(_("No object at flat review position"))
Esempio n. 57
0
	def event_typedCharacter(self,ch) :
		if(self.checkMissChar()) :
			super(CharsExEdit,self).event_typedCharacter(ch)
			nextCh = self.parent.parent.getNextChar()
			speech.speakMessage(u'Errore  Hai scritto '+ch+'   scrivi '+self.appModule.expandAccent(nextCh))
			braille.handler.message(u'Errore  Hai scritto '+ch+'   scrivi '+ nextCh)
		else :
			super(CharsExEdit,self).event_typedCharacter(ch)
			nextCh = self.parent.parent.getNextChar()
			speech.speakMessage(self.appModule.expandAccent(nextCh))
			braille.handler.message("prossima lettera "+nextCh)
Esempio n. 58
0
	def script_navigatorObject_firstChild(self,gesture):
		curObject=api.getNavigatorObject()
		if not isinstance(curObject,NVDAObject):
			speech.speakMessage(_("no navigator object"))
			return
		simpleReviewMode=config.conf["reviewCursor"]["simpleReviewMode"]
		curObject=curObject.simpleFirstChild if simpleReviewMode else curObject.firstChild
		if curObject is not None:
			api.setNavigatorObject(curObject)
			speech.speakObject(curObject,reason=speech.REASON_QUERY)
		else:
			speech.speakMessage(_("No children"))
Esempio n. 59
0
def pumpAll():
	global mouseMoved, curMousePos, mouseShapeChanged, curMouseShape
	if mouseMoved:
		mouseMoved=False
		(x,y)=curMousePos
		executeMouseMoveEvent(x,y)
	if config.conf["mouse"]["reportMouseShapeChanges"] and mouseShapeChanged>0:
		if mouseShapeChanged==10:
			mouseShapeChanged=0
			speech.speakMessage(_("%s cursor")%curMouseShape)
		else:
			mouseShapeChanged+=1
Esempio n. 60
0
	def event_gainFocus(self) :
		#Incremento al massimo il livello di punteggiatura
		if (self.origLevel == None) :
			self.origLevel = config.conf["speech"]["symbolLevel"]
			config.conf["speech"]["symbolLevel"] = 300
		if (self.appModule.firstTimeSentence) : 
			self.appModule.firstTimeSentence = False
			self.displaySentence()
		else :
			#Ripeto la prossima lettera
			speech.speakMessage("prossima lettera "+self.parent.parent.getNextChar(self.value))
			super(SentExEdit,self).event_gainFocus()