fallout-term/fallout_locked.py

43 lines
1,008 B
Python
Raw Normal View History

2015-05-27 01:11:31 +00:00
import curses
from fallout_functions import slowWrite
2015-06-14 22:31:01 +00:00
from fallout_functions import centeredWrite
2015-05-27 01:11:31 +00:00
################## text strings ######################
2024-04-28 15:02:47 +00:00
LOCKED_1 = "TERMINAL LOCKED"
LOCKED_2 = "PLEASE CONTACT AN ADMINISTRATOR"
2015-05-27 01:11:31 +00:00
################## global 'constants' ################
# amount of time to pause after lockout
LOCKED_OUT_TIME = 5000
################## functions #########################
2024-04-28 15:02:47 +00:00
2015-05-27 01:11:31 +00:00
def runLocked(scr):
"""
Start the locked out portion of the terminal
"""
curses.use_default_colors()
size = scr.getmaxyx()
width = size[1]
height = size[0]
# set screen to initial position
scr.erase()
2015-05-27 01:28:59 +00:00
curses.curs_set(0)
2021-05-19 18:42:44 +00:00
scr.move(int(height / 2 - 1), 0)
2024-04-28 15:02:47 +00:00
centeredWrite(scr, LOCKED_1, silent=True)
2021-05-19 18:42:44 +00:00
scr.move(int(height / 2 + 1), 0)
2024-04-28 15:02:47 +00:00
centeredWrite(scr, LOCKED_2, silent=True)
2015-05-27 01:11:31 +00:00
scr.refresh()
curses.napms(LOCKED_OUT_TIME)
2024-04-27 22:13:30 +00:00
2015-05-27 01:11:31 +00:00
def beginLocked():
"""
Initialize curses and start the locked out process
"""
curses.wrapper(runLocked)