From 83d7c31c6e74d36cecfc8698ee6bfbbe37fd2f6a Mon Sep 17 00:00:00 2001 From: Josh d'Entremont Date: Tue, 26 May 2015 22:28:59 -0300 Subject: [PATCH] slowed the text output --- fallout_functions.py | 2 +- fallout_locked.py | 8 ++++---- fallout_login.py | 20 +++++++++++++------- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/fallout_functions.py b/fallout_functions.py index 4b5550d..0090a6f 100644 --- a/fallout_functions.py +++ b/fallout_functions.py @@ -1,6 +1,6 @@ import curses -LETTER_PAUSE = 20 +LETTER_PAUSE = 5 def slowWrite(window, text, pause = LETTER_PAUSE): """ diff --git a/fallout_locked.py b/fallout_locked.py index 100e6fa..111f1eb 100644 --- a/fallout_locked.py +++ b/fallout_locked.py @@ -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) diff --git a/fallout_login.py b/fallout_login.py index 4d6c00d..0ce7a43 100644 --- a/fallout_login.py +++ b/fallout_login.py @@ -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