Browse Source

Colours are now all set into vars. Just need to work out a way to check if stdout is a pipe.

import/heads/master
Cian Brennan 11 years ago
parent
commit
e220316fc6
1 changed files with 6 additions and 5 deletions
  1. +6
    -5
      rbusers.py

+ 6
- 5
rbusers.py View File

@@ -16,7 +16,9 @@ cyan_back_escape = '\033[;46m'
green_back_escape = '\033[;42m'
magenta_back_escape = '\033[;45m'
yellow_back_escape = '\033[;43m'

groups = { 100 : '\033[;31m', 107 : '\033[;36m', \
108 : '\033[;32m', 102 : '\033[;33m', 101 : '\033[;35m' }
title_message = '\033[;31mTotal \033[;0mNumber \033[;33mof \033[;34mUsers \033[;35monline\033[;0m:'
for user in users :
n = user.ut_user
try :
@@ -31,7 +33,7 @@ friends_file = open( os.path.expanduser('~/.friends'), 'r')
friends = [ i.rstrip() for i in friends_file.readlines() ]
#http://old.nabble.com/Unable-to-see-os.environ-%27COLUMNS%27--td19487200.html
print '%s%s%s' % (' ' \
,'\033[;31mTotal \033[;0mNumber \033[;33mof \033[;34mUsers \033[;35monline\033[;0m:', len(logged_users) )
, title_message, len(logged_users) )
print '%s%s%s%s%s%s%s' % ( ' ',\
white_back_escape, ' \033[;0m friends ', \
red_back_escape, ' \033[;0m committee ',\
@@ -41,14 +43,13 @@ magenta_back_escape, ' \033[;0m society ',\
yellow_back_escape, ' \033[;0m club ',\
green_back_escape, ' \033[;0m guest' )
print
groups = { 100 : '\033[;31m', 107 : '\033[;36m', \
108 : '\033[;32m', 102 : '\033[;33m', 101 : '\033[;35m' }
iter = 0
print ' ',
for user in logged_users.keys() :
iter = iter + 1
if user in friends :
print ' %s%s (%d)' % (white_text_escape, user.ljust(8), logged_users[user] ),
print ' %s%s (%d)' %\
(white_text_escape, user.ljust(8), logged_users[user] ),
else :
try :
group = pwd.getpwnam(user)[3]


Loading…
Cancel
Save