Ejemplo n.º 1
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['screenData']['newContentText'])
        else:
            x, y, marked = \
              line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screenData']['newContentText'])
        if marked.isspace():
            self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True)
        else:
            self.env['runtime']['outputManager'].presentText(marked, interrupt=True)
Ejemplo n.º 2
0
    def run(self):
        if not self.env['runtime']['settingsManager'].getSettingAsBool(
                'focus', 'cursor'):
            return
        if self.env['runtime']['inputManager'].noKeyPressed():
            return
        if self.env['runtime']['screenManager'].isScreenChange():
            return
        # this leads to problems in vim -> status line change -> no announcement
        #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['screenData']['newCursor']['x'],
            self.env['screenData']['newCursor']['y'],
            self.env['screenData']['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)
Ejemplo n.º 3
0
    def run(self):
        x, y, firstLine = \
          line_utils.getCurrentLine(0, 0, self.env['screenData']['newContentText'])

        if firstLine.isspace():
            self.env['runtime']['outputManager'].presentText(
                _("blank"), soundIcon='EmptyLine', interrupt=True)
        else:
            self.env['runtime']['outputManager'].presentText(firstLine,
                                                             interrupt=True)
Ejemplo n.º 4
0
    def run(self):
        self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()

        self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currLine = \
          line_utils.getCurrentLine(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['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['screenData']['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()
Ejemplo n.º 6
0
    def run(self):
        # Prefer review cursor over text cursor

        if self.env['screenData']['newCursorReview']:
            cursorPos = self.env['screenData']['newCursorReview'].copy()
        else:
            cursorPos = self.env['screenData']['newCursor'].copy()
        x, y, currLine = \
          line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screenData']['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)
Ejemplo n.º 7
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['screenData']['newContentText'])
             displayText = self.getBrailleTextWithOffset(
                 self.env['screenData']['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)