slowed the text output

This commit is contained in:
Josh d'Entremont 2015-05-26 22:28:59 -03:00
parent 766ba8f7bc
commit 83d7c31c6e
3 changed files with 18 additions and 12 deletions

View file

@ -1,6 +1,6 @@
import curses
LETTER_PAUSE = 20
LETTER_PAUSE = 5
def slowWrite(window, text, pause = LETTER_PAUSE):
"""

View file

@ -24,11 +24,11 @@ def runLocked(scr):
height = size[0]
# set screen to initial position
scr.erase()
scr.move(height / 2 - 1, width / 2 - len(LOCKED_1) / 2)
scr.addstr(LOCKED_1)
scr.move(height / 2 + 1, width / 2 - len(LOCKED_2) / 2)
scr.addstr(LOCKED_2)
curses.curs_set(0)
scr.move(height / 2 - 1, width / 2 - len(LOCKED_1) / 2)
slowWrite(scr, LOCKED_1)
scr.move(height / 2 + 1, width / 2 - len(LOCKED_2) / 2)
slowWrite(scr, LOCKED_2)
scr.refresh()
curses.napms(LOCKED_OUT_TIME)

View file

@ -20,6 +20,8 @@ SQUARE_Y = 3
LOGIN_ATTEMPTS = 4
HEADER_LINES = 5
# amount of time to pause after correct password input
LOGIN_PAUSE = 3000
@ -106,7 +108,7 @@ def initScreen(scr):
size = scr.getmaxyx()
height = size[0]
width = size[1]
fillerHeight = height - 5 # - 5 for header lines
fillerHeight = height - HEADER_LINES
hexes = generateHex(fillerHeight * 2)
@ -124,20 +126,24 @@ def initScreen(scr):
fillerWidth = width / 4
# print the header stuff
scr.addstr(HEADER_TEXT)
scr.addstr('\nENTER PASSWORD NOW\n\n')
scr.addstr(str(LOGIN_ATTEMPTS) + ' ATTEMPT(S) LEFT: ')
slowWrite(scr, HEADER_TEXT)
slowWrite(scr, '\nENTER PASSWORD NOW\n\n')
slowWrite(scr, str(LOGIN_ATTEMPTS) + ' ATTEMPT(S) LEFT: ')
for i in xrange(LOGIN_ATTEMPTS):
scr.addch(curses.ACS_BLOCK)
scr.addstr(' ')
scr.addstr('\n\n')
slowWrite(scr, ' ')
slowWrite(scr, '\n\n')
# print the hex and filler
for i in xrange(fillerHeight):
scr.addstr("0x%X %s 0x%X %s" % (hexCol1[i], fillerCol1[i * fillerWidth: (i + 1) * fillerWidth], hexCol2[i], fillerCol2[i * fillerWidth: (i + 1) * fillerWidth]))
slowWrite(scr, "0x%X %s" % (hexCol1[i], fillerCol1[i * fillerWidth: (i + 1) * fillerWidth]), 1)
if i < fillerHeight - 1:
scr.addstr('\n')
for i in xrange(fillerHeight):
scr.move(HEADER_LINES + i, CONST_CHARS / 2 + fillerWidth)
slowWrite(scr, '0x%X %s' % (hexCol2[i], fillerCol2[i * fillerWidth: (i + 1) * fillerWidth]), 1)
scr.refresh()
return passwords