Beispiel #1
0
def whitelist(text):
    cleaned = ''
    for c in text:
        #prevent XSS just in case <> is added to LED characters. DO NOT REMOVE.
        if c in LEDCharacters.allowedChars() and c != '>' and c != '<':
            cleaned += c
    return cleaned
Beispiel #2
0
    def next(self):
        if self.index == len(self.str):
            return None

        #shift columns to the left
        i, j = 0, 0
        for i in range(self.WIDTH - 1):
            for j in range(self.HEIGHT):
                self.matrix[i][j] = self.matrix[i + 1][j]

        #get the new right-most column
        currentChar = LEDCharacters.getCharacter(self.str[self.index], self.WIDTH, self.HEIGHT)     
        #extract the new column at the specified index
        if self.charIndex == len(currentChar[0]):
            newColumn = [0]*self.HEIGHT; #spacer
        else:
            newColumn = [currentChar[i][self.charIndex] for i in range(self.HEIGHT)]
        self.charIndex += 1
        for i in range(self.HEIGHT):
            self.matrix[self.WIDTH-1][i] = newColumn[i]

        #if we've passed the width of the character, move to the next letter
        if self.charIndex > len(currentChar[0]):
            self.index += 1
            self.charIndex = 0

        return self.index
Beispiel #3
0
def whitelist(text):
    cleaned = ''
    for c in text:
        #prevent XSS just in case <> is added to LED characters. DO NOT REMOVE.
        if c in LEDCharacters.allowedChars() and c != '>' and c != '<':
            cleaned += c
    return cleaned
Beispiel #4
0
def test():
    allowedChars = LEDCharacters.allowedChars()
    test = MatrixScroller(allowedChars, 6, 6)
    for i in range(len(allowedChars)*10):
        test.next()
    print 'all tests OK'
    test = MatrixScroller('A', 6, 6)
    msr = MatrixScrollRepeater(2, test)
    for i in range(20):
        msr.next()
        print msr.getMatrix()

    test = MatrixScroller('....', 6, 6)
    test.next()
    test.next()
    test.next()
    test.next()
    test.next()
    print test #.getArduinoMatrix()
    print test.getArduinoList()