Example #1
0
 def brailleText(self, text='', flush=True):
     if not self.env['runtime']['settingsManager'].getSettingAsBool('braille', 'enabled'):
         return
     if self.env['runtime']['brailleDriver'] == None:
         return        
     if flush:
         self.env['output']['nextFlush'] = time.time() + self.getFlushTime(text)
         self.env['output']['messageOffset'] = {'x':0,'y':0}            
         self.env['output']['messageText'] = text
         displayText = self.getBrailleTextWithOffset(self.env['output']['messageText'], self.env['output']['messageOffset'])    
         self.env['runtime']['brailleDriver'].writeText('flush '+ displayText)         
     else:
         if self.env['output']['nextFlush'] < time.time():
             if self.env['output']['messageText'] != '':
                 self.env['output']['messageText'] = ''
             if self.env['output']['messageOffset'] != None:
                 self.env['output']['messageOffset'] = None
             cursor = self.getBrailleCursor()
             x, y, self.env['output']['brlText'] = \
               line_utils.getCurrentLine(cursor['x'], cursor['y'], self.env['screen']['newContentText'])                
             displayText = self.getBrailleTextWithOffset(self.env['screen']['newContentText'], self.env['output']['cursorOffset'], cursor)    
             self.env['runtime']['brailleDriver'].writeText('notflush ' + displayText)                  
         else:
             displayText = self.getBrailleTextWithOffset(self.env['output']['messageText'], self.env['output']['messageOffset'])    
             self.env['runtime']['brailleDriver'].writeText('flush'+displayText)                          
Example #2
0
    def run(self):
        currApp = self.env['runtime']['applicationManager'].getCurrentApplication()
        if not self.env['commandBuffer']['bookMarks'][self.ID]:
            self.env['runtime']['outputManager'].presentText(_('Bookmark {0} not set').format(self.ID,), interrupt=True)
            return
        if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]:
            self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True)
            return
        if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']:
            self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True)
            return

        # set marks
        marked = ''
        startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy()
        if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']:
            endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy()
            marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screen']['newContentText'])
        else:
            x, y, marked = \
              line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screen']['newContentText'])
        if marked.isspace():
            self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True)
        else:
            self.env['runtime']['outputManager'].presentText(marked, interrupt=True)
Example #3
0
    def run(self):
        currApp = self.env['runtime']['applicationManager'].getCurrentApplication()
        if not self.env['commandBuffer']['bookMarks'][self.ID]:
            self.env['runtime']['outputManager'].presentText(_('Bookmark {0} not set').format(self.ID,), interrupt=True)
            return
        if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]:
            self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True)
            return
        if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']:
            self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True)
            return

        # set marks
        marked = ''
        startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy()
        if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']:
            endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy()
            marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screen']['newContentText'])
        else:
            x, y, marked = \
              line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screen']['newContentText'])
        if marked.isspace():
            self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True)
        else:
            self.env['runtime']['outputManager'].presentText(marked, interrupt=True)
Example #4
0
 def run(self):
     x, y, firstLine = \
       line_utils.getCurrentLine(0, 0, self.env['screen']['newContentText'])
     
     if firstLine.isspace():
         self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)
     else:
         self.env['runtime']['outputManager'].presentText(firstLine, interrupt=True) 
Example #5
0
    def run(self):
        x, y, lastLine = \
          line_utils.getCurrentLine(0, self.env['screen']['lines'] -1, self.env['screen']['newContentText'])

        if lastLine.isspace():
            self.env['runtime']['outputManager'].presentText(
                _("blank"), soundIcon='EmptyLine', interrupt=True)
        else:
            self.env['runtime']['outputManager'].presentText(lastLine,
                                                             interrupt=True)
Example #6
0
    def run(self):
        self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()

        self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currLine = \
          line_utils.getCurrentLine(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
        
        if currLine.isspace():
            self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False)
        else:
            self.env['runtime']['outputManager'].presentText(currLine, interrupt=True, flush=False) 
    def run(self):
        cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()

        x, y, currLine = \
          line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screen']['newContentText'])
        
        if currLine.isspace():
            self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)
        else:
            self.env['runtime']['outputManager'].presentText(currLine[cursorPos['x']], interrupt=True) 
        self.env['runtime']['outputManager'].announceActiveCursor()            
Example #8
0
    def run(self):
        self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()

        self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currLine = \
          line_utils.getCurrentLine(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])

        if currLine.isspace():
            self.env['runtime']['outputManager'].presentText(
                _("blank"), soundIcon='EmptyLine', interrupt=True, flush=False)
        else:
            self.env['runtime']['outputManager'].presentText(currLine,
                                                             interrupt=True,
                                                             flush=False)
Example #9
0
    def run(self):
        # Prefer review cursor over text cursor

        if self.env['screen']['newCursorReview']:
            cursorPos = self.env['screen']['newCursorReview'].copy()
        else:
            cursorPos = self.env['screen']['newCursor'].copy()
        x, y, currLine = \
          line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screen']['newContentText'])
        
        if currLine.isspace():
            self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)
        else:        
            self.env['runtime']['outputManager'].presentText(_("indent {0}").format(len(currLine) - len(currLine.lstrip())), interrupt=True)
    def run(self):
        cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor(
        )

        x, y, currLine = \
          line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screen']['newContentText'])

        if currLine.isspace():
            self.env['runtime']['outputManager'].presentText(
                _("blank"), soundIcon='EmptyLine', interrupt=True)
        else:
            self.env['runtime']['outputManager'].presentText(
                currLine[cursorPos['x']], interrupt=True)
        self.env['runtime']['outputManager'].announceActiveCursor()
Example #11
0
 def brailleText(self, text='', flush=True):
     if not self.env['runtime']['settingsManager'].getSettingAsBool(
             'braille', 'enabled'):
         return
     if self.env['runtime']['brailleDriver'] == None:
         return
     if flush:
         self.env['output']['nextFlush'] = time.time() + self.getFlushTime(
             text)
         self.env['output']['messageOffset'] = {'x': 0, 'y': 0}
         self.env['output']['messageText'] = text
         displayText = self.getBrailleTextWithOffset(
             self.env['output']['messageText'],
             self.env['output']['messageOffset'])
         self.env['runtime']['brailleDriver'].writeText('flush ' +
                                                        displayText)
     else:
         if self.env['output']['nextFlush'] < time.time():
             if self.env['output']['messageText'] != '':
                 self.env['output']['messageText'] = ''
             if self.env['output']['messageOffset'] != None:
                 self.env['output']['messageOffset'] = None
             cursor = self.getBrailleCursor()
             x, y, self.env['output']['brlText'] = \
               line_utils.getCurrentLine(cursor['x'], cursor['y'], self.env['screen']['newContentText'])
             displayText = self.getBrailleTextWithOffset(
                 self.env['screen']['newContentText'],
                 self.env['output']['cursorOffset'], cursor)
             self.env['runtime']['brailleDriver'].writeText('notflush ' +
                                                            displayText)
         else:
             displayText = self.getBrailleTextWithOffset(
                 self.env['output']['messageText'],
                 self.env['output']['messageOffset'])
             self.env['runtime']['brailleDriver'].writeText('flush' +
                                                            displayText)
 def run(self):
     if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'cursor'):
         return      
     if self.env['runtime']['screenManager'].isScreenChange():
         self.lastIdent = 0        
         return        
     # this leads to problems in vim -> status line change -> no announcement, so we do check the lengh as hack
     if self.env['runtime']['screenManager'].isDelta():
         return
         
     # is a vertical change?
     if not self.env['runtime']['cursorManager'].isCursorVerticalMove():
         return   
    
     x, y, currLine = line_utils.getCurrentLine(self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['newContentText'])
     if currLine.isspace():
         self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False)
     else:
         # ident
         currIdent = len(currLine) - len(currLine.lstrip())
         if self.lastIdent == -1:
             self.lastIdent = currIdent
         doInterrupt = True                
         if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoPresentIndent'):
             if self.lastIdent != currIdent: 
                 self.env['runtime']['outputManager'].presentText(_('indented ') + str(currIdent) + ' ', interrupt=doInterrupt, flush=False)
                 doInterrupt = False    
         # barrier
         sayLine = currLine        
         if self.env['runtime']['settingsManager'].getSettingAsBool('barrier','enabled'):
             isBarrier, barrierLine = self.env['runtime']['barrierManager'].handleLineBarrier(self.env['screen']['newContentText'].split('\n'), self.env['screen']['newCursor']['x'],self.env['screen']['newCursor']['y'])
             if isBarrier:
                 sayLine = barrierLine
         # output
         self.env['runtime']['outputManager'].presentText(sayLine, interrupt=doInterrupt, flush=False)
         self.lastIdent = currIdent
    def run(self):
        cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor(
        )
        x, y, currLine = \
          line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screen']['newContentText'])
        if currLine.isspace():
            self.env['runtime']['outputManager'].presentText(
                _("line is empty"), interrupt=True)
            return
        self.env['runtime']['cursorManager'].setReviewCursorPosition(
            (len(currLine) - len(currLine.lstrip())), cursorPos['y'])
        self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currChar = \
          char_utils.getCurrentChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])

        self.env['runtime']['outputManager'].presentText(
            currChar,
            interrupt=True,
            ignorePunctuation=True,
            announceCapital=True,
            flush=False)
        self.env['runtime']['outputManager'].presentText(
            _("first character in line indent {0}").format(
                str(len(currLine) - len(currLine.lstrip()))),
            interrupt=False)