示例#1
0
def dialogue(prompt, hidden = False):
	
	"""
	Clears the screen, displays a prompt, 
	"""
	
	credential = ""
	screen.erase()
#	Add the prompt such that it appears center-justified
	screen.addstr(int(height(screen) / 2), 0, stralign.alignC(prompt, width(screen)))
	screen.refresh()
	
	char = screen.getch()
	
	while not (char == 10):
		if (char == 27):
			curses.endwin()
			sys.exit()
		elif (char == 127):
			if not (credential == ""):
				credential = credential[:-1]
		else:
			credential += chr(char)

#		Add the input such that it appears center-justified underneath the prompt
		screen.addstr(int(height(screen) / 2) + 1, 0, stralign.alignC(hide(credential, hidden), width(screen)))
		screen.refresh()
		
		char = screen.getch()
		
	screen.erase()
	return credential
示例#2
0
def drawHeaders():
	
	"""
	Draws the three headers that title the contents of the windows underneath
	them.
	"""
	
	style = ATTR_PLAIN | curses.A_REVERSE
	roomHeader.addstr(0, 0, stralign.alignC(RHEAD, RCW), style)
	chatHeader.addstr(0, 0, stralign.alignC(CHEAD, CCW), style)
	userHeader.addstr(0, 0, stralign.alignC(UHEAD, UCW), style)
	
	roomHeader.refresh()
	chatHeader.refresh()
	userHeader.refresh()
示例#3
0
def drawTopBar():
	
	"""
	Draws the bar at the top of the application indicating whether one is in
	Command Mode or in Chat Mode.
	
	@type hPad:
		int
	@param hPad:
		The amount of space to leave between the end of a string and the right
		side of the window.  This is the horizontal padding.
	"""
	
	msg = TOP_CMD_STR
	style = ATTR_CMODE
	
	if not cmdMode:
		msg = TOP_MSG_STR
		style = ATTR_MMODE
	
	topbar.addstr(0, 0, stralign.alignC(msg, TCW), style)
	topbar.refresh()