def print_probes():
termx, termy = get_termsize()
col1_width = termx // 2
col2_width = termx - col1_width - 1
DISPLAY_PROBES_MAX = termy - 2
print TERM_RESET + TERM_POS_ZERO + str(datetime.now()).center(termx)
for i in range(len(probes)):
probe = probes[i]
# ssid
out = ''
out += TERM_BOLD
age = (datetime.now() - probe['last_seen']).total_seconds()
if age < 60:
out += TERM_RED
elif age < 180:
out += TERM_YELLOW
else:
out += TERM_GREEN
out += probe['ssid'].rjust(col1_width)
# time
out += ' '
out += TERM_RESET + TERM_BLUE
out += humanize.naturaltime(probe['last_seen']).ljust(col2_width)
print out
评论列表
文章目录