Esempio n. 1
0
    def doScroll(self, linesToScroll):
        scrollUp = linesToScroll > 0
        linesToScroll = abs(linesToScroll)
        up_key = keyboard.translate('up')
        down_key = keyboard.translate('down')

        for i in range(linesToScroll):
            # Note: If we use archyState.mainTextViewer.scrollUp()/scrollDown() then Bad Things occur when UNDO commands are issued during a tutorial script. This is because the lines referred to in the command objects are not respected when they are changed via mainTextViewer.scrollUp method? Todo: Figure out why Bad Things happen (in particular in line 559 in text_viewer.py in renderLines: linePos = self.lineYPositions[line] we get
            # KeyError: <line.Line instance at 0x011B40F8>
            if scrollUp:
                archyState.keyState.keypress(up_key, '', 'down')
                archyState.keyState.keypress(up_key, '', 'up')
            else:
                archyState.keyState.keypress(down_key, '', 'down')
                archyState.keyState.keypress(down_key, '', 'up')
Esempio n. 2
0
    def doScroll(self, linesToScroll):
        scrollUp = linesToScroll > 0
        linesToScroll = abs(linesToScroll)
        up_key = keyboard.translate('up')
        down_key = keyboard.translate('down')

        for i in range(linesToScroll):
# Note: If we use archyState.mainTextViewer.scrollUp()/scrollDown() then Bad Things occur when UNDO commands are issued during a tutorial script. This is because the lines referred to in the command objects are not respected when they are changed via mainTextViewer.scrollUp method? Todo: Figure out why Bad Things happen (in particular in line 559 in text_viewer.py in renderLines: linePos = self.lineYPositions[line] we get
# KeyError: <line.Line instance at 0x011B40F8>
            if scrollUp:
                archyState.keyState.keypress(up_key, '', 'down')
                archyState.keyState.keypress(up_key, '', 'up')
            else:
                archyState.keyState.keypress(down_key, '', 'down')
                archyState.keyState.keypress(down_key, '', 'up')
Esempio n. 3
0
    def setupMovie(self):
        movie = Movie()
        press_len = self.DEFAULT_PRESS_LENGTH

        for line in self.script:
            if line == '': continue
            time, info, evttype = line.split('\t')
            time = float(time)

            if evttype in ['press', 'down', 'up', 'show', 'unshow']:
                key = keyboard.translate(info)
                movie.key(key, evttype, time)
                if evttype == 'press':
                    movie.key(key, '_unpress', time + press_len)

            elif evttype in ['command', 'meta']:
                if info == 'undo':
                    movie.function(commands.UndoCommand().execute, time)
                if info == 'end':
                    movie.end(time)

            elif info in ['kb']:
                pos = evttype
                movie.movekeyboard(pos, time)

            elif info in ['scroll']:
                linesToScroll = int(evttype)
                movie.scroll(linesToScroll, time)

            elif info in ['press len']:
                press_len = float(evttype)

        movie.onDone(self.cleanupExample)
        return movie
Esempio n. 4
0
    def setupMovie(self):
        movie = Movie()
        press_len = self.DEFAULT_PRESS_LENGTH
        
        for line in self.script:
            if line == '': continue
            time, info, evttype = line.split('\t')
            time = float(time)

            if   evttype in ['press', 'down', 'up', 'show', 'unshow']:
                key = keyboard.translate(info)
                movie.key(key, evttype, time)
                if evttype == 'press': 
                    movie.key(key, '_unpress', time + press_len)

            elif evttype in ['command', 'meta']:
                if info == 'undo':
                    movie.function(commands.UndoCommand().execute, time)
                if info == 'end':
                    movie.end(time)

            elif info in ['kb']:
                pos = evttype
                movie.movekeyboard(pos, time)

            elif info in ['scroll']:
                linesToScroll = int(evttype)
                movie.scroll(linesToScroll, time)

            elif info in ['press len']:
                press_len = float(evttype)

        movie.onDone(self.cleanupExample)
        return movie