示例#1
0
def updateAnnouncementBoard(foo, bar):
    logger.warn("updateAnnouncementBoard called")
    try:
#        sock = board.get_connection()
        board.clear_panel(sock, 3)
        board.write_to_board(sock, 3, 0, 0, " - - - - - - - - - - - - - - - - Announcements - - - - - - - - - - - - - - - -  ")
        curRowNum = 1
        announcements = list(Announcement.objects.order_by('-creation_date'))
        for announcement in announcements:
            color = chr(29)
            if announcement.priority == 'M':
                color = chr(31)
            elif announcement.priority == 'H':
                color = chr(30)

            row = " " + announcement.announcement_text

            while len(row) < 66:
                # add some padding spaces
                row = row + " "
            row = row + " " + announcement.creation_date.strftime("%a %I:%M%p")
            while len(row) < 81:
                row = row + " "
            board.write_to_board(sock, 3, curRowNum, 0, str(color + row))
            curRowNum += 1
    except:
        print "Unexpected error:", sys.exc_info()[0]
    finally:
        board.close_connection(sock)

    return 0
示例#2
0
def test_chars(request):
    sock = None
    try:
        #        sock = board.get_connection()
        board.clear_panel(sock, 0)

        curRow = 0
        curCol = 0

        for i in range(152):
            thisStr = str(i) + ": " + str(chr(i)) + " "

            board.write_to_board(sock, 0, curRow, curCol, thisStr)
            curRow = curRow + 1

            if curRow == 12:
                curRow = 0
                curCol = curCol + 7
    except:
        return HttpResponse(content="Unexpected error: " +
                            str(sys.exc_info()[0]))
    finally:
        board.close_connection(sock)

    return HttpResponse(content="Test Chars Completed")
示例#3
0
def rawRegionInterface(request, row, rowlimit, col, collimit, msg):

    row = int(row)
    rowlimit = int(rowlimit)
    col = int(col)
    collimit = int(collimit)

    responseMsg = "Running..."

    sock = None
    try:

#        sock = board.get_connection()


        board.clear_panel(sock, 1)

        board.write_region_wrap(sock, 0, row, col, msg, rowlimit, collimit)
        responseMsg = "Wrote " + msg

        board.close_connection(sock)


    except:
        responseMsg = "Err"
    finally:
        board.close_connection(sock)

    return HttpResponse(content=responseMsg)
示例#4
0
def updateAnnouncementBoard(foo, bar):
    logger.warn("updateAnnouncementBoard called")
    try:
        #        sock = board.get_connection()
        board.clear_panel(sock, 3)
        board.write_to_board(
            sock, 3, 0, 0,
            " - - - - - - - - - - - - - - - - Announcements - - - - - - - - - - - - - - - -  "
        )
        curRowNum = 1
        announcements = list(Announcement.objects.order_by('-creation_date'))
        for announcement in announcements:
            color = chr(29)
            if announcement.priority == 'M':
                color = chr(31)
            elif announcement.priority == 'H':
                color = chr(30)

            row = " " + announcement.announcement_text

            while len(row) < 66:
                # add some padding spaces
                row = row + " "
            row = row + " " + announcement.creation_date.strftime("%a %I:%M%p")
            while len(row) < 81:
                row = row + " "
            board.write_to_board(sock, 3, curRowNum, 0, str(color + row))
            curRowNum += 1
    except:
        print "Unexpected error:", sys.exc_info()[0]
    finally:
        board.close_connection(sock)

    return 0
示例#5
0
def rawRegionInterface(request, row, rowlimit, col, collimit, msg):

    row = int(row)
    rowlimit = int(rowlimit)
    col = int(col)
    collimit = int(collimit)

    responseMsg = "Running..."

    sock = None
    try:

        #        sock = board.get_connection()

        board.clear_panel(sock, 1)

        board.write_region_wrap(sock, 0, row, col, msg, rowlimit, collimit)
        responseMsg = "Wrote " + msg

        board.close_connection(sock)

    except:
        responseMsg = "Err"
    finally:
        board.close_connection(sock)

    return HttpResponse(content=responseMsg)
示例#6
0
def clear_board(row, **kwargs):
    try:
        sock = board.get_connection()
        board.clear_panel(sock, 0)
        board.clear_panel(sock, 1)
        board.close_connection(sock)
    except:
        board.close_connection(sock)
        return False
    return True
示例#7
0
def char_test(request):
    sock = None
    try:
#        sock = board.get_connection()
        board.clear_panel(sock, 0)
        i = 0
        while i < 128:
            row = i / 12
            col = (i % 40) + 3
            board.write_to_board(sock, 0, row, col, str(chr(i)))
            i += 1
    except:
        print "Unexpected error:", sys.exc_info()[0]
    finally:
        board.close_connection(sock)

    return HttpResponse(content="Info Board Updated")
示例#8
0
def char_test(request):
    sock = None
    try:
        #        sock = board.get_connection()
        board.clear_panel(sock, 0)
        i = 0
        while i < 128:
            row = i / 12
            col = (i % 40) + 3
            board.write_to_board(sock, 0, row, col, str(chr(i)))
            i += 1
    except:
        print "Unexpected error:", sys.exc_info()[0]
    finally:
        board.close_connection(sock)

    return HttpResponse(content="Info Board Updated")
示例#9
0
def info_panel(request):
    try:
        sock = board.get_connection()
#        tb = twitter_board.TwitterBoard()
        board.clear_panel(sock, 4)
        board.write_to_board(sock, 4, 0, 1, strftime("%a, %d %B %I:%M%p", localtime(time())))
        curRowNum = 1

        for row in weather.Weather().getCurrentWeather():
            print row
            board.write_to_board(sock, 4, curRowNum, 3, str(row))
            curRowNum += 1
    except:
        print "Unexpected error:", sys.exc_info()[0]
    finally:
        board.close_connection(sock)

    return HttpResponse(content="Info Board Updated")
示例#10
0
def info_panel(request):
    try:
        sock = board.get_connection()
#        tb = twitter_board.TwitterBoard()
        board.clear_panel(sock, 4)
        board.write_to_board(sock, 4, 0, 1, strftime("%a, %d %B %I:%M%p", localtime(time())))
        curRowNum = 1

        for row in weather.Weather().getCurrentWeather():
            print row
            board.write_to_board(sock, 4, curRowNum, 3, str(row))
            curRowNum += 1
    except:
        print "Unexpected error:", sys.exc_info()[0]
    finally:
        board.close_connection(sock)

    return HttpResponse(content="Info Board Updated")
示例#11
0
def updateTwitterBoard(foo, bar):
    logger.warning("updateTwitterBoard called")
    twitterRows = twitter.Twitter().getNewTweets(11, 79)

    if len(twitterRows) > 0:
        try:
            sock = board.get_connection()
            board.clear_panel(sock, 2)
            board.write_to_board(sock, 2, 0, 0, "*************** Tweets ********************************************************")
            curRowNum = 1
            for row in twitterRows:
                board.write_to_board(sock, 2, curRowNum, 0, str(row + ' '))
                curRowNum += 1
        except:
            print "Unexpected error:", sys.exc_info()[0]
        finally:
            board.close_connection(sock)

    return 0
示例#12
0
def updateInfoBoard(foo, bar):
    logger.warn("updateInfoBoard called");
    weatherRows = weather.Weather().getCurrentWeather()
    try:
        sock = board.get_connection()
        board.clear_panel(sock, 4)
        board.write_to_board(sock, 4, 0, 1, strftime("%a, %d %B %I:%M%p", localtime(time())))
        curRowNum = 1

        for row in weatherRows:
            print row
            board.write_to_board(sock, 4, curRowNum, 3, str(row))
            curRowNum += 1
    except:
        print "Unexpected error:", sys.exc_info()[0]
    finally:
        board.close_connection(sock)

    return 0
示例#13
0
def updateInfoBoard(foo, bar):
    logger.warn("updateInfoBoard called");
    weatherRows = weather.Weather().getCurrentWeather()
    try:
        sock = board.get_connection()
        board.clear_panel(sock, 4)
        board.write_to_board(sock, 4, 0, 1, strftime("%a, %d %B %I:%M%p", localtime(time())))
        curRowNum = 1

        for row in weatherRows:
            print row
            board.write_to_board(sock, 4, curRowNum, 3, str(row))
            curRowNum += 1
    except:
        print "Unexpected error:", sys.exc_info()[0]
    finally:
        board.close_connection(sock)

    return 0
示例#14
0
def test_chars(request):
    sock = None
    try:
#        sock = board.get_connection()
        board.clear_panel(sock, 0)

        curRow = 0
        curCol = 0

        for i in range(152):
            thisStr = str(i) + ": " + str(chr(i)) + " "

            board.write_to_board(sock, 0, curRow, curCol, thisStr)
            curRow = curRow + 1

            if curRow == 12:
                curRow = 0
                curCol = curCol + 7
    except:
        return HttpResponse(content="Unexpected error: " + str(sys.exc_info()[0]))
    finally:
        board.close_connection(sock)

    return HttpResponse(content="Test Chars Completed")